Bug 2187412 - 'bpftrace -l' dumps core
Summary: 'bpftrace -l' dumps core
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: bpftrace
Version: 37
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Augusto Caringi
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-04-17 15:19 UTC by Chris Siebenmann
Modified: 2023-05-03 03:01 UTC (History)
5 users (show)

Fixed In Version: bpftrace-0.17.1-1.fc37
Clone Of:
Environment:
Last Closed: 2023-05-03 03:01:30 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Chris Siebenmann 2023-04-17 15:19:12 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0
Build Identifier: 

It also dumps core with 'bpftrace -l "*something*"' to supply a search pattern.

This is bpftrace-0.16.0-3.fc37.x86_64

A GDB stack trace with all debuginfos says:
Core was generated by `bpftrace -l'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  btf__type_cnt (btf=btf@entry=0x0) at btf.c:448
448             return btf->start_id + btf->nr_types;
(gdb) where
#0  btf__type_cnt (btf=btf@entry=0x0) at btf.c:448
#1  0x00007fc3934fc28a in btf_find_by_name_kind (btf=0x0, start_id=1, 
    type_name=0x7ffd5a48ddc0 "sched_fork", kind=12) at btf.c:721
#2  0x000056475819b565 in bpftrace::BTF::get_btf_id (this=0x564758b8dbb0, 
    name="sched_fork")
    at /usr/src/debug/bpftrace-0.16.0-3.fc37.x86_64/src/btf.cpp:754
#3  bpftrace::BPFfeature::try_load(libbpf::bpf_prog_type, bpf_insn*, unsigned long, char const*, std::optional<libbpf::bpf_attach_type>, int*) [clone .isra.0]
    (this=this@entry=0x564758b8db60, 
    prog_type=prog_type@entry=libbpf::BPF_PROG_TYPE_TRACING, 
    insns=insns@entry=0x7ffd5a48f020, len=len@entry=2, 
    name=name@entry=0x564758282543 "sched_fork", outfd=0x0, attach_type=...)
    at /usr/src/debug/bpftrace-0.16.0-3.fc37.x86_64/src/bpffeature.cpp:104
#4  0x00005647580d76f4 in bpftrace::BPFfeature::detect_prog_type (
    attach_type=..., name=0x564758282543 "sched_fork", 
    prog_type=libbpf::BPF_PROG_TYPE_TRACING, this=0x564758b8db60)
    at /usr/src/debug/bpftrace-0.16.0-3.fc37.x86_64/src/bpffeature.cpp:171
#5  bpftrace::BPFfeature::has_prog_kfunc (this=0x564758b8db60)
    at /usr/src/debug/bpftrace-0.16.0-3.fc37.x86_64/src/bpffeature.h:108
#6  bpftrace::BPFfeature::has_kfunc (this=0x564758b8db60)
    at /usr/src/debug/bpftrace-0.16.0-3.fc37.x86_64/src/bpffeature.cpp:590
#7  0x0000564758126ace in bpftrace::ProbeMatcher::kernel_probe_list (
    this=0x564758b8dc50)
    at /usr/src/debug/bpftrace-0.16.0-3.fc37.x86_64/src/probe_matcher.cpp:311
#8  bpftrace::ProbeMatcher::expand_probetype_kernel (probe_type="*", 
    this=0x564758b8dc50)
    at /usr/src/debug/bpftrace-0.16.0-3.fc37.x86_64/src/probe_matcher.cpp:532
#9  bpftrace::ast::AttachPointParser::parse_attachpoint (ap=..., 
    this=0x7ffd5a48f400)
    at /usr/src/debug/bpftrace-0.16.0-3.fc37.x86_64/src/ast/attachpoint_parser.cpp:146
#10 bpftrace::ast::AttachPointParser::parse (this=0x7ffd5a48f400)
    at /usr/src/debug/bpftrace-0.16.0-3.fc37.x86_64/src/ast/attachpoint_parser.cpp:68
#11 0x00005647580d444a in bpftrace::Driver::parse (this=0x7ffd5a48f8a0)
    at /usr/src/debug/bpftrace-0.16.0-3.fc37.x86_64/src/driver.cpp:54
#12 0x000056475806c30d in main (argc=<optimized out>, argv=<optimized out>)
    at /usr/src/debug/bpftrace-0.16.0-3.fc37.x86_64/src/main.cpp:774

bpftrace 0.17.0 has been released so maybe Fedora needs to update to that.

Reproducible: Always

Steps to Reproduce:
1. run "bpftrace -l"

Actual Results:  
Dumps core.

Expected Results:  
A list of available probes.

Comment 1 Augusto Caringi 2023-04-18 15:18:18 UTC
Hi Chris,

Thanks for reporting this issue...

(In reply to Chris Siebenmann from comment #0)
> bpftrace 0.17.0 has been released so maybe Fedora needs to update to that.

After some investigation we found out that bpftrace 0.17 is also affected by this problem (although it's already fixed in the master branch):

https://github.com/iovisor/bpftrace/issues/2567

Comment 2 Fedora Update System 2023-04-24 22:53:11 UTC
FEDORA-2023-3b4de9ab16 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2023-3b4de9ab16

Comment 3 Fedora Update System 2023-04-25 03:27:06 UTC
FEDORA-2023-3b4de9ab16 has been pushed to the Fedora 37 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-3b4de9ab16`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-3b4de9ab16

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 4 Fedora Update System 2023-05-03 03:01:30 UTC
FEDORA-2023-3b4de9ab16 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.