[PATCH v2 pahole 0/7] Fix bitfield handling bugs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patchset eliminates all known discrepancies between DWARF/BTF, as
tested on typical and allyesconfig Linux kernels.

Patch #1 disables enum recoding, which can lose important enum size info.
Patch #2 enforces fix up of negative bitfield_offsets early on in btf_loader.
Patch #3 brings dwarf bitfield fixup logic closer to latest btf_encoder logic.
Patch #4 completely rewrites bit/byte hole detection logic, fixing a lot of
corners cases.
Patch #5 simplifies __class__fprintf logic by relying on data calculated during
hole detection phase.
Patch #6 records ELF/CU endianness in DWARF/BTF/CTF loaders.
Patch #7 changes semantics of bit offset for little-endian to be a natural
extension of byte offset, as opposed to de-facto DWARF representation (which
goes against DWARF standard recommendation).

Patch #4, when considered without patches #6-#7 emit lots of false warnings
for bit holes for big-endian binaries, due to the fact that it's impossible to
calculate correct bit_start and bit_end on both platforms uniformly without
knowing which one it is, as underlying DWARF output is non-uniform.

I tested little- and big-endian outputs on many small examples, as well as on
default and allyesconfig kernels. I don't know how to test CTF output, though.
I also never used dwarves_reorganize, so that part isn't tested well as well.
So I'd really appreciate some more independent testing to make sure nothing is
broken. Thanks!

v1->v2:
- Take note of ELF endianness;
- Recode little-endian bit offsets to follow DWARF recommendation, making big-
  and little-endian manipulations identical beyond tiny initial adjustment;
- Bit offset unification fixed big-endian hole logic automatically.

Andrii Nakryiko (7):
  dwarf_loader: don't recode enums and use real enum size in
    calculations
  btf_loader: adjust negative bitfield offsets early on
  dwarf_loader: fix bitfield fixup logic for DWARF
  dwarves: revamp bit/byte holes detection logic
  dwarves: use bit sizes and bit/byte hole info in __class__fprintf
  loaders: record CU's endianness in dwarf/btf/ctf loaders
  dwarf_loader: use DWARF recommended uniform bit offset scheme

 btf_encoder.c     |  29 ++--------
 btf_loader.c      |   9 +++-
 ctf_loader.c      |   1 +
 dwarf_loader.c    | 133 +++++++++++++++++++++++++++++++--------------
 dwarves.c         | 135 +++++++++++++++++++++++-----------------------
 dwarves.h         |   1 +
 dwarves_fprintf.c |  94 ++++++++++++--------------------
 7 files changed, 210 insertions(+), 192 deletions(-)

-- 
2.17.1




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux