Skip to content
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

Better support relocating NOTE sections/segments + tests! #225

Merged
merged 3 commits into from Jul 31, 2020

Conversation

Mic92
Copy link
Member

@Mic92 Mic92 commented Jul 31, 2020

No description provided.

delroth and others added 3 commits June 20, 2020 14:22
SHT_NOTE sections can be mapped in memory by PT_NOTE segments. When
rewriting an SHT_NOTE, attempt to also rewrite a matching segment if it
exists.

Note that an ELF can contain multiple SHT_NOTE sections, and a given
PT_NOTE segment can theoretically map multiple contiguous sections.
There are multiple ways this could be handled, the one picked here is to
pre-normalize PT_NOTE segments so that a multi-section segment gets
broken up into multiple separate segments instead.

Also fix (or more like hack around) alignment issues with note sections.
Keeping the original alignment value when possible is important because
it determines how the data within the section needs to be parsed.
@haampie
Copy link
Contributor

haampie commented Sep 23, 2022

This PR generates causes executables to be generated where the .dynstr section is not fully contained in a segment, but overlaps two segments. gdb complains about this, and on a particular filesystem I'm using, it seems to cause the binary to be broken (it errors with mmap/mprotect errors or segfaults)

@Mic92
Copy link
Member Author

Mic92 commented Oct 28, 2022

The regression hopefully fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants