public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug tdep/27172] New: [-m32] FAIL: gdb.arch/i386-mpx-sigsegv.exp: MPX signal segv Lower: 0
@ 2021-01-11 10:19 vries at gcc dot gnu.org
  2021-01-11 10:19 ` [Bug tdep/27172] " vries at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2021-01-11 10:19 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 27172
           Summary: [-m32] FAIL: gdb.arch/i386-mpx-sigsegv.exp: MPX signal
                    segv Lower: 0
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tdep
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

When running test-case gdb.arch/i386-mpx-sigsegv.exp with target board
unix/-m32, we run into:
...
FAIL: gdb.arch/i386-mpx-sigsegv.exp: MPX signal segv Lower: 0
...

In more detail:
...
(gdb) continue^M
Continuing.^M
Saw a #BR! status 1 at 0x8048c2d^M
^M
Program received signal SIGSEGV, Segmentation fault^M
Upper bound violation while accessing address 0x0804c15c^M
Bounds: [lower = 0x00000000, upper = 0x00000000].^M
0x08048a4f in lower (p=0x804c160, a=0x804c180, b=0x804c1a0, c=0x804c1c0,
d=0x804c1e0, len=1) at
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.arch/i386-mpx-sigsegv.c:79^M
79        value = *(p - len);^M
(gdb) FAIL: gdb.arch/i386-mpx-sigsegv.exp: MPX signal segv Lower: 0
...

The FAIL is due to the fact that we expect a "Lower bound violation" message,
but instead get an "Upper bound violation".

The message comes from i386_linux_report_signal_info, where upper/lower is
determined by:
...
  is_upper = (access > upper_bound ? 1 : 0);
...

So, given that access == 0x0804c15c and upper_bound == 0x0, is_upper evaluates
to true.

In other words, the incorrect message is caused by
$_siginfo._sifields._sigfault._addr_bnd._upper evaluating to 0x0.

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

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

* [Bug tdep/27172] [-m32] FAIL: gdb.arch/i386-mpx-sigsegv.exp: MPX signal segv Lower: 0
  2021-01-11 10:19 [Bug tdep/27172] New: [-m32] FAIL: gdb.arch/i386-mpx-sigsegv.exp: MPX signal segv Lower: 0 vries at gcc dot gnu.org
@ 2021-01-11 10:19 ` vries at gcc dot gnu.org
  2021-01-11 10:33 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2021-01-11 10:19 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gdb/nat/amd64-linux-siginfo.c b/gdb/nat/amd64-linux-siginfo.c
index 8bcff454378..1b10f5c2cdb 100644
--- a/gdb/nat/amd64-linux-siginfo.c
+++ b/gdb/nat/amd64-linux-siginfo.c
@@ -277,6 +277,8 @@ typedef struct compat_x32_siginfo
 #define cpt_si_ptr _sifields._rt._sigval.sival_ptr
 #define cpt_si_addr _sifields._sigfault._addr
 #define cpt_si_addr_lsb _sifields._sigfault._addr_lsb
+#define cpt_si_lower _sifields._sigfault.si_addr_bnd._lower
+#define cpt_si_upper _sifields._sigfault.si_addr_bnd._upper
 #define cpt_si_band _sifields._sigpoll._band
 #define cpt_si_fd _sifields._sigpoll._fd

@@ -324,6 +326,12 @@ compat_siginfo_from_siginfo (compat_siginfo_t *to, const
siginfo_t *fr
om)
       to->cpt_si_pid = from_ptrace.cpt_si_pid;
       to->cpt_si_uid = from_ptrace.cpt_si_uid;
     }
+  else if (to->si_code == 3 && to->si_signo == SIGSEGV)
+    {
+      to->cpt_si_addr = from_ptrace.cpt_si_addr;
+      to->cpt_si_lower = from_ptrace.cpt_si_lower;
+      to->cpt_si_upper = from_ptrace.cpt_si_upper;
+    }--
   else if (to->si_code < 0)
     {
       to->cpt_si_pid = from_ptrace.cpt_si_pid;
...

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

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

* [Bug tdep/27172] [-m32] FAIL: gdb.arch/i386-mpx-sigsegv.exp: MPX signal segv Lower: 0
  2021-01-11 10:19 [Bug tdep/27172] New: [-m32] FAIL: gdb.arch/i386-mpx-sigsegv.exp: MPX signal segv Lower: 0 vries at gcc dot gnu.org
  2021-01-11 10:19 ` [Bug tdep/27172] " vries at gcc dot gnu.org
@ 2021-01-11 10:33 ` vries at gcc dot gnu.org
  2021-01-18  8:32 ` cvs-commit at gcc dot gnu.org
  2021-01-18  8:37 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2021-01-11 10:33 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
submitted patch:
https://sourceware.org/pipermail/gdb-patches/2021-January/174916.html

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

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

* [Bug tdep/27172] [-m32] FAIL: gdb.arch/i386-mpx-sigsegv.exp: MPX signal segv Lower: 0
  2021-01-11 10:19 [Bug tdep/27172] New: [-m32] FAIL: gdb.arch/i386-mpx-sigsegv.exp: MPX signal segv Lower: 0 vries at gcc dot gnu.org
  2021-01-11 10:19 ` [Bug tdep/27172] " vries at gcc dot gnu.org
  2021-01-11 10:33 ` vries at gcc dot gnu.org
@ 2021-01-18  8:32 ` cvs-commit at gcc dot gnu.org
  2021-01-18  8:37 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-18  8:32 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

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

commit d3d7d1ba3bbf899bd318a6d4e63ba24534ad5e86
Author: Tom de Vries <tdevries@suse.de>
Date:   Mon Jan 18 09:32:38 2021 +0100

    [gdb/tdep] Handle si_addr_bnd in compat_siginfo_from_siginfo

    When running test-case gdb.arch/i386-mpx-sigsegv.exp with target board
    unix/-m32, we run into:
    ...
    (gdb) continue^M
    Continuing.^M
    Saw a #BR! status 1 at 0x8048c2d^M
    ^M
    Program received signal SIGSEGV, Segmentation fault^M
    Upper bound violation while accessing address 0x0804c15c^M
    Bounds: [lower = 0x00000000, upper = 0x00000000].^M
    0x08048a4f in lower (p=0x804c160, a=0x804c180, b=0x804c1a0, c=0x804c1c0, \
      d=0x804c1e0, len=1) at i386-mpx-sigsegv.c:79^M
    79        value = *(p - len);^M
    (gdb) FAIL: gdb.arch/i386-mpx-sigsegv.exp: MPX signal segv Lower: 0
    ...

    The problem is that lower and upper in the Bounds message are 0x0, which is
    caused by $_siginfo._sifields._sigfault._addr_bnd.{_lower,_upper}
evaluating
    to 0x0.

    Fix this by copying the si_lower/si_upper fields in
    compat_siginfo_from_siginfo.

    Tested on x86_64-linux, with target board unix/-m32.

    gdb/ChangeLog:

    2021-01-18  Tom de Vries  <tdevries@suse.de>

            PR tdep/27172
            * nat/amd64-linux-siginfo.c (cpt_si_lower, cpt_si_upper,
SEGV_BNDERR):
            New macro.
            (compat_siginfo_from_siginfo): Copy cpt_si_lower and cpt_si_upper
            for SEGV_BNDERR.

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

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

* [Bug tdep/27172] [-m32] FAIL: gdb.arch/i386-mpx-sigsegv.exp: MPX signal segv Lower: 0
  2021-01-11 10:19 [Bug tdep/27172] New: [-m32] FAIL: gdb.arch/i386-mpx-sigsegv.exp: MPX signal segv Lower: 0 vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-01-18  8:32 ` cvs-commit at gcc dot gnu.org
@ 2021-01-18  8:37 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2021-01-18  8:37 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.1
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
Patch with fix committed, marking resolved-fixed.

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

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

end of thread, other threads:[~2021-01-18  8:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-11 10:19 [Bug tdep/27172] New: [-m32] FAIL: gdb.arch/i386-mpx-sigsegv.exp: MPX signal segv Lower: 0 vries at gcc dot gnu.org
2021-01-11 10:19 ` [Bug tdep/27172] " vries at gcc dot gnu.org
2021-01-11 10:33 ` vries at gcc dot gnu.org
2021-01-18  8:32 ` cvs-commit at gcc dot gnu.org
2021-01-18  8:37 ` vries at gcc dot gnu.org

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