[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#728705: gdb fails on s390x with "Couldn't write registers: Invalid argument"



Control: reassign -1 linux 3.2.51-1
Control: affects -1 gdb
Control: notforwarded -1

So, it turns out that the 0x5001 is PTRACE_POKEUSR_AREA, which is
essentially equivalent to PTRACE_POKEUSER in a loop, except for being
less clear when it fails, because you can't tell which word couldn't be
written.

Accordingly, I've replaced the failing call with a loop.
diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
index ee9b617..de9d956 100644
--- a/gdb/s390-linux-nat.c
+++ b/gdb/s390-linux-nat.c
@@ -248,6 +248,9 @@ store_regs (const struct regcache *regcache, int tid, int regnum)
 {
   gregset_t regs;
   ptrace_area parea;
+#if 1
+  int i;
+#endif
 
   parea.len = sizeof (regs);
   parea.process_addr = (addr_t) &regs;
@@ -257,8 +260,17 @@ store_regs (const struct regcache *regcache, int tid, int regnum)
 
   fill_gregset (regcache, &regs, regnum);
 
+#if 0
   if (ptrace (PTRACE_POKEUSR_AREA, tid, (long) &parea) < 0)
     perror_with_name (_("Couldn't write registers"));
+#else
+  for (i = 0; i < parea.len; i += sizeof(void *))
+  {
+    if (ptrace (PTRACE_POKEUSER, tid, parea.kernel_addr + i,
+		*(void**)(parea.process_addr + i)) < 0)
+      perror_with_name (_("Couldn't write registers"));
+  }
+#endif
 }
 
 /* Fetch all floating-point registers from process/thread TID and store
Running "strace -e ptrace gdb -batch -ex start -ex bt --args echo foo"
then results in the failing part looking like:

,----
| ptrace(0x5000 /* PTRACE_??? */, 25005, 0x3ffffad7d80, 0x80073fa0) = 0
| ptrace(0x5000 /* PTRACE_??? */, 25005, 0x3ffffad7cf0, 0x80074410) = 0
| ptrace(PTRACE_POKEUSER, 25005, psw_mask, 0x705c00180000000) = -1 EINVAL (Invalid argument)
`----

However, this same value was just read from that register a bit earlier:

,----
| ptrace(PTRACE_PEEKUSER, 25005, psw_mask, [0x705c00180000000]) = 0
`----

So, this looks like a kernel bug from here.


Kernel stuff
============

zelenka is currently running linux-image-3.2.0-4-s390x version 3.2.51-1

,----[ /proc/cpuinfo ]
| vendor_id       : IBM/S390
| # processors    : 2
| bogomips per cpu: 9398.00
| features	: esan3 zarch stfle msa ldisp eimm dfp etf3eh highgprs 
| processor 0: version = FF,  identification = 06A18A,  machine = 2817
| processor 1: version = FF,  identification = 06A18A,  machine = 2817
`----

While it wasn't exactly easy, I managed to run the kernel bugscript
outside the chroot; the output is attached.
** Version:
Linux version 3.2.0-4-s390x (debian-kernel@lists.debian.org) (gcc version 4.6.3 (Debian 4.6.3-14) ) #1 SMP Debian 3.2.51-1

** Command line:
ro dasd=200-21f vmpoff="LOGOFF" root=/dev/dasdb1 elevator=deadline BOOT_IMAGE=0

** Not tainted

** Kernel log:
[7340394.293000] [30285]  3227 30285      567        1   0       0             0 sh
[7340394.293003] [30286]  3227 30286     2419        6   1       0             0 debuild
[7340394.293006] [30326]  3227 30326      567        1   1       0             0 sh
[7340394.293009] [30327]  3227 30327     2938        8   1       0             0 dpkg-buildpacka
[7340394.293012] [30328]  3227 30328      536        0   0       0             0 tee
[7340394.293015] [30507]  3227 30507      575        0   0       0             0 rules
[7340394.293018] [30517]  3227 30517     3182        0   0       0             0 dh
[7340394.293021] [ 3116]  3227  3116      575        0   0       0             0 rules
[7340394.293024] [ 3130]  3227  3130      567        2   0       0             0 xvfb-run
[7340394.293027] [ 3142]  3227  3142     2690        4   1       0             0 Xvfb
[7340394.293030] [ 3149]  3227  3149      707        0   0       0             0 make
[7340394.293033] [ 5981]  3227  5981      708        1   1       0             0 make
[7340394.293036] [ 5984]  3227  5984  1165290   241254   1       0             0 lt-octave-cli
[7340394.293039] [ 7843]     0  7843     1174       65   0       0             0 cron
[7340394.293042] [ 7844]     0  7844     1174       65   0       0             0 cron
[7340394.293045] [ 7845]     0  7845     1173      109   1       0             0 cron
[7340394.293048] [ 7846]     0  7846     1173      114   1       0             0 cron
[7340394.293050] Out of memory: Kill process 5984 (lt-octave-cli) score 961 or sacrifice child
[7340394.293053] Killed process 5984 (lt-octave-cli) total-vm:4661160kB, anon-rss:965016kB, file-rss:0kB
[7344121.447118] lt-octave-cli invoked oom-killer: gfp_mask=0x201da, order=0, oom_adj=0, oom_score_adj=0
[7344121.447124] lt-octave-cli cpuset=/ mems_allowed=0
[7344121.447128] CPU: 0 Not tainted 3.2.0-4-s390x #1 Debian 3.2.51-1
[7344121.447130] Process lt-octave-cli (pid: 21694, task: 000000003dd7e738, ksp: 0000000020b1b8d8)
[7344121.447133] 0000000000000000 0000000020b1b880 0000000000000002 0000000000000000 
[7344121.447135]        0000000020b1b920 0000000020b1b898 0000000020b1b898 00000000003b9c0e 
[7344121.447139]        00000000003c77c8 0000000000000000 0000000000000000 000000000000000a 
[7344121.447142]        0000000000000000 000000000000000c 0000000020b1b880 0000000020b1b8f8 
[7344121.447145]        00000000003d2260 0000000000011a5e 0000000020b1b880 0000000020b1b8d0 
[7344121.447148] Call Trace:
[7344121.447150] ([<00000000000201da>] sys_dump_fcp_lun_store+0x32/0x60)
[7344121.447157] Mem-Info:
[7344121.447158] DMA per-cpu:
[7344121.447160] CPU    0: hi:  186, btch:  31 usd:   9
[7344121.447162] CPU    1: hi:  186, btch:  31 usd: 177
[7344121.447166] active_anon:121262 inactive_anon:121314 isolated_anon:0
[7344121.447167]  active_file:434 inactive_file:480 isolated_file:0
[7344121.447169]  unevictable:26 dirty:0 writeback:27 unstable:0
[7344121.447170]  free:1012 slab_reclaimable:1825 slab_unreclaimable:2749
[7344121.447171]  mapped:579 shmem:26 pagetables:2070 bounce:0
[7344121.447177] DMA free:4048kB min:4064kB low:5080kB high:6096kB active_anon:485048kB inactive_anon:485256kB active_file:1736kB inactive_file:1920kB unevictable:104kB isolated(anon):0kB isolated(file):0kB present:1034240kB mlocked:104kB dirty:0kB writeback:108kB mapped:2316kB shmem:104kB slab_reclaimable:7300kB slab_unreclaimable:10996kB kernel_stack:1360kB pagetables:8280kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:5875 all_unreclaimable? yes
[7344121.447183] lowmem_reserve[]: 0 0 0
[7344121.447186] DMA: 500*4kB 0*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 2*1024kB = 4048kB
[7344121.447192] 2466 total pagecache pages
[7344121.447194] 1535 pages in swap cache
[7344121.447196] Swap cache stats: add 9230940, delete 9229405, find 105881464/106245976
[7344121.447198] Free swap  = 0kB
[7344121.447199] Total swap = 2620852kB
[7344121.453288] 262144 pages RAM
[7344121.453290] 6585 pages reserved
[7344121.453292] 671 pages shared
[7344121.453293] 253044 pages non-shared
[7344121.453295] [ pid ]   uid  tgid total_vm      rss cpu oom_adj oom_score_adj name
[7344121.453302] [  306]     0   306     1134        2   1     -17         -1000 udevd
[7344121.453306] [ 2016]     1  2016      481        1   1       0             0 uptimed
[7344121.453310] [ 2160]     0  2160      972        0   1       0             0 atd
[7344121.453313] [ 2206]   110  2206     1630        1   1       0             0 stunnel4
[7344121.453316] [ 2207]   110  2207     1630        1   1       0             0 stunnel4
[7344121.453320] [ 2208]   110  2208     1630        1   1       0             0 stunnel4
[7344121.453323] [ 2209]   110  2209     1630        1   1       0             0 stunnel4
[7344121.453326] [ 2210]   110  2210     1630        1   1       0             0 stunnel4
[7344121.453329] [ 2211]   110  2211     2069        0   0       0             0 stunnel4
[7344121.453332] [ 2214]   105  2214     2341       53   1       0             0 ntpd
[7344121.453336] [ 2219]     0  2219      527        0   0       0             0 ulogd
[7344121.453339] [ 2301]   111  2301     5000      259   1       0             0 unbound
[7344121.453342] [ 2448]   106  2448     4955        3   1       0             0 exim4
[7344121.453345] [ 2999]     0  2999      836        0   1       0             0 bash
[7344121.453348] [ 3000]     0  3000     1417       22   0       0             0 monit
[7344121.453352] [21883]     0 21883     2864        0   0       0             0 sshd
[7344121.453355] [21889]   113 21889     2968        0   1       0             0 sshd
[7344121.453358] [23316]   112 23316     5087        0   0       0             0 bacula-fd
[7344121.453361] [12696]     0 12696      475        0   1       0             0 ekeyd-egd-linux
[7344121.453364] [20307]  2830 20307     1676        0   1       0             0 screen
[7344121.453367] [20308]  2830 20308     2005        1   1       0             0 bash
[7344121.453371] [20471]  2830 20471     2011        3   1       0             0 bash
[7344121.453373] [ 9746]     0  9746     2932      106   0       0             0 munin-node
[7344121.453377] [10002]   113 10002     2831        0   1       0             0 /usr/share/muni
[7344121.453380] [28336]     0 28336     4286       57   1       0             0 samhain
[7344121.453383] [29409]     0 29409     1057        1   0       0             0 syslog-ng
[7344121.453386] [29410]     0 29410     4307      211   0       0             0 syslog-ng
[7344121.453389] [ 4726]     0  4726     1133        0   0     -17         -1000 udevd
[7344121.453393] [ 4727]     0  4727     1133        0   1     -17         -1000 udevd
[7344121.453396] [ 7734]     0  7734     1712       24   1     -17         -1000 sshd
[7344121.453399] [25295]     0 25295     1069        5   0       0             0 cron
[7344121.453402] [ 1600]     0  1600     2864        2   0       0             0 sshd
[7344121.453405] [21657]     0 21657     4286        0   1       0             0 samhain
[7344121.453408] [21671]   102 21671     2279        2   1       0             0 zabbix_agentd
[7344121.453411] [21672]   102 21672     2279       37   1       0             0 zabbix_agentd
[7344121.453415] [21673]   102 21673     2279        3   1       0             0 zabbix_agentd
[7344121.453418] [21674]   102 21674     2279        3   0       0             0 zabbix_agentd
[7344121.453421] [21676]   102 21676     2279        3   0       0             0 zabbix_agentd
[7344121.453424] [ 9686]     0  9686     2864        1   0       0             0 sshd
[7344121.453427] [17558]   108 17558     1638        5   0       0             0 nrpe
[7344121.453430] [19683]     0 19683     2911        0   0       0             0 sshd
[7344121.453433] [19689]  3227 19689     2911       27   0       0             0 sshd
[7344121.453436] [19690]  3227 19690     1976        3   1       0             0 bash
[7344121.453440] [19729]  3227 19729     8151        1   1       0             0 schroot
[7344121.453443] [19730]  3227 19730      993        3   1       0             0 bash
[7344121.453446] [21694]  3227 21694   903176   240715   0       0             0 lt-octave-cli
[7344121.453448] Out of memory: Kill process 21694 (lt-octave-cli) score 970 or sacrifice child
[7344121.453451] Killed process 21694 (lt-octave-cli) total-vm:3612704kB, anon-rss:960744kB, file-rss:2116kB

** Model information
processor 0: version = FF,  identification = 06A18A,  machine = 2817
processor 1: version = FF,  identification = 06A18A,  machine = 2817

** Loaded modules:
nf_conntrack_ipv6
nf_defrag_ipv6
ip6t_REJECT
ip6t_LOG
ip6table_filter
ip6_tables
nf_conntrack_ipv4
nf_defrag_ipv4
ipt_REJECT
ipt_ULOG
xt_tcpudp
xt_state
nf_conntrack
xt_hashlimit
xt_multiport
iptable_filter
ip_tables
x_tables
qeth_l2
dm_snapshot
appldata_net_sum
appldata_mem
appldata_os
qeth
ccwgroup
vmur
ext3
mbcache
jbd
dm_mod
dasd_fba_mod
dasd_eckd_mod
dasd_mod

** PCI devices:
not available

** USB devices:
not available

The error return is presumably from this code:
<http://sources.debian.net/src/linux/3.2.51-1/arch/s390/kernel/ptrace.c#L294>

I'd be happy to get you any further information, though I assume you
would find it easier to simply "ssh zelenka.debian.org" to answer most
of the questions you might typically ask.

Of course, to try another kernel, you'd need help from DSA.

Reply to: