iovisor / iovisor/bcc

double free or corruption (!prev)

Open
#5,191 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
22.7k
Forks
4.1k
Avg merge
10d 4h
Merged PRs (30d)
3

Description

Hi, I'm hitting this issue with bcc's master branch.

```
double free or corruption (!prev)

Program received signal SIGABRT, Aborted.
0x00007ffff767f0f4 in __pthread_kill_implementation () from /lib64/libc.so
(gdb) bt
#0 0x00007ffff767f0f4 in __pthread_kill_implementation () from /lib64/libc.so.6
#1 0x00007ffff7625fde in raise () from /lib64/libc.so.6
#2 0x00007ffff760d942 in abort () from /lib64/libc.so.6
#3 0x00007ffff760e7a7 in __libc_message_impl.cold () from /lib64/libc.so.6
#4 0x00007ffff7689265 in malloc_printerr () from /lib64/libc.so.6
#5 0x00007ffff768b44c in _int_free_merge_chunk () from /lib64/libc.so.6
#6 0x00007ffff768dfce in free () from /lib64/libc.so.6
#7 0x00007fffd9bdf25e in std::__new_allocator::deallocate (this=0x555555845b98, __p=0x2b908d, __n=356881)
at /usr/bin/../lib/gcc/x86_64-redhat-linux/14/../../../../include/c++/14/bits/new_allocator.h:172
#8 std::allocator_traits >::deallocate (__a=..., __p=0x2b908d, __n=356881) at /usr/bin/../lib/gcc/x86_64-redhat-linux/14/../../../../include/c++/14/bits/alloc_traits.h:513
#9 std::_Vector_base >::_M_deallocate (this=0x555555845b98, __p=0x2b908d, __n=356881)
at /usr/bin/../lib/gcc/x86_64-redhat-linux/14/../../../../include/c++/14/bits/stl_vector.h:389
#10 std::_Vector_base >::~_Vector_base (this=0x555555845b98) at /usr/bin/../lib/gcc/x86_64-redhat-linux/14/../../../../include/c++/14/bits/stl_vector.h:368
#11 std::vector >::~vector (this=0x555555845b98) at /usr/bin/../lib/gcc/x86_64-redhat-linux/14/../../../../include/c++/14/bits/stl_vector.h:738
#12 llvm::TensorSpec::~TensorSpec (this=0x555555845b70) at /usr/src/debug/llvm-19.1.5-1.fc41.x86_64/llvm/include/llvm/Analysis/TensorSpec.h:62
#13 std::_Destroy (__pointer=0x555555845b70) at /usr/bin/../lib/gcc/x86_64-redhat-linux/14/../../../../include/c++/14/bits/stl_construct.h:151
#14 std::_Destroy_aux::__destroy (__first=0x555555845b70, __last=0x555555846700)
at /usr/bin/../lib/gcc/x86_64-redhat-linux/14/../../../../include/c++/14/bits/stl_construct.h:163
#15 std::_Destroy (__first=, __last=0x555555846700) at /usr/bin/../lib/gcc/x86_64-redhat-linux/14/../../../../include/c++/14/bits/stl_construct.h:195
#16 std::_Destroy (__first=, __last=0x555555846700) at /usr/bin/../lib/gcc/x86_64-redhat-linux/14/../../../../include/c++/14/bits/alloc_traits.h:944
#17 std::vector >::~vector (this=0x7fffe9297668 )
at /usr/bin/../lib/gcc/x86_64-redhat-linux/14/../../../../include/c++/14/bits/stl_vector.h:735
#18 0x00007ffff7628701 in __run_exit_handlers () from /lib64/libc.so.6
#19 0x00007ffff76287ce in exit () from /lib64/libc.so.6
#20 0x00007ffff7a66538 in Py_Exit () from /lib64/libpython3.13.so.1.0
#21 0x00007ffff7a58dc9 in ?? () from /lib64/libpython3.13.so.1.0
#22 0x00007ffff7a58c19 in ?? () from /lib64/libpython3.13.so.1.0
#23 0x00007ffff785db96 in ?? () from /lib64/libpython3.13.so.1.0
#24 0x00007ffff7a58661 in ?? () from /lib64/libpython3.13.so.1.0
#25 0x00007ffff7a50c58 in Py_RunMain () from /lib64/libpython3.13.so.1.0
#26 0x00007ffff7a0a8dc in Py_BytesMain () from /lib64/libpython3.13.so.1.0
#27 0x00007ffff760f248 in __libc_start_call_main () from /lib64/libc.so.6
#28 0x00007ffff760f30b in __libc_start_main_impl () from /lib64/libc.so.6
#29 0x0000555555555095 in _start ()
```

My setup is Fedora 41 with llvm.x86_64 19.1.5-1.fc41, python 3.13.1 and bcc master (fea5b15d745a50). Steps to reproduce:
1) Build bcc from source
2) Run any tool, it doesn't even need to actually insert any ebpf. Running without permissions also causes the error. E.g:
```
$ python ./tools/cpudist.py 1 1
could not open bpf map: dist, error: Operation not permitted
Traceback (most recent call last):
File "/home/amorenoz/src/bcc/./tools/cpudist.py", line 248, in
b = BPF(text=bpf_text, cflags=["-DMAX_PID=%d" % max_pid])
File "/usr/lib/python3.13/site-packages/bcc-0.32.0+fea5b15d-py3.13.egg/bcc/__init__.py", line 505, in __init__
raise Exception("Failed to compile BPF module %s" % (src_file or ""))
Exception: Failed to compile BPF module
double free or corruption (out)
Aborted (core dumped)
```

Not sure if this bug falls in bcc's side or llvm's but starting here as it's likely others will hit this issue.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.