Bug 16468 - gdb fails on s390x with "Couldn't write registers: Invalid argument"
Summary: gdb fails on s390x with "Couldn't write registers: Invalid argument"
Status: RESOLVED INVALID
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: 7.6
: P2 critical
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-20 02:46 UTC by Samuel Bronson
Modified: 2014-02-01 00:45 UTC (History)
1 user (show)

See Also:
Host: s390x-linux-gnu
Target: s390x-linux-gnu
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Samuel Bronson 2014-01-20 02:46:18 UTC
Some of us at Debian have noticed that GDB isn't working in s390x sid chroots on the s390 porterbox, zelenka.debian.org.

Observe:

sbronson@zelenka:~/strace-code$ uname -a
Linux zelenka 3.2.0-4-s390x #1 SMP Debian 3.2.51-1 s390x GNU/Linux
sbronson@zelenka:~/strace-code$ dpkg-query -W linux-image-3.2.0-4-s390x
linux-image-3.2.0-4-s390x       3.2.51-1
sbronson@zelenka:~/strace-code$ schroot -r -c $CHROOT
<-code$ strace -e ptrace gdb -batch -ex run -ex bt --args echo foo
--- SIGCHLD (Child exited) @ 0 (0) ---
--- SIGCHLD (Child exited) @ 0 (0) ---
ptrace(PTRACE_CONT, 22210, 0x1, SIG_0)  = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
ptrace(PTRACE_SETOPTIONS, 22210, 0, PTRACE_O_TRACEFORK) = 0
ptrace(PTRACE_SETOPTIONS, 22211, 0, PTRACE_O_TRACEFORK) = 0
ptrace(PTRACE_SETOPTIONS, 22211, 0, PTRACE_O_TRACEFORK|PTRACE_O_TRACEVFORKDONE) = 0
ptrace(PTRACE_CONT, 22211, 0, SIG_0)    = 0
ptrace(PTRACE_GETEVENTMSG, 22211, 0, 0x3ffffdb1af8) = 0
ptrace(PTRACE_KILL, 22212, 0, 0)        = 0
ptrace(PTRACE_KILL, 22211, 0, 0)        = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
ptrace(PTRACE_SETOPTIONS, 22210, 0, PTRACE_O_TRACEFORK|PTRACE_O_TRACEVFORK|PTRACE_O_TRACECLONE|PTRACE_O_TRACEEXEC|PTRACE_O_TRACEVFORKDONE) = 0
ptrace(PTRACE_SETOPTIONS, 22210, 0, PTRACE_O_TRACESYSGOOD) = 0
ptrace(PTRACE_SETOPTIONS, 22210, 0, PTRACE_O_TRACESYSGOOD|PTRACE_O_TRACEFORK|PTRACE_O_TRACEVFORK|PTRACE_O_TRACECLONE|PTRACE_O_TRACEEXEC|PTRACE_O_TRACEVFORKDONE) = 0
ptrace(0x4204 /* PTRACE_??? */, 22210, 0x306, 0x3ffffdb1cb8) = 0
ptrace(0x4204 /* PTRACE_??? */, 22210, 0x307, 0x3ffffdb1cb8) = 0
ptrace(PTRACE_PEEKUSER, 22210, psw_mask, [0x705c00180000000]) = 0
ptrace(0x5000 /* PTRACE_??? */, 22210, 0x3ffffdb1af0, 0x3fffcc2db28) = 0
ptrace(PTRACE_PEEKUSER, 22210, psw_mask, [0x705c00180000000]) = 0
.
.
.
ptrace(PTRACE_PEEKUSER, 22210, psw_mask, [0x705c00180000000]) = 0
ptrace(PTRACE_PEEKTEXT, 22210, 0x80007ef8, [0]) = 0
ptrace(PTRACE_PEEKUSER, 22210, psw_mask, [0x705c00180000000]) = 0
.
.
.
ptrace(PTRACE_PEEKUSER, 22210, psw_mask, [0x705c00180000000]) = 0
ptrace(PTRACE_PEEKTEXT, 22210, 0x80007ef8, [0]) = 0
ptrace(0x4204 /* PTRACE_??? */, 22210, 0x307, 0x3ffffdb19e8) = 0
ptrace(0x4205 /* PTRACE_??? */, 22210, 0x307, 0x3ffffdb19e8) = 0
ptrace(PTRACE_PEEKTEXT, 22210, 0x3fffdfeb6d0, [0xfddc070707fe0707]) = 0
ptrace(PTRACE_PEEKTEXT, 22210, 0x3fffdfeb6d0, [0xfddc070707fe0707]) = 0
ptrace(PTRACE_POKEDATA, 22210, 0x3fffdfeb6d0, 0xfddc070700010707) = 0
ptrace(PTRACE_CONT, 22210, 0x1, SIG_0)  = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
ptrace(0x5000 /* PTRACE_??? */, 22210, 0x3ffffdb1548, 0x3fffcc2db28) = 0
ptrace(0x5000 /* PTRACE_??? */, 22210, 0x3ffffdb14c0, 0x1) = 0
ptrace(0x5001 /* PTRACE_??? */, 22210, 0x3ffffdb14c0, 0xbc1cbf28) = -1 EINVAL (Invalid argument)
Couldn't write registers: Invalid argument.
Target is executing.
ptrace(PTRACE_KILL, 22210, 0, 0)        = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
ptrace(PTRACE_KILL, 22210, 0, 0)        = -1 ESRCH (No such process)
(sid_s390x-dchroot)sbronson@zelenka:~/strace-code$ gdb --version
GNU gdb (GDB) 7.6.1 (Debian 7.6.1-1)
.
.
.

(The failing request is a PTRACE_POKEUSR_AREA request.)

The kernel package can be obtained from:
http://snapshot.debian.org/package/linux/3.2.51-1/#linux-image-3.2.0-4-s390x_3.2.51-1

(In this case, since the outer system is running the s390 arch, it came from the _s390.deb)
Comment 1 Samuel Bronson 2014-01-20 02:49:01 UTC
Oh yeah, I forgot to mention: this is <http://bugs.debian.org/728705>.
Comment 2 Samuel Bronson 2014-01-22 19:17:49 UTC
Also, should you want to play around on zelenka.debian.org yourself, it shouldn't be a problem to get you a guest account.  See <https://dsa.debian.org/doc/guest-account/>; I believe Héctor Orón Martínez <zumbi@debian.org> would be happy to sponsor any reputable upstream developer.
Comment 3 Samuel Bronson 2014-01-23 22:56:32 UTC
Oh, by the way, as this is reported to work on other systems that are running more recent kernel versions, it's quite possible that this is actually a problem with zelenka's kernel, which turns out to just be the one in Debian stable (codenamed wheezy).

Of course, if this is the case, it would be most helpful if you could help us figure out *what* is wrong with this kernel so we can get it fixed in wheezy.  I believe the offending code would be in <http://sources.debian.net/src/linux/3.2.51-1/arch/s390/kernel/ptrace.c>, most likely in the region starting at
<http://sources.debian.net/src/linux/3.2.51-1/arch/s390/kernel/ptrace.c#L250> ...
Comment 4 Sergio Durigan Junior 2014-01-26 05:35:16 UTC
(In reply to Samuel Bronson from comment #3)
> Oh, by the way, as this is reported to work on other systems that are
> running more recent kernel versions, it's quite possible that this is
> actually a problem with zelenka's kernel, which turns out to just be the one
> in Debian stable (codenamed wheezy).

Yeah, I have this strong feeling that the Linux kernel is the culprit here.

Anyway, unfortunately I won't have time to investigate this issue in the next 2 weeks.  I'll get back to it as soon as I can.

Thanks.
Comment 5 Samuel Bronson 2014-02-01 00:45:22 UTC
After further investigation, I reassigned this to the kernel in Debian, and I'm marking it INVALID here.

Not sure exactly what the kernel is screwing up yet, though.

For the curious, details are at: http://bugs-master.debian.org/cgi-bin/bugreport.cgi?bug=728705#47