Interrupted system call handling

Bug #615974 reported by Ulrich Weigand
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Linaro GDB
Fix Released
Medium
Ulrich Weigand
Linaro Linux
Fix Released
Medium
Arnd Bergmann

Bug Description

GDB does not handle debugging during interrupted system calls correctly.

Related testsuite failured include:
FAIL: gdb.base/interrupt.exp: continue
FAIL: gdb.base/interrupt.exp: echo data
FAIL: gdb.base/interrupt.exp: Send Control-C, second time
FAIL: gdb.base/interrupt.exp: signal SIGINT (the program is no longer running)
FAIL: gdb.base/interrupt.exp: echo more data (timeout)
FAIL: gdb.base/interrupt.exp: send end of file

Fixing this will likely involve kernel changes as well. It seems the kernel in some cases returns to userspace with a -512 ERESTARTSYS return value -- this should never happen.

Tags: testsuite
Revision history for this message
Ulrich Weigand (uweigand) wrote :

This problem also causes failures in gdb.threads/hand-call-in-threads.exp:

FAIL: gdb.threads/hand-call-in-threads.exp: hand call, thread 2
FAIL: gdb.threads/hand-call-in-threads.exp: hand call, thread 3
FAIL: gdb.threads/hand-call-in-threads.exp: hand call, thread 4
FAIL: gdb.threads/hand-call-in-threads.exp: hand call, thread 5

call hand_call()^M
^M
Program received signal SIGSEGV, Segmentation fault.^M
0x00000000 in ?? ()^M

Changed in gdb-linaro:
status: New → Confirmed
Revision history for this message
Ulrich Weigand (uweigand) wrote :

The underlying problem is a kernel issue. If we have a ptrace intercept in an interrupted system call, and GDB changes the PC in order to effect an inferior call, the kernel's do_signal routine still thinks it needs to decrement the PC in order to restart the system call. This causes execution to continue at the wrong address.

This problem was fixed in various platform specific do_signal routines over the years, but apparently not yet on ARM.

Loïc Minier (lool)
affects: gdb-linaro → linux-linaro
Changed in linux-linaro:
importance: Undecided → Medium
Revision history for this message
Loïc Minier (lool) wrote :

Arnd, Ulrich told me you'd be looking into this

Changed in linux-linaro:
assignee: nobody → Arnd Bergmann (arnd-arndb)
Revision history for this message
Ulrich Weigand (uweigand) wrote :

Re-added gdb-linaro since this affects GDB, and a solution might also require GDB changes in addition to kernel changes.

Changed in gdb-linaro:
status: New → Confirmed
assignee: nobody → Ulrich Weigand (uweigand)
Changed in gdb-linaro:
importance: Undecided → Medium
tags: added: testsuite
Revision history for this message
Arnd Bergmann (arnd-arndb) wrote :

Ulrich tells me offline that he has an experimental patch for this. Uli, please attach the patch so I can review and/or forward it.

Revision history for this message
Ulrich Weigand (uweigand) wrote :

Linux kernel patch that fixes the problem for me.
See patch for detailed description of the problem and proposed solution.

Changed in gdb-linaro:
status: Confirmed → In Progress
Revision history for this message
Ulrich Weigand (uweigand) wrote :

Kernel patch posted to linux-arm-kernel.

Changed in linux-linaro:
status: Confirmed → In Progress
Revision history for this message
Deepak Saxena (dsaxena-linaro) wrote :

Hi Ulrich, was this patch accepted upstream and has it been posted to Nicolas for inclusion in the Linaro kernel?

Revision history for this message
Nicolas Pitre (npitre) wrote : Re: [Bug 615974] Re: Interrupted system call handling

> Hi Ulrich, was this patch accepted upstream and has it been posted to
> Nicolas for inclusion in the Linaro kernel?

It is in the Linaro kernel. It is not in mainline yet.
Someone should put it in RMK's patch system.

Revision history for this message
Ulrich Weigand (uweigand) wrote :

> Someone should put it in RMK's patch system.

Arnd put it in a couple of days ago:
http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=6892/1

Revision history for this message
Ulrich Weigand (uweigand) wrote :

Since with this solution, there is no GDB change required, I'm setting the Linaro GDB project status to Invalid.

Changed in gdb-linaro:
status: In Progress → Invalid
Changed in gdb-linaro:
status: Invalid → Fix Released
Changed in linux-linaro:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.