Comments (2)
I'm trying to implement multitasking in user mode with the following setup:
- Each task has a user-mode and kernel-mode stack
- The kernel-mode stack pointer is placed in the privilege stack table of the TSS (so it is switched to on interrupts, exceptions, and system calls)
- On a context switch, the privilege stack table is updated to point to the kernel-mode stack for the new task
But with this crate, there is a problem. To add the TSS, the
Descriptor::tss_segment
function should be called with theTaskStateSegment
structure, to create aDescriptor
that can be added to the GDT. But the function expects a&'static
reference to theTaskStateSegment
, which means that, once called, no further modifications are possible to the TSS (the&'static
reference cannot coexist with any mutable references), so it is not possible to update the TSS on context switching.Would it be a good idea to loosen the requirements for calling this function?
The way I see it, there are two ways to solve this:
- Add an unsafe function that makes the caller responsible for ensuring that the TSS is valid while the entry is in use.
- Make it possible to modify the TSS fields atomically.
Option 2 will likely require breaking changes, so I tend towards option 1 for now (though we were planning on releasing a new breaking version anyways, so option 2 should also be good).
from x86_64.
I think it makes sense to implement both option 1 and option 2. There will always be cases where our safe abstractions are not a good fit, so we should allow users to plug in their own abstractions if desired. So starting with option 1 sounds good to me!
@SamZhang3 If you have time, it would be great if you could create a PR to add an unsafe Descriptor::tss_segment_unchecked
function that takes a *const TaskStateSegment
as argument.
from x86_64.
Related Issues (20)
- Set minimal scoped permissions to github workflow HOT 1
- Create a Security Policy
- Mutable references in page table implementation? HOT 1
- IDT and page table code causing trouble in Confidential Computing space HOT 1
- Hash pin workflow dependencies HOT 9
- recursive page table with recursive index 511 is unsound HOT 7
- How can I set 2MiB page frame in my Page Directory Table? HOT 1
- How do I map to a virtualized physical address? HOT 1
- Enable OpenSSF Scorecard Action HOT 2
- [Question] Is there a reason to not support pagemaps level 5 ? HOT 2
- Trait for Entry handler function types? HOT 2
- Should we add an register abstraction? How should it work with and ?
- `VirtAddr` arithmetic may panic HOT 2
- Returning FrameAlreadyMapped error when it shouldn't HOT 10
- Should have a way to construct an `InterruptStackFrameValue`? HOT 3
- A `VirtualAddr` panic is triggered when the page table called `clean_up` HOT 3
- `Sealed::DEBUG_STR` is publicly accessible HOT 10
- PageTable: Handling of pages without the present flag set HOT 2
- `Mapper::unmap` should be unsafe HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from x86_64.