mbox series

[bpf-next,v4,0/2] libbpf: Fix bpftool gen object segfault

Message ID tencent_44BC4B6295D557A6D10D444A032D219CAC07@qq.com (mailing list archive)
Headers show
Series libbpf: Fix bpftool gen object segfault | expand

Message

Rong Tao Dec. 6, 2024, 1:58 a.m. UTC
From: Rong Tao <rongtao@cestc.cn>

When the target file is used as input and output at the same time, the
input file will read a null value, resulting in a segmentation fault.

Add judgment conditions in bpftool and libbpf to prevent segmentation
error.

ChangeLog v2 -> v3:
  - argc_cpy and argv_cpy need to be initialised _after_ the call to
    GET_ARG()

ChangeLog v1 -> v2:
  - Compare each output file.

v4: This patchset, double check and fix in libbpf.
v3: https://lore.kernel.org/lkml/tencent_A7A870BF168D6A21BA193408D5645D5D920A@qq.com/
v2: https://lore.kernel.org/lkml/tencent_F62A51AFF6A38188D70664421F5934974008@qq.com/
v1: https://lore.kernel.org/lkml/tencent_410B8166C55CD2AB64BDEA8E92204619180A@qq.com/

Rong Tao (2):
  bpftool: Fix gen object segfault
  libbpf: linker: Avoid using object file as both input and output

 tools/bpf/bpftool/gen.c | 13 +++++++++++++
 tools/lib/bpf/linker.c  |  5 +++++
 2 files changed, 18 insertions(+)