Bug 2129127 - bpftrace segfaults
Summary: bpftrace segfaults
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: bpftrace
Version: 37
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Augusto Caringi
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-09-22 15:48 UTC by Kenneth Topp
Modified: 2022-10-04 00:18 UTC (History)
5 users (show)

Fixed In Version: bpftrace-0.16.0-3.fc37
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-10-04 00:18:00 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Kenneth Topp 2022-09-22 15:48:19 UTC
Description of problem:

bpftrace does not work at all.

Version-Release number of selected component (if applicable):
bpftrace-0.16.0-2.fc37.x86_64

How reproducible:
100% of the time.

Steps to Reproduce:
bpftrace -e $'BEGIN { printf("hello world\\n"); }'


Actual results:

segfault

Expected results:
prints hello 

Additional info:
bcc-tools are working fine.
tried building from upstream source,  same issue. 
here is a stack trace.

                Module libcrypt.so.2 with build-id 2ff5c2ba5f3a3af08f7f21e34e278fb830558ffd
                Stack trace of thread 15757:
                #0  0x0000555a1a590af7 _ZN8bpftrace3ast12IRBuilderBPF21CreateBpfPseudoCallIdEi (bpftrace + 0x19daf7)
                #1  0x0000555a1a591ba1 _ZN8bpftrace3ast12IRBuilderBPF21CreatePerfEventOutputEPN4llvm5ValueES4_mPKNS_8locationE (bpftrace + 0x19eba1)
                #2  0x0000555a1a58ef0d _ZN8bpftrace3ast11CodegenLLVM22createFormatStringCallERNS0_4CallERiRSt6vectorISt5tupleIJNS_12FormatStringES5_INS_5FieldESaIS8_EE>
                #3  0x0000555a1a57aa26 _ZN8bpftrace3ast11CodegenLLVM5visitERNS0_4CallE (bpftrace + 0x187a26)
                #4  0x0000555a1a586578 _ZN8bpftrace3ast11CodegenLLVM6acceptEPNS0_4NodeE (bpftrace + 0x193578)
                #5  0x0000555a1a57bd9b _ZN8bpftrace3ast11CodegenLLVM5visitERNS0_13ExprStatementE (bpftrace + 0x188d9b)
                #6  0x0000555a1a586578 _ZN8bpftrace3ast11CodegenLLVM6acceptEPNS0_4NodeE (bpftrace + 0x193578)
                #7  0x0000555a1a5805e3 _ZN8bpftrace3ast11CodegenLLVM13generateProbeERNS0_5ProbeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESB_PN4llvm12Funct>
                #8  0x0000555a1a5812cf _ZN8bpftrace3ast11CodegenLLVM5visitERNS0_5ProbeE (bpftrace + 0x18e2cf)
                #9  0x0000555a1a586578 _ZN8bpftrace3ast11CodegenLLVM6acceptEPNS0_4NodeE (bpftrace + 0x193578)
                #10 0x0000555a1a57be26 _ZN8bpftrace3ast11CodegenLLVM5visitERNS0_7ProgramE (bpftrace + 0x188e26)
                #11 0x0000555a1a586578 _ZN8bpftrace3ast11CodegenLLVM6acceptEPNS0_4NodeE (bpftrace + 0x193578)
                #12 0x0000555a1a49394c main (bpftrace + 0xa094c)
                #13 0x00007f764984b510 __libc_start_call_main (libc.so.6 + 0x23510)
                #14 0x00007f764984b5c9 __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x235c9)
                #15 0x0000555a1a4d83d5 _start (bpftrace + 0xe53d5)
                ELF object binary architecture: AMD x86-64

Comment 1 Kenneth Topp 2022-09-22 15:49:59 UTC
here is a gdb stack trace.

(gdb) bt
#0  0x0000555a1a590af7 in bpftrace::ast::IRBuilderBPF::createCall (Name=..., args=..., callee=0x555a1c6a8988, this=0x7ffe6e38ea28)
    at /usr/src/debug/bpftrace-0.16.0-2.fc37.x86_64/src/ast/irbuilderbpf.cpp:301
#1  bpftrace::ast::IRBuilderBPF::CreateBpfPseudoCallId (this=this@entry=0x7ffe6e38ea28, mapid=0)
    at /usr/src/debug/bpftrace-0.16.0-2.fc37.x86_64/src/ast/irbuilderbpf.cpp:310
#2  0x0000555a1a591ba1 in bpftrace::ast::IRBuilderBPF::CreatePerfEventOutput (this=0x7ffe6e38ea28, ctx=0x555a1c7f3af0, data=0x555a1bfe4770, size=8, loc=0x7f764008e648)
    at /usr/include/c++/12/optional:1007
#3  0x0000555a1a58ef0d in bpftrace::ast::CodegenLLVM::createFormatStringCall (this=<optimized out>, call=..., id=@0x7ffe6e38ebe0: 1, call_args=..., call_name=..., 
    async_action=<optimized out>) at /usr/src/debug/bpftrace-0.16.0-2.fc37.x86_64/src/ast/passes/codegen_llvm.cpp:3039
#4  0x0000555a1a57aa26 in bpftrace::ast::CodegenLLVM::visit (this=0x7ffe6e38ea00, call=...)
    at /usr/src/debug/bpftrace-0.16.0-2.fc37.x86_64/src/ast/passes/codegen_llvm.cpp:922
#5  0x0000555a1a586578 in bpftrace::ast::CodegenLLVM::accept (this=0x7ffe6e38ea00, node=0x7f764008e640)
    at /usr/src/debug/bpftrace-0.16.0-2.fc37.x86_64/src/ast/passes/codegen_llvm.cpp:3372
#6  0x0000555a1a57bd9b in bpftrace::ast::CodegenLLVM::visit (this=<optimized out>, expr=...)
    at /usr/src/debug/bpftrace-0.16.0-2.fc37.x86_64/src/ast/passes/codegen_llvm.cpp:1998
#7  0x0000555a1a586578 in bpftrace::ast::CodegenLLVM::accept (this=0x7ffe6e38ea00, node=0x7f76401b7b50)
    at /usr/src/debug/bpftrace-0.16.0-2.fc37.x86_64/src/ast/passes/codegen_llvm.cpp:3372
#8  0x0000555a1a5805e3 in bpftrace::ast::CodegenLLVM::generateProbe (this=<optimized out>, probe=..., full_func_id="BEGIN", section_name="BEGIN", 
    func_type=0x555a1c7f2320, expansion=<optimized out>, usdt_location_index=std::optional<int> [no contained value], dummy=false)
    at /usr/src/debug/bpftrace-0.16.0-2.fc37.x86_64/src/ast/passes/codegen_llvm.cpp:2333
#9  0x0000555a1a5812cf in bpftrace::ast::CodegenLLVM::visit (this=0x7ffe6e38ea00, probe=...)
    at /usr/src/debug/bpftrace-0.16.0-2.fc37.x86_64/src/ast/passes/codegen_llvm.cpp:2419
#10 0x0000555a1a586578 in bpftrace::ast::CodegenLLVM::accept (this=0x7ffe6e38ea00, node=0x7f76402352d0)
    at /usr/src/debug/bpftrace-0.16.0-2.fc37.x86_64/src/ast/passes/codegen_llvm.cpp:3372
#11 0x0000555a1a57be26 in bpftrace::ast::CodegenLLVM::visit (this=0x7ffe6e38ea00, program=...)
    at /usr/src/debug/bpftrace-0.16.0-2.fc37.x86_64/src/ast/passes/codegen_llvm.cpp:2552
#12 0x0000555a1a586578 in bpftrace::ast::CodegenLLVM::accept (this=0x7ffe6e38ea00, node=0x7f7640100510)
    at /usr/src/debug/bpftrace-0.16.0-2.fc37.x86_64/src/ast/passes/codegen_llvm.cpp:3372
#13 0x0000555a1a49394c in bpftrace::ast::CodegenLLVM::generate_ir (this=0x7ffe6e38ea00)
    at /usr/src/debug/bpftrace-0.16.0-2.fc37.x86_64/src/ast/passes/codegen_llvm.cpp:3206
#14 main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/bpftrace-0.16.0-2.fc37.x86_64/src/main.cpp:899

Comment 2 Augusto Caringi 2022-09-22 20:38:24 UTC
Hi Kenneth,

Thanks for you report, but since you are also facing the same problem building directly from upstream sources, I recommend you to open a ticket here:

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

Comment 3 Fedora Update System 2022-09-30 21:39:03 UTC
FEDORA-2022-3dde2fde93 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-3dde2fde93

Comment 4 Fedora Update System 2022-10-01 02:13:22 UTC
FEDORA-2022-3dde2fde93 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-2022-3dde2fde93`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-3dde2fde93

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

Comment 5 Fedora Update System 2022-10-04 00:18:00 UTC
FEDORA-2022-3dde2fde93 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.