[PATCH] backends: add abi_cfi and register_info callbacks for RISC-V

2018-06-13 Thread Andreas Schwab
From and GCC source. Signed-off-by: Andreas Schwab --- backends/Makefile.am | 2 +- backends/riscv_cfi.c | 75 ++ backends/riscv_init.c | 4 + backends/riscv_regs.c | 177 +++

[PATCH] readelf: Handle signedness of DW_FORM_implicit_const and DW_AT_const_value.

2018-06-13 Thread Mark Wielaard
We only handles DW_FORM_sdata as a signed form, but DW_FORM_implicit_const is also signed by default. For DW_AT_const_value we can do a little better. GCC encodes some const_values with signed forms, even though the type is unsigned. Lookup the (base) type of the DIE and display the const value as

[PATCH] readelf: While printing .debug_loc make sure that next_off doesn't overflow.

2018-06-13 Thread Mark Wielaard
Found by the afl fuzzer. The next offset (after a locview) comes from a DIE loclist attribute. This could be a bogus value so large it overflows the buffer and makes us print past the end of buffer. Signed-off-by: Mark Wielaard --- src/ChangeLog | 5 + src/readelf.c | 4 +++- 2 files changed

[PATCH] libdw: Make __libdw_dieabbrev more robust on failure.

2018-06-13 Thread Mark Wielaard
Make sure to always set die->abbrev to DWARF_END_ABBREV on failure. DWARF_END_ABBREV is also what the function reports on failure. And it will prevent trying to lookup the abbrev ever again. Signed-off-by: Mark Wielaard --- libdw/ChangeLog | 5 + libdw/libdwP.h | 5 +++-- 2 files changed, 8

[PATCH] readelf: Make sure print_form_data always consumes DW_FORM_strx[1234] data.

2018-06-13 Thread Mark Wielaard
Found by afl-fuzz. When printing DW_FORM_strx[1234] data eu-readelf didn't increase readp which meant eu-readelf would keep printing the same line dirs or files encoded with strx[1234] names. This meant that for insane large dir or file counts eu-readelf would just keep printing endlessly because w

[PATCH] readelf: Check there are at least 4 bytes available for DWARF_FORM_block4.

2018-06-13 Thread Mark Wielaard
Found by afl-fuzz. When printing a DWARF_FORM_block4 we checked there were only 2 bytes available (copy/paste from DW_FORM_block2 right before). Obviously we need at least 4 bytes to read the length of a DW_FORM_block4. Signed-off-by: Mark Wielaard --- src/ChangeLog | 5 + src/readelf.c | 2