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

Rong Tao posted 2 patches 1 year ago
Only 0 patches received!
tools/bpf/bpftool/gen.c | 13 +++++++++++++
tools/lib/bpf/linker.c  |  5 +++++
2 files changed, 18 insertions(+)
[PATCH bpf-next v4 0/2] libbpf: Fix bpftool gen object segfault
Posted by Rong Tao 1 year ago
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(+)

-- 
2.47.1