This repository was archived by the owner on Dec 3, 2019. It is now read-only.
[BUGFIX] Find the correct segment on Debian Unstable#155
Open
cbayet wants to merge 1 commit intouber-archive:masterfrom
Open
[BUGFIX] Find the correct segment on Debian Unstable#155cbayet wants to merge 1 commit intouber-archive:masterfrom
cbayet wants to merge 1 commit intouber-archive:masterfrom
Conversation
|
I think my fix (#170) is the correct fix for this.
The problem is that the offset of the SO in the process VMA is not computed correctly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since binutils 2.31, the options --enable-separate-code is enabled by default for Linux x86 binaries.
(see changelog https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob_plain;f=ld/NEWS;hb=refs/tags/binutils-2_31)
This new version of binutils is the version of last Debian Unstable.
You can still compile your binaries with the option "-z no-separate-code" in gcc, but pyflame should be able to support this.
This breaks pyflame, in the parsing of the ELF, in the function GetBaseAddress : we're looking for the start of the .text section, but because of this change into binutils, the first PT_LOAD segment found is the ELF header segment, and not the .text.
The patch now look for a PT_LOAD segment with the executable flags, since the ELF header segment is not executable.
I already found a bug with the same root cause in frida and patched it: frida/frida-core#208
Tested on python 2.7.15 and 3.6.7.
Thanks for the project, and don't use Debian Unstable !