Skip to content

[SWSPLAT-24318] Backport ELFIO note bounds validation - #7773

Draft
sstamenk wants to merge 3 commits into
mainfrom
users/sstamenk/swsplat-24318-elfio-note-bounds
Draft

sstamenk wants to merge 3 commits into
mainfrom
users/sstamenk/swsplat-24318-elfio-note-bounds

Conversation

@sstamenk

@sstamenk sstamenk commented Aug 31, 2026 •

Copy link
Copy Markdown
Member

Motivation

Backport ELFIO #173 to TheRock's pinned ELFIO 3.12.

JIRA ID: SWSPLAT-24318

Technical Details

Ports serge1/ELFIO#173 at 5aaee4f to ELFIO 3.12 (on top of the existing 0001 patch). The changes:

  • Check note indices against the parsed note count, and bounds-check cached offsets against the current data.
  • Share record decoding between scanning and retrieval, with alignment-safe header reads and complete padded-length checks.
  • Preserve nameless notes and notes whose owner name lacks a terminator (the full name is returned, as readelf does). Outputs are left unchanged on validation failure.
  • add_note() records a zero descriptor size when desc is null, and pads existing data to a 4-byte boundary before appending. When the existing data did not decode completely, it rescans, so the accessor's note indices match a fresh accessor's.

The public API is unchanged. Compared with the upstream PR, only the 3.12 adaptations differ: the convertor is a reference rather than a pointer, and comments follow 3.12 style.

Remove the patch when upgrading to an ELFIO release containing the upstream change.

Test Plan

  • Apply the patches with TheRock's patch_third_party_source.py to a fresh elfio-3.12.tar.gz (SHA512 matching third-party/elfio), together with [SWSPLAT-24296] Backport ELFIO hash table bounds validation #7772's symbol patch.
  • Build ELFIO 3.12's test suite with the upstream PRs' bounds tests, using GCC ASan/UBSan.
  • Compare note decoding for every file in ELFIO's tests/elf_examples, patched vs. unpatched 3.12.

Test Result

  • Patch application passed with no rejects, and the patched headers match the tested source.
  • 73/73 tests pass with ASan/UBSan. On unpatched 3.12, 31 of those tests fail.
  • Note decoding matches unpatched 3.12 for every example file, except that the Freescale notes in startup.eln/startup_orig.eln now return their full owner name (Freescale Semiconductor) instead of a truncated one.

Submission Checklist

Prepared with AI assistance.

🤖 Generated with Claude Code

Add the ELFIO 3.12 backport for bounded note parsing while the upstream fix is reviewed in serge1/ELFIO#173.

Refs: SWSPLAT-24318
@therock-pr-bot

therock-pr-bot Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ✅ Pass PR does not contain code files — Unit Test auto-passed
🔎 pre-commit ✅ Pass —
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —
🤖 therock-pr-bot ✅ Pass —

🎉 All checks passed! This PR is ready for review.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

@therock-pr-bot therock-pr-bot Bot added the Not ready to Review PR has unresolved policy failures — reviews blocked label Aug 31, 2026
@therock-pr-bot

therock-pr-bot Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

🎉 All checks passed! This PR is ready for review.

@therock-pr-bot therock-pr-bot Bot removed the Not ready to Review PR has unresolved policy failures — reviews blocked label Aug 31, 2026
Synchronize the ELFIO 3.12 note accessor updates with upstream and simplify patch notes.

Refs: SWSPLAT-24318
Rebase the backport onto serge1/ELFIO#173 at 5aaee4f. Adds acceptance of
owner names without a terminator, a zero descriptor size for notes added
without data, 4-byte alignment of notes added after unaligned data, and a
rescan in add_note() so cached indices stay consistent with a fresh
accessor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: TODO

Development

Successfully merging this pull request may close these issues.

1 participant