Discussion:
[Bug remote/23473] New: remote debugging of x32 application fails when target cpu has mpx support
lance604 at gmail dot com
2018-08-01 09:24:37 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23473

Bug ID: 23473
Summary: remote debugging of x32 application fails when target
cpu has mpx support
Product: gdb
Version: 8.1
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: remote
Assignee: unassigned at sourceware dot org
Reporter: lance604 at gmail dot com
Target Milestone: ---

Problem seen with gdb 8.1 and 7.12.1 (other versions were not tested).

Test scenario fails when target CPU has MPX support, with gdbserver output when
gdb connects to gdbserver:

$ bin/gdbserver localhost:9999 ./foo
Process ./foo created; pid = 8243
Listening on port 9999
Remote debugging from host 127.0.0.1
regcache.c:252: A problem internal to GDBserver has been detected.
Unknown register bnd0raw requested

Apparently gdb is requesting an MPX-related register "bnd0raw", but this fails
because MPX is not supported by the x32 ABI.

This problem has been observed on the following platforms:
- Ubuntu 18.04 on i7-8700K (Coffee Lake, with MPX support)
- Debian 9 with 4.14.59 kernel.org kernel on Atom C3758 (Denverton, with MPX
support)

Remote debugging of x32 targets has been observed to work with no issue on the
following plaforms:
- Ubuntu 18.04 on i7-4790K (Haswell, no MPX support)
- Linux with 4.14.57 kernel on Atom C2558 (Rangeley, no MPX support)
--
You are receiving this mail because:
You are on the CC list for the bug.
lance604 at gmail dot com
2018-08-01 11:46:38 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23473

--- Comment #1 from Lance Richardson <lance604 at gmail dot com> ---
This is easily reproducible on a system with X32 ABI support and a CPU with MPX
support (check via "grep mpx /proc/cpuinfo". Skylake or newer, Apollo Lake, and
Denverton CPUs should have it).

In this example, Kubuntu 18.04 with x32 multilib installed on a Coffee Lake
CPU:

###
# Build a trivial x32 application
$ cat foo.c
int main(int argc, char **argv)
{
return 0;
}

$ gcc -mx32 -g -o foo foo.c

###
# gdb command file
$ cat gdbfile
file ./foo
target remote localhost:9999

###
# On terminal 1
$ gdbserver localhost:9999 ./foo
Process ./foo created; pid = 8893
Listening on port 9999

###
# On terminal 2
$ gdb -nx -x gdbfile
GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
Copyright (C) 2018 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-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://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".
gdbfile:2: Error in sourced command file:
Remote connection closed
(gdb)

####
# Output on terminal 1:
Remote debugging from host 127.0.0.1
/build/gdb-GT4MLW/gdb-8.1/gdb/gdbserver/regcache.c:252: A problem internal to
GDBserver has been detected.
Unknown register bnd0raw requested
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...