note: allow notes with alignment 0 #52
Open
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.
On an aarch64 machine running Debian the notes section of a core dump is generated with p_align=0 in the program header, while in the notes section both name and description are aligned to 4 bytes.
The manpage for elf(5) suggests that padding is inserted after name and description to always end on a 4 byte boundary, and that p_align values of 0 and 1 mean no alignment is required. Commit 3713bb2 observes that a p_align value of 8 has been seen in the wild, though the test case doesn't confirm if the 8 byte alignment was applied to name, description, each note or the section as a whole. The pdf linked from the added comment suggests that each note is aligned to p_align, but doesn't say anything about the alignment of name and description.
To allow the p_align=0 core file seen in the wild without potentially breaking p_align=8 files regardless of where the alignment is applied this patch only adjusts the actual alignment when p_align is 0 to four bytes.
The added test is a stripped down version of the aarch64 core file that only retains one note.