Your message dated Sun, 03 Aug 2025 16:41:09 -0400
with message-id <[email protected]>
and subject line Re: Bug#1022063: gdb crashes target program if any breakpoint 
was set at a shared library function before it was first used
has caused the Debian Bug report #1022063,
regarding gdb crashes target program if any breakpoint was set at a shared 
library function before it was first used
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
1022063: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1022063
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: gdb
Version: 12.1-4
Severity: important
X-Debbugs-Cc: [email protected]


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

--- End Message ---
--- Begin Message ---
On Wednesday, October 19 2022, WHR wrote:

> 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.

Thanks for reporting the bug and apologies for taking so long to reply.

I can't reproduce this problem with GDB 16.1.  I'll close this bug; feel
free to reopen if it's still applicable.

Thanks,

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
https://sergiodj.net/

Attachment: signature.asc
Description: PGP signature


--- End Message ---

Reply via email to