[llvm-bugs] [Bug 44260] New: Unreachable triggered when parsing DWARF V5 line table with unsupported FORM

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 10 02:17:11 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=44260

            Bug ID: 44260
           Summary: Unreachable triggered when parsing DWARF V5 line table
                    with unsupported FORM
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: jh7370.2008 at my.bristol.ac.uk
                CC: jdevlieghere at apple.com, keith.walker at arm.com,
                    llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com

I ran into this when writing some llvm-dwarfdump tests. If a DWARF V5
.debug_line table header includes a file name or directory entry type with an
unsupported FORM value, and llvm-dwarfdump is used to dump the said line table,
an llvm_unreachable is triggered when parsing that field.

// example assembly
.section .debug_line,"", at progbits
    .long .Lunit0_end - .Lunit0_begin # unit_length
.Lunit0_begin:
    .short 5 ## version
    .byte 8  ## address_size
    .byte 0  ## segment_selector_size
    .long .Lheader0_end - .Lheader0_begin ## header_length
.Lheader0_begin:
    .byte 1  ## minimum_instruction_length
    .byte 1  ## maximum_operations_per_instruction
    .byte 1  ## default_is_stmt
    .byte -5 ## line_base
    .byte 7  ## line_range
    .byte 13 ## opcode_base
    .byte 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ## standard_opcode_lengths
    .byte 1  ## directory_entry_format_count
    .byte 0x1, 0x7F ## DW_LNCT_path, unknown form
    .byte 1  ## directories_count
    .byte 0  ## directory entry 0
    .asciz "dir1/dir2"
    .byte 1  ## file_name_entry_format_count
    .byte 0x1, 0xB ## DW_LNCT_path, DW_FORM_string
    .byte 0x2, 0x5 ## DW_LNCT_directory_index, DW_FORM_data1
    .byte 2  ## file_names_count
    .byte 0  ## file name entry 0
    .asciz "file1.c"
    .byte 1  ## file name entry 1
    .long 0x12345678
.Lheader0_end:
.Lunit0_end:

C:\Work> llvm-dwarfdump --debug-line test.o
test.o: file format ELF64-x86-64

.debug_line contents:
debug_line[0x00000000]
unsupported form
UNREACHABLE executed at
C:\llvm\llvm-project\llvm\lib\DebugInfo\DWARF\DWARFFormValue.cpp:350!
<stack dump...>

The unreachable has an associated comment which seems to imply that the
extractValue code was written for parsing .debug_info, and as such unsupported
DW_FORM_* values are not handled (because they should be handled earlier).
Clearly the code needs updating to allow for DW_FORM_* values coming from
.debug_line. It's probably reasonable to abort parsing of the line table when
an unsupported DW_FORM_* is hit, since it's impossible to know how to handle
the file/directory table in this case.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191210/9ba509f4/attachment.html>


More information about the llvm-bugs mailing list