-
Notifications
You must be signed in to change notification settings - Fork 235
Use symcheck to locate writeable+executable object files #934
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
base: master
Are you sure you want to change the base?
Conversation
From what I have been able to find, compilers that try to emit object files compatible with a GNU linker appear to add a `.note.GNU-stack` section if the stack should not be writeable (this section is empty). We never want a writeable stack, so extend the object file check to verify that object files with any executable sections also have this `.note.GNU-stack` section. This appears to match what is done by `scanelf` to emit `!WX` [2], which is the tool used to create the output in the issue. Closes: rust-lang#183 [1]: https://github.com/gentoo/pax-utils/blob/9ef54b472e42ba2c5479fbd86b8be2275724b064/scanelf.c#L428-L512
ada5714
to
9f44c32
Compare
Thumb makes sense to skip as a bare metal target. Note sure about ppc64 |
Pinging some people who work on PowerPC in rust/llvm to : @daltenty @ecnelises @lei137 I'm trying a small C program on powerpc64, powerpc64le, and powerpc (32). For both powerpc32 and powerpc64le, as well as all other architectures I have tried, there is an empty section named Is there some other way that a non-writeable stack is indicated, or is this not relevant on the powerpc64 arch? Repro, note how there is no
|
Clang seems to emit the section still, so I guess there could be a chance it is a bug with GCC.
|
From what I have been able to find, compilers that try to emit object files compatible with a GNU linker appear to add a
.note.GNU-stack
section if the stack should not be writeable (this section is empty). We never want a writeable stack, so extend the object file check to verify that object files with any executable sections also have this.note.GNU-stack
section.This appears to match what is done by
scanelf
to emit!WX
1, which is the tool used to create the output in the issue.Closes: #183