-
Notifications
You must be signed in to change notification settings - Fork 214
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
add dynamic range configuration #229
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks!
(One thing that we might want to improve in the longer term is the granularity of UsedLevel4Entries
. Right now, we always reserve the full level 4 entry for each mapping, and also round the new dynamic range keys accordingly. Ideally, we would manage these all at 4k page level somehow.)
We could just store the used ranges in an array instead. The size requirements for that scale linearly with the amount of ranges we'd want to support (which aren't all that many), irregardless of the granularity. |
Sounds like a good idea to me! The only question is how many array entries we should reserve for Just FYI: I'm currently working on a new design of this crate in the |
I just opened a draft PR at #232 |
Looks like we need up to 8 ranges (as of time of writing):
Awesome, I'll give it a try in the next few days! |
The kernel could have multiple distinct segments, so we need a larger number. |
I'm currently having some problems with the |
Ok, I replaced it with |
I'm not quite sure, but the x86_64-unknown-none spec disables a few more cpu features than we do:
That seems like a good alternative. |
That's true. I just manually checked all the test kernels and they have between 4 and 8 segments. My kernel has 9. We could just use a higher capacity e.g 32. Assuming 16 bytes for each entry (8 bytes for address and 8 bytes for the size) that would need 512 bytes which is what we currently also use for the |
Version [0.10.13][1] of `bootloader` made it possible to configure the start address of the dynamic range into which the kernel binary is mapped (see rust-osdev/bootloader#229). This allows us to configure the bootloader to boot with the kernel already mapped into the higher half of the virtual address space, which seems nice. [1]: https://github.com/rust-osdev/bootloader/blob/main/Changelog.md#01013--2022-09-25
Version [0.10.13][1] of `bootloader` made it possible to configure the start address of the dynamic range into which the kernel binary is mapped (see rust-osdev/bootloader#229). This allows us to configure the bootloader to boot with the kernel already mapped into the higher half of the virtual address space, which seems nice. [1]: https://github.com/rust-osdev/bootloader/blob/main/Changelog.md#01013--2022-09-25
Version [0.10.13][1] of `bootloader` made it possible to configure the start address of the dynamic range into which the kernel binary is mapped (see rust-osdev/bootloader#229). This allows us to configure the bootloader to boot with the kernel already mapped into the higher half of the virtual address space, which seems nice. [1]: https://github.com/rust-osdev/bootloader/blob/main/Changelog.md#01013--2022-09-25
This pr makes it possible to restrict the range of dynamically generated addresses.
This is the last step in getting my higher-half kernel to work with full ASLR.