Skip to content

libbpf: fix fuzzer-reported issues

Shung-Hsi Yu bpf 2 versions – Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 0 repliesApplied 3/3
  2. v13 patches 6 repliesSuperseded

Changes in v2 from the cover letter

- Rebase to bpf-next
- Move elf_getshdrnum() closer to where it's result is used in patch #1, as suggested by Andrii
- Touch up the comment in bpf_object__elf_collect(), replacing mention of e_shnum with elf_getshdrnum()
- Minor wording change in commit message of patch #1 to for better readability
- Remove extra note that comes after commit message in patch #1

Patches in v2 All 3 applied

#Subject and filesSizeRepliesApplied
1/3libbpf: use elf_getshdrnum() instead of e_shnumtools/lib/bpf/libbpf.c+9 -40 repliesApplied
2/3libbpf: deal with section with no data gracefullytools/lib/bpf/libbpf.c+5 -10 repliesApplied
3/3libbpf: fix null-pointer dereference in find_prog_by_sec_insn()tools/lib/bpf/libbpf.c+3 -00 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH bpf-next v2 0/3] libbpf: fix fuzzer-reported issues

Hi, this patch set fixes several fuzzer-reported issues of libbpf when dealing with (malformed) BPF object file:

- patch #1 fix out-of-bound heap write reported by oss-fuzz (currently incorrectly marked as fixed)

- patch #2 and #3 fix null-pointer dereference found by locally-run fuzzer.

v2:
- Rebase to bpf-next
- Move elf_getshdrnum() closer to where it's result is used in patch #1, as suggested by Andrii
- Touch up the comment in bpf_object__elf_collect(), replacing mention of e_shnum with elf_getshdrnum()
- Minor wording change in commit message of patch #1 to for better readability
- Remove extra note that comes after commit message in patch #1

v1: https://lore.kernel.org/bpf/[email protected]/

Shung-Hsi Yu (3):
libbpf: use elf_getshdrnum() instead of e_shnum
libbpf: deal with section with no data gracefully
libbpf: fix null-pointer dereference in find_prog_by_sec_insn()

 tools/lib/bpf/libbpf.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

base-commit: 0326074ff4652329f2a1a9c8685104576bd8d131 --
2.37.3