Skip to content

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

Merged
edolstra merged 3 commits into
NixOS:masterfrom
Mic92:note-2
Jul 31, 2020
Merged

edolstra merged 3 commits into
NixOS:masterfrom
Mic92:note-2

Conversation

@Mic92

@Mic92 Mic92 commented Jul 31, 2020

Copy link
Copy Markdown
Member

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

haampie commented Sep 23, 2022 •

Copy link
Copy Markdown
Contributor

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

Mic92 commented Oct 28, 2022

Copy link
Copy Markdown
Member Author

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.

4 participants