-
Notifications
You must be signed in to change notification settings - Fork 162
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
fix crash when write GOT if library was built with "-z relro" but not… #10
Conversation
@tntljc Thanks!
It works without your patch. See this test results about 7 months ago. |
FYI. The test failure in this pull request will be fixed by this commit. |
Hi @kubo, the crash was originally found on Arch Linux but can be reproduced on Ubuntu 16.04 as well. The gcc version is 8.1. I can't write a test for now at home as I don't have Linux environment. Thanks for pointing out the partial RELRO test case for me, but in my case there is another gcc option "-fno-plt" (sorry I didn't mention it in the first place), so it's actually a real conner case as it's partial RELRO but the function relocation goes through the .got which is read-only. Put things together:
|
Thanks for the information. I confirmed that tests fail with |
Thanks, could you descripbe more specifically on the first crash you saw with partial RELRO and no-plt? I’m using plthook in my project and maybe I’ll encounter the same on in the future. Will you also submit the fix? |
When an executable is compiled with partial RELRO and no-plt, Lines 662 to 668 in 3bbafe3
When a library is compiled with partial RELRO and no-plt, all relocation symbols are in .rela.dyn . There is no .rela.plt . So you didn't hit the first issue I saw.
I checked above by using
Yes. |
@tntljc The pull request was merged. Thanks for your contribution. |
Thanks for reviewing and merging my change! BTW, I built my library with -fno-plt and -O2 so the binary has no .rela.plt. that’s why I can’t see your first crash. |
… "-z now"