Bug 436183 - utrace: orig_rax 0x00000000ffffffff not recognized as -1
utrace: orig_rax 0x00000000ffffffff not recognized as -1
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
rawhide
x86_64 Linux
low Severity low
: ---
: ---
Assigned To: Roland McGrath
Fedora Extras Quality Assurance
: Regression
Depends On: 434995
Blocks: 437881 437882
  Show dependency treegraph
 
Reported: 2008-03-05 15:00 EST by Jan Kratochvil
Modified: 2008-03-17 17:13 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-03-08 15:23:00 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
GDB workaround created by an ashaming mistake. (2.01 KB, patch)
2008-03-05 15:03 EST, Jan Kratochvil
no flags Details | Diff

  None (edit)
Description Jan Kratochvil 2008-03-05 15:00:57 EST
Description of problem:
GDB testsuite failure for x86_64 debugger running i386 debuggee.

Version-Release number of selected component (if applicable):
kernel-2.6.25-0.88.rc3.git4.fc9.x86_64 (Rawhide)
but it is OK for: kernel-2.6.23.14-107.fc8.x86_64 (F8)

How reproducible:
Always.

Steps to Reproduce:
1. cd gdb-6.7.1/build-x86_64-redhat-linux-gnu/gdb/testsuite
2. runtest --target_board=unix/-m32 gdb.base/interrupt.exp

Actual results:
Running ../../../gdb/testsuite/gdb.base/interrupt.exp ...
FAIL: gdb.base/interrupt.exp: call function when asleep (stays asleep)
FAIL: gdb.base/interrupt.exp: call function after waking it
FAIL: gdb.base/interrupt.exp: continue
FAIL: gdb.base/interrupt.exp: send end of file

Expected results:
Running ../../../gdb/testsuite/gdb.base/interrupt.exp ...

Additional info:
The problem is that GDB sets orig_rax to 0x00000000ffffffff which gets
recognized by the upstream kernel as -1 but not by the Rawhide kernel.
It is also a regression caused by the fix of the Bug 434995.

Steps to Reproduce:
wget -O erestart-debugger.c
'http://sources.redhat.com/cgi-bin/cvsweb.cgi/~checkout~/tests/ptrace-tests/tests/erestart-debugger.c?cvsroot=systemtap';wget
-O erestart-debuggee.c
'http://sources.redhat.com/cgi-bin/cvsweb.cgi/~checkout~/tests/ptrace-tests/tests/erestart-debuggee.c?cvsroot=systemtap';gcc
-m32 -o erestart-debuggee erestart-debuggee.c -Wall -ggdb2 -D_GNU_SOURCE; gcc
-m64 -o erestart-debugger erestart-debugger.c -Wall -ggdb2 -D_GNU_SOURCE
-lutil;./erestart-debugger ;echo $?

Actual results:
1

Expected results:
0
Comment 1 Jan Kratochvil 2008-03-05 15:03:35 EST
Created attachment 296924 [details]
GDB workaround created by an ashaming mistake.
Comment 2 Jan Kratochvil 2008-03-05 15:04:16 EST
Comment on attachment 296924 [details]
GDB workaround created by an ashaming mistake.

Fixing GDB is not a solution as the ptrace-on-utrace emulation should be
backward compatible.
Comment 3 Roland McGrath 2008-03-07 18:09:41 EST
This is issue is not related to utrace.  It's just x86-64 arch stuff.

In what sense is F8 ok?  AFAICT no x86-64 kernel ever recognized (u32)-1 in
orig_rax as -1.  The botched attempt at syscall restart (i.e. ip -= 2) didn't
happen before because restoring a 32-bit -ERESTART* value was also not
recognized as its proper value (due to lack of sign extension), i.e. bug 434995.

I believe every kernel heretofore has this same problem, and it is only a kernel
with bug 434995 fixed (as rawhide now has) on which you can tell the difference.

I posted a fix upstream: http://marc.info/?l=linux-kernel&m=120493063622563&w=2

I will put it into rawhide too.
Comment 4 Jan Kratochvil 2008-03-08 02:43:59 EST
Thanks, it looks great; will rerun it on the Rawhide update when available.

You are right x86_64 kernel did not work exactly right but the behavior before 
the Bug 434995 fix behaved IMO more harmless.

Specifically it only printed (and sure aborted the syscall) one
  Unknown error 512
on
  FAIL: gdb.base/interrupt.exp: continue
while currently it hangs much earlier on:
  FAIL: gdb.base/interrupt.exp: call function when asleep (stays asleep)

before the fix:
gdb-6.7.1-15.fc9-kernel-vanilla-2.6.24.1-31.vanilla.fc8.x86_64-target-x86_64/gdb-x86_64-redhat-linux-gnu-m32.sum:
Running ../../../gdb/testsuite/gdb.base/interrupt.exp ...
PASS: gdb.base/interrupt.exp: set interrupt character in interrupt.exp
PASS: gdb.base/interrupt.exp: child process is alive
PASS: gdb.base/interrupt.exp: child process ate our char
PASS: gdb.base/interrupt.exp: send_gdb control C
PASS: gdb.base/interrupt.exp: call function when asleep
PASS: gdb.base/interrupt.exp: call function a second time
FAIL: gdb.base/interrupt.exp: continue (timeout)
FAIL: gdb.base/interrupt.exp: echo data (timeout)
PASS: gdb.base/interrupt.exp: send end of file

after the fix:
gdb-6.7.1-15.fc9-kernel-2.6.25-0.88.rc3.git4.fc9.x86_64-target-x86_64/gdb-x86_64-redhat-linux-gnu-m32.sum:
Running ../../../gdb/testsuite/gdb.base/interrupt.exp ...
PASS: gdb.base/interrupt.exp: set interrupt character in interrupt.exp
PASS: gdb.base/interrupt.exp: child process is alive
PASS: gdb.base/interrupt.exp: child process ate our char
PASS: gdb.base/interrupt.exp: send_gdb control C
FAIL: gdb.base/interrupt.exp: call function when asleep (stays asleep)
FAIL: gdb.base/interrupt.exp: call function after waking it
PASS: gdb.base/interrupt.exp: call function a second time
PASS: gdb.base/interrupt.exp: continue
PASS: gdb.base/interrupt.exp: echo data
FAIL: gdb.base/interrupt.exp: send end of file
Comment 6 Chuck Ebbert 2008-03-08 15:23:00 EST
Fixed in 2.5.25-rc4-git3
Comment 7 Jan Kratochvil 2008-03-09 01:18:16 EST
Verified as fixed on:
  kernel-2.6.25-0.101.rc4.git3.fc9.x86_64 (Rawhide)

Note You need to log in before you can comment on or make changes to this bug.