Skip to content

Handle compressed DWARF sections in ELF binaries - #1179

Merged
Martin Kačmar (mkacmar) merged 6 commits into
microsoft:mainfrom
qmuntal:qmuntal/fix-dwarf-version-reporting
Sep 24, 2026
Merged

Martin Kačmar (mkacmar) merged 6 commits into
microsoft:mainfrom
qmuntal:qmuntal/fix-dwarf-version-reporting

Conversation

@qmuntal

Copy link
Copy Markdown
Member

Summary

  • detect ELF SHF_COMPRESSED debug sections via raw section flags
  • decompress zlib-compressed DWARF section contents before parsing
  • add regression coverage for ELF64 compressed-section payloads

Fixes #1175

@qmuntal
Quim Muntal (qmuntal) requested a review from a team as a code owner April 20, 2026 09:09
@danmoseley

Copy link
Copy Markdown

Interesting that this hasn't come up before -- apparently no other toolchains produce this? or at least with flags typically used?

@danmoseley

Copy link
Copy Markdown

@qmuntal

Copy link
Copy Markdown
Member Author

Friendly ping 😸

Comment thread src/BinaryParsers/ElfBinary/ElfBinary.cs Outdated
@danmoseley

Copy link
Copy Markdown

@qmuntal

Copy link
Copy Markdown
Member Author

Friendly ping 😸

@danmoseley

Copy link
Copy Markdown

Sasinkas can maybe help. Sasinkas this is part of bringing up fuller support for running binskim over Microsoft golang binaries.

@danmoseley

Copy link
Copy Markdown

@mkacmar Martin Kačmar (mkacmar) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you add an end to end test using a real binary with compressed DWARF (there are existing tests that use checked-in ELF fixtures already)?

Comment thread src/BinaryParsers/ElfBinary/ElfBinary.cs
Comment thread src/BinaryParsers/ElfBinary/ElfBinary.cs Outdated
Comment thread src/BinaryParsers/ElfBinary/ElfBinary.cs
@mkacmar

Copy link
Copy Markdown
Member

Also, can you please rebase?

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@qmuntal
Quim Muntal (qmuntal) force-pushed the qmuntal/fix-dwarf-version-reporting branch from 78fc294 to 0bda534 Compare September 23, 2026 14:29
@mkacmar

Copy link
Copy Markdown
Member

This looks good, can you please add some actual binaries like I mentioned in my previous comment? https://github.com/microsoft/binskim/blob/main/src/Test.UnitTests.BinaryParsers/Elf/ElfBinaryTests.cs

@qmuntal

Copy link
Copy Markdown
Member Author

This looks good, can you please add some actual binaries like I mentioned in my previous comment?

Done!

@mkacmar
Martin Kačmar (mkacmar) merged commit f5500f1 into microsoft:main Sep 24, 2026
4 checks passed
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.

BA3004 reports DWARF version 0 for Go 1.26 Linux ELF binaries that contain DWARF v5

5 participants