Skip to content

feat(native): support ELF modules at non-zero file offsets - #2265

Merged
jpnurmi merged 3 commits into
v1from
jpnurmi/feat/native-elf-offsets
Oct 29, 2026
Merged

jpnurmi merged 3 commits into
v1from
jpnurmi/feat/native-elf-offsets

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

The minidump writer and capture_modules_from_proc_maps() grouped /proc/<pid>/maps entries by file name and expected an ELF header at offset 0. An ELF image can also start inside a larger file, such as an uncompressed library that Android maps straight from an APK, and such images were dropped from the module list.

Start a module at each mapping whose file offset holds an ELF header, group the image's other segments by its load range, and read the build ID, size, and SONAME at that offset. Move compute_elf_size_from_phdrs() to sentry_elf.h to share it.

This prepares a small part of the native backend for Android, where AGP's default packaging maps every app library from the APK.

#skip-changelog (extracted from #1725)

The minidump writer and `capture_modules_from_proc_maps()` grouped
`/proc/<pid>/maps` entries by file name and expected an ELF header at
offset 0. An ELF image can also start inside a larger file, such as an
uncompressed library that Android maps straight from an APK, and such
images were dropped from the module list.

Start a module at each mapping whose file offset holds an ELF header,
group the image's other segments by its load range, and read the build
ID, size, and SONAME at that offset. Move
`compute_elf_size_from_phdrs()` to `sentry_elf.h` to share it.

This prepares the native backend for Android, where AGP's default
packaging maps every app library from the APK.

Ref: #1725
@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 6388a2f

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 79ef475. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 79ef475. Configure here.

@jpnurmi jpnurmi added the v1 Targets 1.0 (v1 branch) label Oct 28, 2026
The previous commit adjusted the section header offset in
`elf_locate_symtab()` instead of `extract_elf_build_id_for_module()`,
where `elf_offset` is not declared, so the crash daemon failed to
compile. Move the adjustment to where the build ID is read.
The `offset > start` guard in `capture_modules_from_proc_maps()` dropped
mappings before an ELF image inside a larger file could be detected.
The guard only protects the `start - offset` load base of a regular ELF
file, so apply it there instead.
@jpnurmi
jpnurmi added this pull request to stack #2272 October 29, 2026 11:20
@jpnurmi
jpnurmi merged commit 5d930d5 into v1 Oct 29, 2026
68 checks passed
@jpnurmi
jpnurmi deleted the jpnurmi/feat/native-elf-offsets branch October 29, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1 Targets 1.0 (v1 branch)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants