[PATCH bpf-next v2 0/2] Fix unaligned enum values in btf_dump

Hungyu Lin posted 2 patches 1 week, 1 day ago
There is a newer version of this series
tools/lib/bpf/btf_dump.c                          | 13 ++++---------
tools/testing/selftests/bpf/prog_tests/btf_dump.c | 10 +++++++++-
2 files changed, 13 insertions(+), 10 deletions(-)
[PATCH bpf-next v2 0/2] Fix unaligned enum values in btf_dump
Posted by Hungyu Lin 1 week, 1 day ago
btf_dump_get_enum_value() reads unaligned enum values through
btf_dump_get_bitfield_value() with a zero bit size, which shifts a
__u64 by 64. Patch 1 copies unaligned enum data into an aligned buffer
instead, as btf_dump_int_data() does. Patch 2 adds the tests Alexei
posted in the v1 review.

Changes in v2:
- Describe the undefined shift in the commit log.
- Drop the data_end check, which broke the dump of struct fs_context
  without emit_zeroes.
- Add the selftests from the v1 review.

v1: https://lore.kernel.org/bpf/20261113223449.97604-1-dennylin0707@gmail.com/

Hungyu Lin (2):
  libbpf: Fix sign extension of unaligned enums in
    btf_dump_get_enum_value()
  selftests/bpf: Dump unaligned enums and a zeroed fs_context

 tools/lib/bpf/btf_dump.c                          | 13 ++++---------
 tools/testing/selftests/bpf/prog_tests/btf_dump.c | 10 +++++++++-
 2 files changed, 13 insertions(+), 10 deletions(-)


base-commit: 0021f17128de5dc0b19f1a523f448df2440d8088
-- 
2.43.0