[Bug 1192982] ltrace fails in assertion
https://bugzilla.suse.com/show_bug.cgi?id=1192982 https://bugzilla.suse.com/show_bug.cgi?id=1192982#c1 Uli Laube <ulsd+tumbleweed@uber.space> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ulsd+tumbleweed@uber.space --- Comment #1 from Uli Laube <ulsd+tumbleweed@uber.space> --- I ran into this error message a couple of times now and did some digging. Here is what I found so far. I am on openSUSE Tumbleweed 20241129 with ltrace-0.7.91+git20230705.8eabf68 installed. I am dabbling in some programming tasks of my own and tried to used ltrace to find a bug in my own software. While doing so I got to see malloc(ltrace: type.c:100: type_struct_add: Assertion `field_info->type != ARGTYPE_VOID' failed. [1] 17111 IOT instruction (core dumped) ltrace ./test more than I liked. I started to experiment a little, first with C: #include <stdlib.h> #include <stdio.h> int main() { void* ptr = malloc(100); printf("Hello World!\n"); free(ptr); return 0; } $ gcc -o test -O0 test.c $ ltrace ./test I get the expected output: malloc(100) = 0x1c83e2a0 puts("Hello World!") = 13 free(0x1c83e2a0) = <void> +++ exited (status 0) +++ Doing the same with debug information turned on $ gcc -o test -O0 -g test.c $ ltrace ./test Same result, it works as expected. Switching to C++: #include <cstdlib> #include <print> int main() { void* ptr = malloc(100); std::println("Hello World!"); free(ptr); return 0; } $ g++ -o test -std=c++23 -O0 test.cpp $ ltrace ./test produces the expected result: malloc(100) = 0x2bc872b0 memchr("Hello World!", '{',12) = nil memchr("Hello World!", '}', 12) = nil memcpy(0x7ffcbea03640, "Hello World!", 12) = 0x7ffcbea03640 memcpy(0x7ffcbea03750, "Hello World!", 12) = 0x7ffcbea03750 memcpy(0x7ffcbea03840, "Hello World!\0", 13) = 0x7ffcbea03840 memchr("{}\n", '{', 3) = 0x41a15a memchr("{}\n", '}', 3) = 0x41a15b memcpy(0x7ffcbea035c0, "Hello World!", 12) = 0x7ffcbea035c0 memchr("\n", '{', 1) = nil memchr("\n", '}', 1) = nil memcpy(0x7ffcbea035cc, "\n", 1) = 0x7ffcbea035cc fwrite("Hello World!\n", 1, 13, 0x7fc1a61fd5c0) = 13 free(0x2bc872b0) = <void> +++ exited (status 0) +++ But turning on debug information: $ g++ -o test -std=c++23 -O0 -g test.cpp $ ltrace ./test reproduces the error: malloc(ltrace: type.c:100: type_struct_add: Assertion `field_info->type != ARGTYPE_VOID' failed. [1] 8307 IOT instruction (core dumped) ltrace ./test That is what I was experiencing while searing for bugs in my own programs. They are written in C++ and I was on a build with debug settings. Then ltrace fails in the same way. Release builds of my programs where fine as show above with the test programs. I switched compilers from g++ 14.2.1 to clang++ 19.1.4 but the problem remains. However, grabbing the upstream sources (https://gitlab.com/cespedes/ltrace.git) and compiling ltrace 0.7.91 on my machine does NOT reproduce the problem. I get the expected output: malloc(100, 0x7ffd63d18868, 0x7ffd63d18878, 0x563399116bd8) = 0x5633d167e2b0 memchr(0x56339910d4a8, 123, 12, 12) = 0 memchr(0x56339910d4a8, 125, 12, 12) = 0 memcpy(0x7ffd63d183f0, 0x56339910d4a8, 12, 0x7ffd63d17d78) = 0x7ffd63d183f0 memcpy(0x7ffd63d18500, 0x7ffd63d183f0, 12, 15) = 0x7ffd63d18500 memcpy(0x7ffd63d186b8, 0x7ffd63d18500, 13, 0x7ffd63d18500) = 0x7ffd63d186b8 memchr(0x56339910d4b5, 123, 3, 3) = 0x56339910d4b5 memchr(0x56339910d4b5, 125, 3, 3) = 0x56339910d4b6 memcpy(0x7ffd63d18340, 0x7ffd63d186b8, 12, 0x7ffd63d17a68) = 0x7ffd63d18340 memchr(0x56339910d4b7, 123, 1, 1) = 0 memchr(0x56339910d4b7, 125, 1, 1) = 0 memcpy(0x7ffd63d1834c, 0x56339910d4b7, 1, 0x7ffd63d17c98) = 0x7ffd63d1834c fwrite(0x7ffd63d18340, 1, 13, 0x7f27317fd5c0) = 13 free(0x5633d167e2b0, 0x5633d167e320, 0, 0x7ffd63d186b8) = 5 +++ exited (status 0) +++ I then grabbed the source rpm ltrace-0.7.91+git20230705.8eabf68-2.2.src.rpm from download.opensuse.org-oss, rebuild it locally, installed it and this too fails as before. Interestingly the testsuite fails in many places: Running target unix Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target. Using /usr/share/dejagnu/config/unix.exp as generic interface file for target. Using /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/config/unix.exp as tool-and-target-specific interface file. Running /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/XDG_CONFIG_DIRS.exp ... Running /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/branch_func.exp ... Running /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.exp ... FAIL: dwarf->treetest({ 1, { 2, nil, nil }, { 3, nil, { 4, nil, nil } } } <unfinished ...> in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: libdwarftest.so->treetest({ 2, nil, nil }) * = nil in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: libdwarftest.so->treetest({ 3, nil, { 4, nil, nil } } <unfinished ...> in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: libdwarftest.so->treetest({ 4, nil, nil }) * = nil in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: <... treetest resumed> ) * = { 5, nil, nil } in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: <... treetest resumed> ) * = { 2, { 3, nil, nil }, { 4, nil, { 5, nil, nil } } } in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: libdwarftest.so->treetest({ 2, nil, nil }) * = nil in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: libdwarftest.so->treetest({ 3, nil, { 4, nil, nil } } <unfinished ...> in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: libdwarftest.so->treetest({ 4, nil, nil }) * = nil in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: <... treetest resumed> ) * = { 5, nil, nil } in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: test case execution failed exec env LD_LIBRARY_PATH=$LD_LIBRARY_PATH_ {*}$LTRACE {*}$LTRACE_OPTIONS $BIN {*}$LTRACE_ARGSltrace: type.c:100: type_struct_add: Assertion `field_info->type != ARGTYPE_VOID' failed. while executing "exec env LD_LIBRARY_PATH=$LD_LIBRARY_PATH_ {*}$LTRACE {*}$LTRACE_OPTIONS $BIN {*}$LTRACE_ARGS" invoked from within "catch $command output"FAIL: in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: libdwarftest.so->ftell(0x[0-9a-z]*) * = -1 in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: libdwarftest.so->strlen('t') * = 4 in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: dwarf->usleep(33) * = 0 in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: dwarf->nanosleep({ 0, 44 }, nil) * = 0 in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: test case execution failed exec env LD_LIBRARY_PATH=$LD_LIBRARY_PATH_ {*}$LTRACE {*}$LTRACE_OPTIONS $BIN {*}$LTRACE_ARGSltrace: type.c:100: type_struct_add: Assertion `field_info->type != ARGTYPE_VOID' failed. while executing "exec env LD_LIBRARY_PATH=$LD_LIBRARY_PATH_ {*}$LTRACE {*}$LTRACE_OPTIONS $BIN {*}$LTRACE_ARGS" invoked from within "catch $command output"FAIL: in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: ftell@libc.so.6(0x[0-9a-z]* in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: strlen@libc.so.6('t') * = 4 in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: usleep@libc.so.6(33 <unfinished ...> in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: nanosleep@libc.so.6({ 0, 33000 }, nil) * = 0 in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: <... usleep resumed> ) * = 0 in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: nanosleep@libc.so.6({ 0, 44 }, nil) * = 0 in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 FAIL: in /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/dwarf.ltrace for 0 times, should be 1 Running /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/filters.exp ... FAIL: test case execution failed exec env LD_LIBRARY_PATH=/usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/../ltrace -o /tmp/lt-RYMO2ZC8Cd.ltrace -e* /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/filtltrace: type.c:100: type_struct_add: Assertion `field_info->type != ARGTYPE_VOID' failed. while executing "exec env LD_LIBRARY_PATH=/usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main /usr/src/packages/BUILD/ltrace-0.7.91+git2023..." ("eval" body line 1) invoked from within "eval $command"FAIL: filt(\.pie)?->func1 appears in /tmp/lt-RYMO2ZC8Cd.ltrace 0 times, expected == 1 FAIL: libfilt1.so->func2 appears in /tmp/lt-RYMO2ZC8Cd.ltrace 0 times, expected == 1 FAIL: libfilt2.so->puts appears in /tmp/lt-RYMO2ZC8Cd.ltrace 0 times, expected == 1 FAIL: func2 resumed appears in /tmp/lt-RYMO2ZC8Cd.ltrace 0 times, expected == 1 FAIL: func1 resumed appears in /tmp/lt-RYMO2ZC8Cd.ltrace 0 times, expected == 1 FAIL: test case execution failed exec env LD_LIBRARY_PATH=/usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/../ltrace -o /tmp/lt-bU8KwolCaw.ltrace -e* /usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main/filt.pieltrace: type.c:100: type_struct_add: Assertion `field_info->type != ARGTYPE_VOID' failed. while executing "exec env LD_LIBRARY_PATH=/usr/src/packages/BUILD/ltrace-0.7.91+git20230705.8eabf68/testsuite/ltrace.main /usr/src/packages/BUILD/ltrace-0.7.91+git2023..." ("eval" body line 1) invoked from within "eval $command"FAIL: filt(\.pie)?->func1 appears in /tmp/lt-bU8KwolCaw.ltrace 0 times, expected == 1 FAIL: libfilt1.so->func2 appears in /tmp/lt-bU8KwolCaw.ltrace 0 times, expected == 1 FAIL: libfilt2.so->puts appears in /tmp/lt-bU8KwolCaw.ltrace 0 times, expected == 1 FAIL: func2 resumed appears in /tmp/lt-bU8KwolCaw.ltrace 0 times, expected == 1 FAIL: func1 resumed appears in /tmp/lt-bU8KwolCaw.ltrace 0 times, expected == 1 The testsuite fails with the exact assertion too. Running make check on the upstream repo has the testsuite failing as well but without the assertion showing up. /usr/src/packages/SPECS/ltrace.spec has the patches that are applied on top of the tarball. Commenting them out #Patch3: ppc-ptrace.patch #Patch5: gcc9-printf-s-null-argument.patch #Patch6: lens-double-free.patch #Patch7: gcc9-Wlto-type-mismatch.patch #Patch8: s390x-ptrace.patch #Patch9: ppc64le-use-after-free.patch rebuilding $ sudo rpmbuild -bb /usr/src/packages/SPECS/ltrace.spec reinstalling $ sudo zypper install /usr/src/packages/x86_64/ltrace-0.7.91+git20230705.8eabf68-2.2.x86_64.rpm does not make a difference, ltrace still fails. Unpacking the tarball ltrace-0.7.91+git20230705.8eabf68.tar.bz2 and comparing $ diff -qr ~/repos/ltrace /usr/src/packges/SOURCE/ltrace-0.7.91+git20230705.8eabf68 confusingly shows no difference in the source files besides what ./autogen.sh created: Only in /home/laube/repos/ltrace: aclocal.m4 Only in /home/laube/repos/ltrace: autom4te.cache Only in /home/laube/repos/ltrace: BUILD Only in /home/laube/repos/ltrace: config Only in /home/laube/repos/ltrace: config.h.in Only in /home/laube/repos/ltrace: configure Common subdirectories: ltrace-0.7.91+git20230705.8eabf68/etc and /home/laube/repos/ltrace/etc Only in /home/laube/repos/ltrace: .git Only in /home/laube/repos/ltrace: Makefile.in Common subdirectories: ltrace-0.7.91+git20230705.8eabf68/sysdeps and /home/laube/repos/ltrace/sysdeps Common subdirectories: ltrace-0.7.91+git20230705.8eabf68/testsuite and /home/laube/repos/ltrace/testsuite I am out of ideas. I tried the test programs from above on a fresh AlmaLinux9.5 VM and the assertion is not triggered at all. Any suggestions what to try next? -- You are receiving this mail because: You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@suse.com