Bug 22137 - gdbserver crashes on hosts with pkru register
Summary: gdbserver crashes on hosts with pkru register
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: server (show other bugs)
Version: 8.0.1
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-14 17:21 UTC by Alicia Boya García
Modified: 2017-11-29 19:31 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2017-10-13 00:00:00


Attachments
Previous commiter did not regenerated the dat files. (401 bytes, text/plain)
2017-09-20 13:18 UTC, Walfred Tedeschi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alicia Boya García 2017-09-14 17:21:12 UTC
How to reproduce (as a Bash snippet):

cat > /tmp/a.c <<EOF
#include <stdio.h>
int main(int argc, char** argv) {
    puts("hi\n");
    return 0;
}
EOF
gcc -g -O0 -o /tmp/a /tmp/a.c
gdbserver localhost:5000 /tmp/a &
gdb -q /tmp/a <<EOF
target remote localhost:5000
quit
EOF

Expected behavior:

The client connects to the server and quits without errors.

Actual behavior:

The server crashes when the client connects:

Remote debugging from host 127.0.0.1
../../../gdb/gdbserver/regcache.c:264: A problem internal to GDBserver has been detected.
Unknown register pkru requested

This is only reproducible in hosts that support the Intel Protection Keys for Userspace x86 extension (lscpu |grep -w pku).

Version:

GNU gdbserver (GDB) Fedora 8.0.1-26.fc26
GNU gdb (GDB) Fedora 8.0.1-26.fc26
Comment 1 Walfred Tedeschi 2017-09-20 13:18:28 UTC
Created attachment 10433 [details]
Previous commiter did not regenerated the dat files.

Partially added to Master branch by Yao.
Comment 2 Walfred Tedeschi 2017-09-20 13:19:08 UTC
Bug is confirmed.

Patch should fix the issue.

Thanks and regards,
/Fred
Comment 3 Pedro Alves 2017-10-13 09:05:44 UTC
> Bug is confirmed.

Updating status then.  Waldfred, if your account doesn't let you do that yourself, please let me know.

And, I believe the bug is fixed in both master and 8.0 branch, right?
Comment 4 Walfred Tedeschi 2017-10-13 09:08:54 UTC
> -----Original Message-----
> From: palves at redhat dot com [mailto:sourceware-
> bugzilla@sourceware.org]
> Sent: Friday, October 13, 2017 11:06 AM
> To: Tedeschi, Walfred <walfred.tedeschi@intel.com>
> Subject: [Bug server/22137] gdbserver crashes on hosts with pkru register
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=22137
> 
> Pedro Alves <palves at redhat dot com> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>              Status|UNCONFIRMED                 |NEW
>    Last reconfirmed|                            |2017-10-13
>      Ever confirmed|0                           |1
> 
> --- Comment #3 from Pedro Alves <palves at redhat dot com> ---
> > Bug is confirmed.
> 
> Updating status then.  Waldfred, if your account doesn't let you do that
> yourself, please let me know.
> 
> And, I believe the bug is fixed in both master and 8.0 branch, right?
> 

Patch works for both!

I will patch then!

Thanks and regards,
/Fred

> --
> You are receiving this mail because:
> You are on the CC list for the bug.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928