Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

zidel
Copy link

@zidel zidel commented Sep 8, 2025

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.

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.
@zidel zidel force-pushed the aarch64_core_dump branch from 78c9b5c to 78c9c85 Compare September 8, 2025 15:12
@zidel
Copy link
Author

zidel commented Sep 9, 2025

Using coredump_filter=0 I got the full core dump down to 16K, so it could be included in sample-objects/ as well if you want.

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.

1 participant