Package: gdb Version: 12.1-4 Severity: important X-Debbugs-Cc: msl0000023...@gmail.com
Hello. When trying to test whether bug 1022056 affects architecture ppc64 (big endian), I discovered a more serious issue; when I set a breakpoint for a shared library function which have not yet being referenced by the target program, for example when setting breakpoint before running the program, the target program would crash as soon as it calls the shared library function. For example: whr@debian:~/src$ gdb rval-test GNU gdb (Debian 12.1-4) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "powerpc64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from rval-test... (gdb) b geteuid Breakpoint 1 at 0xaa4 (gdb) r Starting program: /home/whr/src/rval-test [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/powerpc64-linux-gnu/libthread_db.so.1". Program received signal SIGSEGV, Segmentation fault. 0x7fe00008b7e1a3a8 in ?? () (gdb) bt #0 0x7fe00008b7e1a3a8 in ?? () #1 0x0000000020000a0c in main () at rval-test.c:6 (gdb) c Continuing. Program terminated with signal SIGSEGV, Segmentation fault. The program no longer exists. The workaround is to control the target program to call the shared library function by itself first, before trying to set breakpoint for that function; unfortunately this helps only in some situations. With this workaround, I can confirm that the bug 1022056 is indeed affecting ppc64 too: whr@debian:~/src$ gdb rval-test GNU gdb (Debian 12.1-4) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "powerpc64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <https://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from rval-test... (gdb) b main Breakpoint 1 at 0xa08: file rval-test.c, line 6. (gdb) r Starting program: /home/whr/src/rval-test [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/powerpc64-linux-gnu/libthread_db.so.1". Breakpoint 1, main () at rval-test.c:6 6 printf("geteuid returned %u\n", (unsigned int)geteuid()); (gdb) n geteuid returned 1000 7 sleep(1); (gdb) b geteuid Breakpoint 2 at 0x3fffb7e1a3a8: geteuid. (2 locations) (gdb) c Continuing. Breakpoint 1, main () at rval-test.c:6 6 printf("geteuid returned %u\n", (unsigned int)geteuid()); (gdb) Continuing. Breakpoint 2, .LY__geteuid () at ../sysdeps/unix/syscall-template.S:91 91 ../sysdeps/unix/syscall-template.S: 沒有此一檔案或目錄. (gdb) return 111111 Make .LY__geteuid return now? (y or n) y #0 0x0000000020000a0c in main () at rval-test.c:6 6 printf("geteuid returned %u\n", (unsigned int)geteuid()); (gdb) c Continuing. geteuid returned 0 Breakpoint 1, main () at rval-test.c:6 6 printf("geteuid returned %u\n", (unsigned int)geteuid()); (gdb) delete 1 (gdb) c Continuing. Breakpoint 2, .LY__geteuid () at ../sysdeps/unix/syscall-template.S:91 91 ../sysdeps/unix/syscall-template.S: 沒有此一檔案或目錄. (gdb) return (uint32_t)111111 Make .LY__geteuid return now? (y or n) y #0 0x0000000020000a0c in main () at rval-test.c:6 6 printf("geteuid returned %u\n", (unsigned int)geteuid()); (gdb) c Continuing. geteuid returned 0 Breakpoint 2, .LY__geteuid () at ../sysdeps/unix/syscall-template.S:91 91 ../sysdeps/unix/syscall-template.S: 沒有此一檔案或目錄. (gdb) p $r3 $1 = 0 (gdb) p $r3 = (uint32_t)111111 $2 = 111111 (gdb) return Make .LY__geteuid return now? (y or n) y #0 0x0000000020000a0c in main () at rval-test.c:6 6 printf("geteuid returned %u\n", (unsigned int)geteuid()); (gdb) c Continuing. geteuid returned 111111 ... -- System Information: Debian Release: bookworm/sid APT prefers unstable APT policy: (500, 'unstable') merged-usr: no Architecture: ppc64 Foreign Architectures: powerpc Kernel: Linux 4.1.42-rivoreo-powerpc64-largepage (SMP w/4 CPU threads) Locale: LANG=zh_TW.UTF-8, LC_CTYPE=zh_TW.UTF-8 (charmap=UTF-8), LANGUAGE=zh_TW:zh_CN:zh:en_GB:en Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages gdb depends on: ii libbabeltrace1 1.5.8-2+b1 ii libc6 2.35-3 ii libdebuginfod1 0.187-1 ii libexpat1 2.2.5-3 ii libgcc-s1 11.2.0-12 ii libgmp10 2:6.2.1+dfsg1-1.1 ii liblzma5 5.2.2-1.3 ii libmpfr6 4.1.0-3 ii libncursesw6 6.3+20220423-2 ii libpython3.10 3.10.7-2 ii libreadline8 8.1-2 ii libsource-highlight4v5 3.1.9-4.1+b1 ii libstdc++6 12.1.0-4 ii libtinfo6 6.3+20220423-2 ii libxxhash0 0.8.0-2 ii zlib1g 1:1.2.11.dfsg-2 Versions of packages gdb recommends: ii libc6-dbg [libc-dbg] 2.35-3 Versions of packages gdb suggests: pn gdb-doc <none> pn gdbserver <none> -- no debconf information