-
Notifications
You must be signed in to change notification settings - Fork 29
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
Implement ASLR #707
Comments
Duplicate of #323? |
I came across a problem when trying to find the lowest possible barrier that applications can be loaded from. I spent the last hour investigating, and plan to bring out gdb and Valgrind after trying to get a better picture of where the problem exactly happens. This is a long text, mostly for myself as I like "working in public" and, if I don't get any further, help any future contributors to this project (or perhaps myself). So, we have memory, and we are looking for some place to load the kernel onto. There are currently three limitations:
The size is assumed to be Line 23 in 3e869b0
Lines 227 to 228 in 9ba3c9d
I'd imagine that to be a bit large on its own, but nevertheless... let's set the start address to So, this is either an alignment problem or, perhaps, as the I tried a few different values for
Again:
... which is fair. But worth a try anyway. The lowest address from which Uhyve ( Here's the fun part! Is something wrong with To be continued? |
Note that Hermit C images are not relocatable yet, so |
Thank goodness that there's a clear explanation for this and that not all images are relocatable - even if that's the goal - but it seems convenient enough to just compare the values. Should've brought the debugger out, but my brain turned mushy. (EDIT: I laid out a plan here, but now I am actually attempting the implementation and turned this already-large reply to a TODO list. My tree can be found here: https://github.com/n0toose/uhyve/tree/aslr-support-poc) Preparation: There's, without being sure if it's exclusively because of Uhyve or if anything else is reserving anything, not enough space.
I am not sure what the consequences would be, given the value is only used to check if there's space before loading anything. Implementation:
Clean up: (will open in separate issues if the implementation lands to
I am not sure if I can estimate the time this would take me. I previously discussed using goblin to evaluate whether an ELF file is relocatable, but it was seen as too redundant because images should always be relocatable by definition. This still represents the project's direction and I believe in reducing bloat when developing software, but has been discussed before (#26 (comment)). I'll avoid using goblin, as |
FYI: Hermit C images are now relocatable. 🥳 |
Thank you! Now I can finally sleep peacefully. 😄 That means that the changes where I tried to detect whether an image is relocatable will have to be reverted, as they should be relocatable by definition now. There was still an outstanding problem that a relocatable image would not boot if an address over |
See #744 |
As Hermit is relocatable, we should load the Kernel to a random address in the virtual address space. The starting point for this is here:
uhyve/src/vm.rs
Lines 182 to 200 in 9ba3c9d
The text was updated successfully, but these errors were encountered: