Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gdt::get_main_iopb does not prevent creation of multiple mut ref. #98

Closed
todo bot opened this issue Dec 22, 2018 · 0 comments
Closed

gdt::get_main_iopb does not prevent creation of multiple mut ref. #98

todo bot opened this issue Dec 22, 2018 · 0 comments
Assignees
Labels
project-kernel Related to the kernel safety Something is unsound, could be unsafe todo 🗒️ Created by the todo bot type-bug Something isn't working

Comments

@todo
Copy link

todo bot commented Dec 22, 2018

There's currently no guarantee that we don't create multiple &mut pointer to the IOPB region, which would cause undefined behavior. In practice, it should only be used by `i386::process_switch`, and as such, there is never actually two main_iopb active at the same time. Still, it'd be nicer to have safe functions to access the IOPB.


https://github.com/roblabla42/KFS/blob/adee47274ba5c0dc0ef112ce8933becd63d3da77/kernel/src/i386/gdt.rs#L189-L199


This issue was generated by todo based on a TODO comment in adee472 when #90 was merged. cc @roblabla.
@todo todo bot assigned roblabla Dec 22, 2018
@todo todo bot added the todo 🗒️ Created by the todo bot label Dec 22, 2018
@roblabla roblabla added type-bug Something isn't working project-kernel Related to the kernel safety Something is unsound, could be unsafe labels Dec 23, 2018
@Orycterope Orycterope self-assigned this Jul 9, 2019
Orycterope referenced this issue in Orycterope/SunriseOS Jul 10, 2019
Changing the way we allocate and initialize the MAIN_TSS and DOUBLE_FAULT_TSS.

They used to be lazily allocated, and the both the DOUBLE_FAULT_TSS stack and TSS were allocated by the IDT, and pushed to the GDT late.

Now the MAIN_TSS, DOUBLE_FAULT_TSS, and DOUBLE_FAULT_STACK all live in the .bss, and are fully initialized on GDT init.

The IDT only takes a segment selector pointing to the already initialized TSS for task gates.

The MAIN_TSS and its IOPB are now behind a lock. This fixes #98.

Following c6641998, the GDT is now an open fixed-sized array, addressable from other modules. We use this property to modify some segments base addresses in the process-switch.
roblabla pushed a commit to roblabla/KFS that referenced this issue Jul 20, 2019
Changing the way we allocate and initialize the MAIN_TSS and DOUBLE_FAULT_TSS.

They used to be lazily allocated, and the both the DOUBLE_FAULT_TSS stack and TSS were allocated by the IDT, and pushed to the GDT late.

Now the MAIN_TSS, DOUBLE_FAULT_TSS, and DOUBLE_FAULT_STACK all live in the .bss, and are fully initialized on GDT init.

The IDT only takes a segment selector pointing to the already initialized TSS for task gates.

The MAIN_TSS and its IOPB are now behind a lock. This fixes sunriseos#98.

Following c6641998, the GDT is now an open fixed-sized array, addressable from other modules. We use this property to modify some segments base addresses in the process-switch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project-kernel Related to the kernel safety Something is unsound, could be unsafe todo 🗒️ Created by the todo bot type-bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants