-
Notifications
You must be signed in to change notification settings - Fork 13.4k
src/rt/arch/i386/morestack.S: call rust_stack_exhausted via plt #26321
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
Conversation
This prevents a relocation in the text section. Text relocations are incompatible with hardened kernels. rust-lang#5714
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Do crashes Graydon mentioned in #5714 not happen with this change anymore? |
I believe Graydon's comment referred to an earlier version of the code (as evidenced by the reference to "upcall_new_stack", which no longer exists). However, I can verify that I was able to run a rust program against the modified standard libraries without difficulty. |
I'll admit that I don't quite know what's going on here, I don't understand the motivation behind the original bug. Is... this causing problems? What problems are those if so? |
The original bug was "i386 code ends up with TEXTREL sections." This is bad for a couple of reasons. One, it flat won't work with a hardened kernel. Two, bitbake flags this as a QA problem, so this shows up if you build rust with bitbake. Three, it uses unecessary memory at runtime, because the dynamic linker has to make a change to a code page, meaning that the entire page has to be copied and can't be shared across processes. The original problem was that rust_get_task and upcall_*_stack were being called directly instead of through the PLT. Someone tried to fix that, and it caused some kind of crash, apparently. However, the __morestack code was significantly rewritten since then. Now it calls rust_stack_exhausted from assembly. Note that the x86_64 version of this routine already uses the PLT to call rust_stack_exhausted, and so it doesn't have the TEXTREL problem. I'm just making the i386 code match x86_64. |
This prevents a relocation in the text section. Text relocations are incompatible with hardened kernels. #5714
⌛ Testing commit 85be7c5 with merge 8af39ce... |
This prevents a relocation in the text section. Text relocations are
incompatible with hardened kernels.
#5714