Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging C++ Segmentation Fault in Leak Sanitizer - Need Help with Backtrace Analysis #1740

Open
UjjwalChitransh opened this issue Apr 3, 2024 · 0 comments

Comments

@UjjwalChitransh
Copy link

I have compiled my C++ application by passing fsanitize=leak option and linked liblsan.so.0 library. Before running the application, I have executed: LD_PRELOAD=/usr/lib64/liblsan.so.0
Also please note that I am calling this API - __lsan_do_recoverable_leak_check() only when a file is creted not otherwise to control the leak dump when a potential scenario is encountered.

I see the application upon start up gives a segmentation fault and dumps a core. On checking the backtrace, i can see the following trace. It will be helpful if community can answer on these errors since I don't see any hints to check in the application.

Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007f1cb16cb846 in __lsan::Deallocate(void*) () from /lib64/liblsan.so.0
[Current thread is 1 (Thread 0x7f1cb27865c0 (LWP 1061))]
Missing separate debuginfos, use: yum debuginfo-install bzip2-libs-1.0.6-26.el8.x86_64 elfutils-libelf-0.190-1.el8.x86_64 glibc-2.28-241.el8.x86_64 libatomic-8.5.0-21.el8.x86_64 libgcc-8.5.0-21.el8.x86_64 libhugetlbfs-2.21-17.el8.x86_64 liblsan-8.5.0-21.el8.x86_64 libstdc++-8.5.0-21.el8.x86_64 libzstd-1.4.4-1.el8.x86_64 lksctp-tools-1.0.18-3.el8.x86_64 numactl-libs-2.0.16-4.el8.x86_64 xz-libs-5.2.4-4.el8.x86_64 zlib-1.2.11-25.el8.x86_64
(gdb) bt
#0 0x00007f1cb16cb846 in __lsan::Deallocate(void*) () from /lib64/liblsan.so.0
#1 0x00007f1cb257eef9 in free (ptr=) at ../include/rtld-malloc.h:50
#2 _dl_update_slotinfo (req_modid=2, new_gen=2) at ../elf/dl-tls.c:822
#3 0x00007f1cb257efcc in update_get_addr (ti=0x7f1cb1911e08, gen=) at ../elf/dl-tls.c:916
#4 0x00007f1cb256ae9c in __tls_get_addr () at ../sysdeps/x86_64/tls_get_addr.S:55
#5 0x00007f1cb16c98b4 in __lsan::GetAllocatorCache() () from /lib64/liblsan.so.0
#6 0x00007f1cb257eef9 in free (ptr=) at ../include/rtld-malloc.h:50
#7 _dl_update_slotinfo (req_modid=2, new_gen=2) at ../elf/dl-tls.c:822
#8 0x00007f1cb257efcc in update_get_addr (ti=0x7f1cb1911e08, gen=) at ../elf/dl-tls.c:916
#9 0x00007f1cb256ae9c in __tls_get_addr () at ../sysdeps/x86_64/tls_get_addr.S:55
#10 0x00007f1cb16c98b4 in __lsan::GetAllocatorCache() () from /lib64/liblsan.so.0
#11 0x00007f1cb257eef9 in free (ptr=) at ../include/rtld-malloc.h:50
#12 _dl_update_slotinfo (req_modid=2, new_gen=2) at ../elf/dl-tls.c:822
#13 0x00007f1cb257efcc in update_get_addr (ti=0x7f1cb1911e08, gen=) at ../elf/dl-tls.c:916
#14 0x00007f1cb256ae9c in __tls_get_addr () at ../sysdeps/x86_64/tls_get_addr.S:55
#15 0x00007f1cb16c98b4 in __lsan::GetAllocatorCache() () from /lib64/liblsan.so.0
#16 0x00007f1cb257eef9 in free (ptr=) at ../include/rtld-malloc.h:50
#17 _dl_update_slotinfo (req_modid=2, new_gen=2) at ../elf/dl-tls.c:822
#18 0x00007f1cb257efcc in update_get_addr (ti=0x7f1cb1911e08, gen=) at ../elf/dl-tls.c:916
#19 0x00007f1cb256ae9c in __tls_get_addr () at ../sysdeps/x86_64/tls_get_addr.S:55
#20 0x00007f1cb16c98b4 in __lsan::GetAllocatorCache() () from /lib64/liblsan.so.0
#21 0x00007f1cb257eef9 in free (ptr=) at ../include/rtld-malloc.h:50
#22 _dl_update_slotinfo (req_modid=2, new_gen=2) at ../elf/dl-tls.c:822
#23 0x00007f1cb257efcc in update_get_addr (ti=0x7f1cb1911e08, gen=) at ../elf/dl-tls.c:916
#24 0x00007f1cb256ae9c in __tls_get_addr () at ../sysdeps/x86_64/tls_get_addr.S:55
#25 0x00007f1cb16c98b4 in __lsan::GetAllocatorCache() () from /lib64/liblsan.so.0
#26 0x00007f1cb257eef9 in free (ptr=) at ../include/rtld-malloc.h:50
#27 _dl_update_slotinfo (req_modid=2, new_gen=2) at ../elf/dl-tls.c:822
#28 0x00007f1cb257efcc in update_get_addr (ti=0x7f1cb1911e08, gen=) at ../elf/dl-tls.c:916
#29 0x00007f1cb256ae9c in __tls_get_addr () at ../sysdeps/x86_64/tls_get_addr.S:55
#30 0x00007f1cb16c98b4 in __lsan::GetAllocatorCache() () from /lib64/liblsan.so.0
#31 0x00007f1cb257eef9 in free (ptr=) at ../include/rtld-malloc.h:50
#32 _dl_update_slotinfo (req_modid=2, new_gen=2) at ../elf/dl-tls.c:822
#33 0x00007f1cb257efcc in update_get_addr (ti=0x7f1cb1911e08, gen=) at ../elf/dl-tls.c:916
#34 0x00007f1cb256ae9c in __tls_get_addr () at ../sysdeps/x86_64/tls_get_addr.S:55
#35 0x00007f1cb16c98b4 in __lsan::GetAllocatorCache() () from /lib64/liblsan.so.0
#36 0x00007f1cb257eef9 in free (ptr=) at ../include/rtld-malloc.h:50
--Type for more, q to quit, c to continue without paging--
#37 _dl_update_slotinfo (req_modid=2, new_gen=2) at ../elf/dl-tls.c:822
#38 0x00007f1cb257efcc in update_get_addr (ti=0x7f1cb1911e08, gen=) at ../elf/dl-tls.c:916
#39 0x00007f1cb256ae9c in __tls_get_addr () at ../sysdeps/x86_64/tls_get_addr.S:55
#40 0x00007f1cb16c98b4 in __lsan::GetAllocatorCache() () from /lib64/liblsan.so.0
#41 0x00007f1cb257eef9 in free (ptr=) at ../include/rtld-malloc.h:50
#42 _dl_update_slotinfo (req_modid=2, new_gen=2) at ../elf/dl-tls.c:822
#43 0x00007f1cb257efcc in update_get_addr (ti=0x7f1cb1911e08, gen=) at ../elf/dl-tls.c:916
#44 0x00007f1cb256ae9c in __tls_get_addr () at ../sysdeps/x86_64/tls_get_addr.S:55
#45 0x00007f1cb16c98b4 in __lsan::GetAllocatorCache() () from /lib64/liblsan.so.0
#46 0x00007f1cb257eef9 in free (ptr=) at ../include/rtld-malloc.h:50
#47 _dl_update_slotinfo (req_modid=2, new_gen=2) at ../elf/dl-tls.c:822
#48 0x00007f1cb257efcc in update_get_addr (ti=0x7f1cb1911e08, gen=) at ../elf/dl-tls.c:916
#49 0x00007f1cb256ae9c in __tls_get_addr () at ../sysdeps/x86_64/tls_get_addr.S:55
#50 0x00007f1cb16c98b4 in __lsan::GetAllocatorCache() () from /lib64/liblsan.so.0
#51 0x00007f1cb257eef9 in free (ptr=) at ../include/rtld-malloc.h:50
#52 _dl_update_slotinfo (req_modid=2, new_gen=2) at ../elf/dl-tls.c:822
#53 0x00007f1cb257efcc in update_get_addr (ti=0x7f1cb1911e08, gen=) at ../elf/dl-tls.c:916
#54 0x00007f1cb256ae9c in __tls_get_addr () at ../sysdeps/x86_64/tls_get_addr.S:55
#55 0x00007f1cb16c98b4 in __lsan::GetAllocatorCache() () from /lib64/liblsan.so.0
#56 0x00007f1cb257eef9 in free (ptr=) at ../include/rtld-malloc.h:50
#57 _dl_update_slotinfo (req_modid=2, new_gen=2) at ../elf/dl-tls.c:822
#58 0x00007f1cb257efcc in update_get_addr (ti=0x7f1cb1911e08, gen=) at ../elf/dl-tls.c:916
#59 0x00007f1cb256ae9c in __tls_get_addr () at ../sysdeps/x86_64/tls_get_addr.S:55
#60 0x00007f1cb16c98b4 in __lsan::GetAllocatorCache() () from /lib64/liblsan.so.0
#61 0x00007f1cb257eef9 in free (ptr=) at ../include/rtld-malloc.h:50
#62 _dl_update_slotinfo (req_modid=2, new_gen=2) at ../elf/dl-tls.c:822
#63 0x00007f1cb257efcc in update_get_addr (ti=0x7f1cb1911e08, gen=) at ../elf/dl-tls.c:916
#64 0x00007f1cb256ae9c in __tls_get_addr () at ../sysdeps/x86_64/tls_get_addr.S:55
#65 0x00007f1cb16c98b4 in __lsan::GetAllocatorCache() () from /lib64/liblsan.so.0
#66 0x00007f1cb257eef9 in free (ptr=) at ../include/rtld-malloc.h:50
#67 _dl_update_slotinfo (req_modid=2, new_gen=2) at ../elf/dl-tls.c:822
#68 0x00007f1cb257efcc in update_get_addr (ti=0x7f1cb1911e08, gen=) at ../elf/dl-tls.c:916
#69 0x00007f1cb256ae9c in __tls_get_addr () at ../sysdeps/x86_64/tls_get_addr.S:55
#70 0x00007f1cb16c98b4 in __lsan::GetAllocatorCache() () from /lib64/liblsan.so.0
#71 0x00007f1cb257eef9 in free (ptr=) at ../include/rtld-malloc.h:50
#72 _dl_update_slotinfo (req_modid=2, new_gen=2) at ../elf/dl-tls.c:822
#73 0x00007f1cb257efcc in update_get_addr (ti=0x7f1cb1911e08, gen=) at ../elf/dl-tls.c:916
--Type for more, q to quit, c to continue without paging--
#74 0x00007f1cb256ae9c in __tls_get_addr () at ../sysdeps/x86_64/tls_get_addr.S:55
#75 0x00007f1cb16c98b4 in __lsan::GetAllocatorCache() () from /lib64/liblsan.so.0
#76 0x00007f1cb257eef9 in free (ptr=) at ../include/rtld-malloc.h:50
#77 _dl_update_slotinfo (req_modid=2, new_gen=2) at ../elf/dl-tls.c:822
#78 0x00007f1cb257efcc in update_get_addr (ti=0x7f1cb1911e08, gen=) at ../elf/dl-tls.c:916
#79 0x00007f1cb256ae9c in __tls_get_addr () at ../sysdeps/x86_64/tls_get_addr.S:55
#80 0x00007f1cb16c98b4 in __lsan::GetAllocatorCache() () from /lib64/liblsan.so.0
#81 0x00007f1cb257eef9 in free (ptr=) at ../include/rtld-malloc.h:50
#82 _dl_update_slotinfo (req_modid=2, new_gen=2) at ../elf/dl-tls.c:822
#83 0x00007f1cb257efcc in update_get_addr (ti=0x7f1cb1911e08, gen=) at ../elf/dl-tls.c:916
#84 0x00007f1cb256ae9c in __tls_get_addr () at ../sysdeps/x86_64/tls_get_addr.S:55
#85 0x00007f1cb16c98b4 in __lsan::GetAllocatorCache() () from /lib64/liblsan.so.0
#86 0x00007f1cb257eef9 in free (ptr=) at ../include/rtld-malloc.h:50
#87 _dl_update_slotinfo (req_modid=2, new_gen=2) at ../elf/dl-tls.c:822
#88 0x00007f1cb257efcc in update_get_addr (ti=0x7f1cb1911e08, gen=) at ../elf/dl-tls.c:916
#89 0x00007f1cb256ae9c in __tls_get_addr () at ../sysdeps/x86_64/tls_get_addr.S:55
#90 0x00007f1cb16c98b4 in __lsan::GetAllocatorCache() () from /lib64/liblsan.so.0
#91 0x00007f1cb257eef9 in free (ptr=) at ../include/rtld-malloc.h:50
#92 _dl_update_slotinfo (req_modid=2, new_gen=2) at ../elf/dl-tls.c:822
#93 0x00007f1cb257efcc in update_get_addr (ti=0x7f1cb1911e08, gen=) at ../elf/dl-tls.c:916
#94 0x00007f1cb256ae9c in __tls_get_addr () at ../sysdeps/x86_64/tls_get_addr.S:55
#95 0x00007f1cb16c98b4 in __lsan::GetAllocatorCache() () from /lib64/liblsan.so.0
#96 0x00007f1cb257eef9 in free (ptr=) at ../include/rtld-malloc.h:50
#97 _dl_update_slotinfo (req_modid=2, new_gen=2) at ../elf/dl-tls.c:822
#98 0x00007f1cb257efcc in update_get_addr (ti=0x7f1cb1911e08, gen=) at ../elf/dl-tls.c:916
#99 0x00007f1cb256ae9c in __tls_get_addr () at ../sysdeps/x86_64/tls_get_addr.S:55
#100 0x00007f1cb16c98b4 in __lsan::GetAllocatorCache() () from /lib64/liblsan.so.0

....

#18441 0x00007f1cb257eef9 in free (ptr=) at ../include/rtld-malloc.h:50
#18442 _dl_update_slotinfo (req_modid=2, new_gen=2) at ../elf/dl-tls.c:822
#18443 0x00007f1cb257efcc in update_get_addr (ti=0x7f1cb1911e08, gen=) at ../elf/dl-tls.c:916
#18444 0x00007f1cb256ae9c in __tls_get_addr () at ../sysdeps/x86_64/tls_get_addr.S:55
#18445 0x00007f1cb16c98b4 in __lsan::GetAllocatorCache() () from /lib64/liblsan.so.0
#18446 0x00007f1cb257eef9 in free (ptr=) at ../include/rtld-malloc.h:50
#18447 _dl_update_slotinfo (req_modid=2, new_gen=2) at ../elf/dl-tls.c:822
#18448 0x00007f1cb257efcc in update_get_addr (ti=0x7f1cb1911e08, gen=) at ../elf/dl-tls.c:916
#18449 0x00007f1cb256ae9c in __tls_get_addr () at ../sysdeps/x86_64/tls_get_addr.S:55
#18450 0x00007f1cb16c9874 in __lsan::GetCurrentThread() () from /lib64/liblsan.so.0
#18451 0x00007f1cb16c9495 in LsanOnDeadlySignal(int, void*, void*) () from /lib64/liblsan.so.0

#18452 0x00007f1cad9252fd in ?? ()
#18453 0x0000000000000000 in ?? ()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant