Re: [PATCH bpf] libbpf: Fix segfault in light skeleton for objects without BTF

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

 



On 9/30/21 8:16 AM, Kumar Kartikeya Dwivedi wrote:
When fed an empty BPF object, bpftool gen skeleton -L crashes at
btf__set_fd since it assumes presence of obj->btf, however for the
sequence below clang adds no .BTF section (hence no BTF).

Reproducer:
$ touch a.bpf.c
$ clang -O2 -g -target bpf -c a.bpf.c
$ bpftool gen skeleton -L a.bpf.o
/* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */
/* THIS FILE IS AUTOGENERATED! */

struct a_bpf {
	struct bpf_loader_ctx ctx;
Segmentation fault (core dumped)

The same occurs for files compiled without BTF info, i.e. without
clang's -g flag.

Fixes: 67234743736a (libbpf: Generate loader program out of BPF ELF file.)
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx>

Looks like patchwork-bot is on vacation right now, this was applied thanks!



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux