public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/26635] New: i386_analyze_prologue doesn't skip endbr32
@ 2020-09-18 23:52 hjl.tools at gmail dot com
  2020-09-18 23:52 ` [Bug gdb/26635] " hjl.tools at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2020-09-18 23:52 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26635

            Bug ID: 26635
           Summary: i386_analyze_prologue doesn't skip endbr32
           Product: gdb
           Version: unknown
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

[hjl@gnu-cfl-2 gdb]$ cat /tmp/x.c
int
main(void)
{
  return 0;
}
[hjl@gnu-cfl-2 gdb]$ gcc -g -fcf-protection /tmp/x.c -m32
[hjl@gnu-cfl-2 gdb]$ ./gdb ./a.out 
Exception caught while booting Guile.
Error in function "open-file":
No such file or directory: "/usr/local/share/gdb/guile/gdb/boot.scm"
./gdb: warning: Could not complete Guile gdb module initialization from:
/usr/local/share/gdb/guile/gdb/boot.scm.
Limited Guile support is available.
Suggest passing --data-directory=/path/to/gdb/data-directory.
Python Exception <class 'ModuleNotFoundError'> No module named 'gdb': 
./gdb: warning: 
Could not load the Python gdb module from `/usr/local/share/gdb/python'.
Limited Python support is available from the _gdb module.
Suggest passing --data-directory=/path/to/gdb/data-directory.
GNU gdb (GDB) 11.0.50.20200918-git
Copyright (C) 2020 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 "x86_64-pc-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 ./a.out...
(gdb) b main
Breakpoint 1 at 0x8049176: file /tmp/x.c, line 3.
(gdb) r
Starting program:
/export/build/gnu/tools-build/gdb-gitlab/build-x86_64-linux/gdb/a.out 

Python Exception <class 'NameError'> Installation error: gdb._execute_unwinders
function is missing: 
Breakpoint 1, main () at /tmp/x.c:3
3       {
(gdb) disass
Dump of assembler code for function main:
=> 0x08049176 <+0>:     endbr32  <<<<<<<<<<<<  i386_analyze_prologue doesn't
skip endbr32.
   0x0804917a <+4>:     push   %ebp
   0x0804917b <+5>:     mov    %esp,%ebp
   0x0804917d <+7>:     mov    $0x0,%eax
   0x08049182 <+12>:    pop    %ebp
   0x08049183 <+13>:    ret    
End of assembler dump.
(gdb)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug gdb/26635] i386_analyze_prologue doesn't skip endbr32
  2020-09-18 23:52 [Bug gdb/26635] New: i386_analyze_prologue doesn't skip endbr32 hjl.tools at gmail dot com
@ 2020-09-18 23:52 ` hjl.tools at gmail dot com
  2020-09-19  0:56 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2020-09-18 23:52 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26635

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |HEAD

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug gdb/26635] i386_analyze_prologue doesn't skip endbr32
  2020-09-18 23:52 [Bug gdb/26635] New: i386_analyze_prologue doesn't skip endbr32 hjl.tools at gmail dot com
  2020-09-18 23:52 ` [Bug gdb/26635] " hjl.tools at gmail dot com
@ 2020-09-19  0:56 ` cvs-commit at gcc dot gnu.org
  2020-09-19  0:57 ` hjl.tools at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-19  0:56 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26635

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=14f9473ca225290680c8b21240cdca49f8d3b332

commit 14f9473ca225290680c8b21240cdca49f8d3b332
Author: Victor Collod <vcollod@nvidia.com>
Date:   Fri Sep 18 17:53:02 2020 -0700

    gdb: Update i386_analyze_prologue to skip endbr32

    With -m32 -fcf-protection, GCC generates an `endbr32` instruction at the
    function entry:

    [hjl@gnu-cfl-2 gdb]$ cat /tmp/x.c
    int
    main(void)
    {
      return 0;
    }
    [hjl@gnu-cfl-2 gdb]$ gcc -g -fcf-protection /tmp/x.c -m32
    (gdb) b main
    Breakpoint 1 at 0x8049176: file /tmp/x.c, line 3.
    (gdb) r
    Breakpoint 1, main () at /tmp/x.c:3
    3       {
    (gdb) disass
    Dump of assembler code for function main:
    => 0x08049176 <+0>:     endbr32
       0x0804917a <+4>:     push   %ebp
       0x0804917b <+5>:     mov    %esp,%ebp
       0x0804917d <+7>:     mov    $0x0,%eax
       0x08049182 <+12>:    pop    %ebp
       0x08049183 <+13>:    ret
    End of assembler dump.
    (gdb)

    Update i386_analyze_prologue to skip `endbr32`:

    (gdb) b main
    Breakpoint 1 at 0x804917d: file /tmp/x.c, line 4.
    (gdb) r
    Breakpoint 1, main () at /tmp/x.c:4
    4         return 0;
    (gdb) disass
    Dump of assembler code for function main:
       0x08049176 <+0>:     endbr32
       0x0804917a <+4>:     push   %ebp
       0x0804917b <+5>:     mov    %esp,%ebp
    => 0x0804917d <+7>:     mov    $0x0,%eax
       0x08049182 <+12>:    pop    %ebp
       0x08049183 <+13>:    ret
    End of assembler dump.
    (gdb)

    Tested with

    $ make check RUNTESTFLAGS="--target_board='unix{-m32,}'
i386-prologue-skip-cf-protection.exp"

    on Fedora 32/x86-64.

    2020-0X-YY  Victor Collod  <vcollod@nvidia.com>

    gdb/ChangeLog:

            PR gdb/26635
            * i386-tdep.c (i386_skip_endbr): Add a helper function to skip
endbr.
            (i386_analyze_prologue): Call i386_skip_endbr.

    gdb/testsuite/ChangeLog:

            PR gdb/26635
            * gdb.arch/amd64-prologue-skip-cf-protection.exp: Make the test
            compatible with i386, and move it to...
            * gdb.arch/i386-prologue-skip-cf-protection.exp: ... here.
            * gdb.arch/amd64-prologue-skip-cf-protection.c: Move to...
            * gdb.arch/i386-prologue-skip-cf-protection.c: ... here.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug gdb/26635] i386_analyze_prologue doesn't skip endbr32
  2020-09-18 23:52 [Bug gdb/26635] New: i386_analyze_prologue doesn't skip endbr32 hjl.tools at gmail dot com
  2020-09-18 23:52 ` [Bug gdb/26635] " hjl.tools at gmail dot com
  2020-09-19  0:56 ` cvs-commit at gcc dot gnu.org
@ 2020-09-19  0:57 ` hjl.tools at gmail dot com
  2020-09-19 23:58 ` cvs-commit at gcc dot gnu.org
  2020-09-20 11:31 ` hjl.tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2020-09-19  0:57 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26635

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed for GDB 11.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug gdb/26635] i386_analyze_prologue doesn't skip endbr32
  2020-09-18 23:52 [Bug gdb/26635] New: i386_analyze_prologue doesn't skip endbr32 hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2020-09-19  0:57 ` hjl.tools at gmail dot com
@ 2020-09-19 23:58 ` cvs-commit at gcc dot gnu.org
  2020-09-20 11:31 ` hjl.tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-19 23:58 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26635

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The gdb-10-branch branch has been updated by Simon Marchi
<simark@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b892828bcb92c5213a8222a76b483eb909d02dcb

commit b892828bcb92c5213a8222a76b483eb909d02dcb
Author: Victor Collod <vcollod@nvidia.com>
Date:   Fri Sep 18 17:53:02 2020 -0700

    gdb: Update i386_analyze_prologue to skip endbr32

    With -m32 -fcf-protection, GCC generates an `endbr32` instruction at the
    function entry:

    [hjl@gnu-cfl-2 gdb]$ cat /tmp/x.c
    int
    main(void)
    {
      return 0;
    }
    [hjl@gnu-cfl-2 gdb]$ gcc -g -fcf-protection /tmp/x.c -m32
    (gdb) b main
    Breakpoint 1 at 0x8049176: file /tmp/x.c, line 3.
    (gdb) r
    Breakpoint 1, main () at /tmp/x.c:3
    3       {
    (gdb) disass
    Dump of assembler code for function main:
    => 0x08049176 <+0>:     endbr32
       0x0804917a <+4>:     push   %ebp
       0x0804917b <+5>:     mov    %esp,%ebp
       0x0804917d <+7>:     mov    $0x0,%eax
       0x08049182 <+12>:    pop    %ebp
       0x08049183 <+13>:    ret
    End of assembler dump.
    (gdb)

    Update i386_analyze_prologue to skip `endbr32`:

    (gdb) b main
    Breakpoint 1 at 0x804917d: file /tmp/x.c, line 4.
    (gdb) r
    Breakpoint 1, main () at /tmp/x.c:4
    4         return 0;
    (gdb) disass
    Dump of assembler code for function main:
       0x08049176 <+0>:     endbr32
       0x0804917a <+4>:     push   %ebp
       0x0804917b <+5>:     mov    %esp,%ebp
    => 0x0804917d <+7>:     mov    $0x0,%eax
       0x08049182 <+12>:    pop    %ebp
       0x08049183 <+13>:    ret
    End of assembler dump.
    (gdb)

    Tested with

    $ make check RUNTESTFLAGS="--target_board='unix{-m32,}'
i386-prologue-skip-cf-protection.exp"

    on Fedora 32/x86-64.

    2020-0X-YY  Victor Collod  <vcollod@nvidia.com>

    gdb/ChangeLog:

            PR gdb/26635
            * i386-tdep.c (i386_skip_endbr): Add a helper function to skip
endbr.
            (i386_analyze_prologue): Call i386_skip_endbr.

    gdb/testsuite/ChangeLog:

            PR gdb/26635
            * gdb.arch/amd64-prologue-skip-cf-protection.exp: Make the test
            compatible with i386, and move it to...
            * gdb.arch/i386-prologue-skip-cf-protection.exp: ... here.
            * gdb.arch/amd64-prologue-skip-cf-protection.c: Move to...
            * gdb.arch/i386-prologue-skip-cf-protection.c: ... here.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug gdb/26635] i386_analyze_prologue doesn't skip endbr32
  2020-09-18 23:52 [Bug gdb/26635] New: i386_analyze_prologue doesn't skip endbr32 hjl.tools at gmail dot com
                   ` (3 preceding siblings ...)
  2020-09-19 23:58 ` cvs-commit at gcc dot gnu.org
@ 2020-09-20 11:31 ` hjl.tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2020-09-20 11:31 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26635

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.1

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed for GDB 10.1 and 11.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-09-20 11:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18 23:52 [Bug gdb/26635] New: i386_analyze_prologue doesn't skip endbr32 hjl.tools at gmail dot com
2020-09-18 23:52 ` [Bug gdb/26635] " hjl.tools at gmail dot com
2020-09-19  0:56 ` cvs-commit at gcc dot gnu.org
2020-09-19  0:57 ` hjl.tools at gmail dot com
2020-09-19 23:58 ` cvs-commit at gcc dot gnu.org
2020-09-20 11:31 ` hjl.tools at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).