Skip to content

[elfutils] Add deep libdw DWARF API fuzzer#15450

Open
TristanInSec wants to merge 1 commit intogoogle:masterfrom
TristanInSec:add-elfutils-libdw-fuzzer
Open

[elfutils] Add deep libdw DWARF API fuzzer#15450
TristanInSec wants to merge 1 commit intogoogle:masterfrom
TristanInSec:add-elfutils-libdw-fuzzer

Conversation

@TristanInSec
Copy link
Copy Markdown

Add fuzz-libdw fuzzer targeting elfutils libdw's deep DWARF processing APIs that are not exercised by the existing fuzzers (fuzz-libelf, fuzz-libdwfl, fuzz-dwfl-core).

Coverage

The new fuzzer exercises 15+ libdw APIs across these DWARF processing surfaces:

  • CU/DIE tree: dwarf_get_units, dwarf_child, dwarf_siblingof, dwarf_tag, dwarf_diename, attribute access (dwarf_attr, dwarf_formstring, dwarf_formref_die, dwarf_getlocation)
  • Source lines: dwarf_getsrclines, dwarf_onesrcline, dwarf_lineaddr, dwarf_lineno, dwarf_linecol, and all line flag accessors
  • Source files: dwarf_getsrcfiles, dwarf_filesrc, dwarf_getsrcdirs
  • Macros: dwarf_getmacros with bounded callback
  • Address ranges: dwarf_getaranges, dwarf_onearange, dwarf_getarangeinfo, dwarf_getarange_addr
  • CFI: dwarf_getcfi (.debug_frame) and dwarf_getcfi_elf (.eh_frame), dwarf_cfi_addrframe, dwarf_frame_cfa, dwarf_frame_register
  • Raw .debug_line: dwarf_next_lines independent of CU iteration
  • Misc: dwarf_getscopes, dwarf_getpubnames, dwarf_ranges, dwarf_aggregate_size

Why

Existing elfutils fuzzers cover ELF structure parsing (fuzz-libelf), DWFL high-level loading (fuzz-libdwfl), and core file processing (fuzz-dwfl-core). None of them exercise the deep DWARF data interpretation APIs listed above. These APIs parse complex variable-length encodings (LEB128, DWARF expressions, line number programs, CFI instructions) from untrusted .debug_* section data and represent significant attack surface in any tool that processes DWARF information.

Iteration bounds

All loops are bounded to prevent timeout:

  • DIE iteration: max 4096 DIEs, max depth 63
  • Source lines: max 1024 per CU
  • Source files: max 256 per CU
  • Macros: max 256 per CU (via callback)
  • Ranges: max 256 per DIE
  • Aranges: max 1024
  • Raw line programs: max 64
  • CFI registers: 0-31

Build

Appends to existing build.sh using the same compilation pattern as the other elfutils fuzzers.

Add fuzz-libdw fuzzer targeting libdw's deep DWARF processing APIs
that are not exercised by existing fuzzers (fuzz-libelf, fuzz-libdwfl,
fuzz-dwfl-core). Covers:

- CU/DIE iteration and attribute access (tag, name, location, ranges)
- Source line and file tables (dwarf_getsrclines, dwarf_getsrcfiles)
- Macro expansion (dwarf_getmacros)
- Address ranges (dwarf_getaranges)
- CFI from .debug_frame and .eh_frame
- Raw .debug_line iteration (dwarf_next_lines)
- Scope and pubnames queries

Bounded iteration limits prevent timeout on complex inputs.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

TristanInSec is a new contributor to projects/elfutils. The PR must be approved by known contributors before it can be merged. The past contributors are: evverx, catenacyber, izzeem

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