Subject: bpftrace/libbpf: SIGSEGV at btf_find_by_name_kind()

From: Breno Leitao <[email-masked]>
Date: Sun, 06 Nov 2022 10:01:09 +0000

Package: bpftrace
Version: 0.16.0-1
Severity: normal
X-Debbugs-Cc: [email-masked]

Dear Maintainer,

bpftrace is segfault on everycommand when running on 6.0 kernel:

	$ sudo gdb /usr/bin/bpftrace
	<snip>

	(gdb) r -l
	Starting program: /usr/bin/bpftrace -l
	[Thread debugging using libthread_db enabled]
	Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

	Program received signal SIGSEGV, Segmentation fault.
	btf__type_cnt (btf=btf@entry=0x0) at ./src/btf.c:448
	448	./src/btf.c: No such file or directory.
	(gdb) bt
	#0  btf__type_cnt (btf=btf@entry=0x0) at ./src/btf.c:448
	#1  0x00007ffff7f59f48 in btf_find_by_name_kind (btf=0x0, start_id=1, type_name=0x7fffffffb360 "sched_fork", kind=12) at ./src/btf.c:721
	#2  0x0000555555617b46 in ?? ()
	#3  0x000055555561821d in ?? ()
	#4  0x000055555565f57f in ?? ()
	#5  0x0000555555661941 in ?? ()
	#6  0x000055555569896f in ?? ()
	#7  0x0000555555699488 in ?? ()
	#8  0x0000555555604835 in ?? ()
	#9  0x000055555559d376 in ?? ()
	#10 0x00007fffef44618a in __libc_start_call_main (main=main@entry=0x55555559c010, argc=argc@entry=2, argv=argv@entry=0x7fffffffe538)
	    at ../sysdeps/nptl/libc_start_call_main.h:58
	#11 0x00007fffef446245 in __libc_start_main_impl (main=0x55555559c010, argc=2, argv=0x7fffffffe538, init=<optimized out>, fini=<optimized out>, 
	    rtld_fini=<optimized out>, stack_end=0x7fffffffe528) at ../csu/libc-start.c:381
	#12 0x00005555555ddd21 in ?? ()

-- System Information:
Debian Release: bookworm/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (100, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.0.0+ (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages bpftrace depends on:
ii  libbpf0       1:0.8.0-1
ii  libbpfcc      0.24.0+ds-1+b1
ii  libc6         2.36-4
ii  libclang1-14  1:14.0.6-3
ii  libdw1        0.187-4
ii  libgcc-s1     12.2.0-9
ii  libllvm14     1:14.0.6-3
ii  libstdc++6    12.2.0-9

bpftrace recommends no packages.

bpftrace suggests no packages.

-- no debconf information

---

From: Vincent Bernat <[email-masked]>
Date: Sun, 13 Nov 2022 12:55:20 +0100

> bpftrace is segfault on everycommand when running on 6.0 kernel:

It works for me. Can you try again with bpftrace 0.16.0-1+b1?