kernel-ark/include/asm-sparc
David S. Miller 28e6103665 sparc: Fix debugger syscall restart interactions.
So, forever, we've had this ptrace_signal_deliver implementation
which tries to handle all of the nasties that can occur when the
debugger looks at a process about to take a signal.  It's meant
to address all of these issues inside of the kernel so that the
debugger need not be mindful of such things.

Problem is, this doesn't work.

The idea was that we should do the syscall restart business first, so
that the debugger captures that state.  Otherwise, if the debugger for
example saves the child's state, makes the child execute something
else, then restores the saved state, we won't handle the syscall
restart properly because we lose the "we're in a syscall" state.

The code here worked for most cases, but if the debugger actually
passes the signal through to the child unaltered, it's possible that
we would do a syscall restart when we shouldn't have.

In particular this breaks the case of debugging a process under a gdb
which is being debugged by yet another gdb.  gdb uses sigsuspend
to wait for SIGCHLD of the inferior, but if gdb itself is being
debugged by a top-level gdb we get a ptrace_stop().  The top-level gdb
does a PTRACE_CONT with SIGCHLD to let the inferior gdb see the
signal.  But ptrace_signal_deliver() assumed the debugger would cancel
out the signal and therefore did a syscall restart, because the return
error was ERESTARTNOHAND.

Fix this by simply making ptrace_signal_deliver() a nop, and providing
a way for the debugger to control system call restarting properly:

1) Report a "in syscall" software bit in regs->{tstate,psr}.
   It is set early on in trap entry to a system call and is fully
   visible to the debugger via ptrace() and regsets.

2) Test this bit right before doing a syscall restart.  We have
   to do a final recheck right after get_signal_to_deliver() in
   case the debugger cleared the bit during ptrace_stop().

3) Clear the bit in trap return so we don't accidently try to set
   that bit in the real register.

As a result we also get a ptrace_{is,clear}_syscall() for sparc32 just
like sparc64 has.

M68K has this same exact bug, and is now the only other user of the
ptrace_signal_deliver hook.  It needs to be fixed in the same exact
way as sparc.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-11 02:07:19 -07:00
..
apc.h
asi.h
asmmacro.h
atomic.h Add cmpxchg_local to sparc, move __cmpxchg to system.h 2008-02-07 08:42:32 -08:00
auxio.h
auxvec.h
bitext.h
bitops.h forbid asm/bitops.h direct inclusion 2007-10-19 11:53:41 -07:00
bpp.h [SPARC]: Merge asm-sparc{,64}/bpp.h 2008-02-09 04:00:12 -08:00
btfixup.h
bug.h [SPARC]: Merge asm-sparc{,64}/bug.h 2008-02-09 04:00:32 -08:00
bugs.h [SPARC]: Merge asm-sparc{,64}/bugs.h 2008-02-09 04:00:37 -08:00
byteorder.h [SPARC]: Merge asm-sparc{,64}/byteorder.h 2008-02-09 04:17:28 -08:00
cache.h [SPARC]: Merge asm-sparc{,64}/cache.h 2008-02-09 04:17:37 -08:00
cacheflush.h
checksum.h
clock.h
contregs.h
cpudata.h
cputime.h
current.h [SPARC]: Merge asm-sparc{,64}/current.h 2008-02-09 04:17:54 -08:00
cypress.h
delay.h
device.h [SPARC64]: NUMA device infrastructure. 2008-04-23 23:32:16 -07:00
div64.h
dma-mapping.h
dma.h [SPARC32]: __inline__ --> inline 2007-10-27 00:17:01 -07:00
ebus.h
ecc.h
eeprom.h
elf.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6 2008-02-07 10:21:26 -08:00
emergency-restart.h
errno.h [SPARC]: Merge asm-sparc{,64}/errno.h 2008-02-09 04:18:23 -08:00
fb.h [SPARC]: Merge asm-sparc{,64}/fb.h 2008-02-09 04:18:29 -08:00
fbio.h
fcntl.h [SPARC32]: Fix build. 2007-08-04 21:17:18 -07:00
fixmap.h
floppy.h [SPARC] minor irq handler cleanups 2008-04-20 18:43:05 -04:00
futex.h
hardirq.h
head.h sparc: Add kgdb support. 2008-04-29 02:38:50 -07:00
highmem.h
hw_irq.h
ide.h ide: remove ide_default_io_ctl() macro 2008-04-18 00:46:34 +02:00
idprom.h
io-unit.h
io.h Remove dma_cache_(wback|inv|wback_inv) functions 2007-10-17 08:42:57 -07:00
ioctl.h
ioctls.h [SPARC]: Remove SunOS and Solaris binary support. 2008-04-21 15:10:15 -07:00
iommu.h
ipcbuf.h
irq_regs.h
irq.h [SPARC32]: Fix modular build of floppy driver. 2007-08-03 14:08:42 -07:00
irqflags.h [SPARC32]: Add irqflags.h to sparc32 and use it from generic code. 2007-10-13 21:53:11 -07:00
jsflash.h
Kbuild [SPARC]: Remove SunOS and Solaris binary support. 2008-04-21 15:10:15 -07:00
kdebug.h [SPARC32]: Fix sparc32 kdebug changes. 2007-05-14 03:22:08 -07:00
kgdb.h sparc: Add kgdb support. 2008-04-29 02:38:50 -07:00
kmap_types.h
kvm.h kvm: provide kvm.h for all architecture: fixes headers_install 2008-04-02 15:28:18 -07:00
linkage.h
local.h
machines.h
mbus.h
mc146818rtc.h
memreg.h
mman.h [SPARC]: Remove SunOS and Solaris binary support. 2008-04-21 15:10:15 -07:00
mmu_context.h
mmu.h
module.h
mostek.h
mpmbox.h
msgbuf.h
msi.h
mutex.h
mxcc.h
namei.h [SPARC]: Remove SunOS and Solaris binary support. 2008-04-21 15:10:15 -07:00
obio.h
of_device.h Create linux/of_platorm.h 2007-07-20 14:25:22 +10:00
of_platform.h [SPARC]: Remove of_platform_device_create 2008-02-09 03:49:58 -08:00
openprom.h
openpromio.h
oplib.h sparc32: Delete prom_stdin and prom_stdout. 2008-05-02 05:22:54 -07:00
page.h sparc32: More memory probing consolidation. 2008-05-02 05:22:53 -07:00
param.h avoid overflows in kernel/time.c 2008-02-08 09:22:39 -08:00
pbm.h
pci.h PCI: remove pci_dac_dma_... APIs 2007-07-11 16:02:11 -07:00
pcic.h
percpu.h
perfctr.h
pgalloc.h CONFIG_HIGHPTE vs. sub-page page tables. 2008-02-08 09:22:42 -08:00
pgtable.h mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
pgtsrmmu.h
pgtsun4.h
pgtsun4c.h
poll.h Consolidate asm/poll.h 2007-05-11 08:29:34 -07:00
posix_types.h asm-*/posix_types.h: scrub __GLIBC__ 2008-02-08 09:22:34 -08:00
processor.h sparc: Remove old style signal frame support. 2008-04-27 02:26:36 -07:00
prom.h [SPARC64]: NUMA device infrastructure. 2008-04-23 23:32:16 -07:00
psr.h sparc: Fix debugger syscall restart interactions. 2008-05-11 02:07:19 -07:00
ptrace.h sparc: Fix debugger syscall restart interactions. 2008-05-11 02:07:19 -07:00
reg.h
resource.h
ross.h
rtc.h
sbi.h
sbus.h [SPARC32]: Remove iommu from struct sbus_bus and use archdata like sparc64. 2007-08-10 15:52:06 -07:00
scatterlist.h Add CONFIG_DEBUG_SG sg validation 2007-10-22 21:20:03 +02:00
sections.h
semaphore.h Generic semaphore implementation 2008-04-17 10:42:34 -04:00
sembuf.h
setup.h
sfp-machine.h [MATH-EMU]: Fix underflow exception reporting. 2007-08-16 22:59:49 -07:00
shmbuf.h
shmparam.h
sigcontext.h
siginfo.h
signal.h sparc: Fix debugger syscall restart interactions. 2008-05-11 02:07:19 -07:00
smp.h sparc32: Kill smp_message_pass() and related code. 2008-04-29 01:14:10 -07:00
smpprim.h
socket.h [SPARC]: Remove SunOS and Solaris binary support. 2008-04-21 15:10:15 -07:00
sockios.h
spinlock_types.h
spinlock.h
stat.h
statfs.h
string.h
sun4paddr.h
sun4prom.h
sunbpp.h
swift.h
sysen.h
system.h sparc: Add kgdb support. 2008-04-29 02:38:50 -07:00
termbits.h [SPARC]: Support for new termios. 2007-10-17 19:38:10 -07:00
termios.h [SPARC]: Remove SunOS and Solaris binary support. 2008-04-21 15:10:15 -07:00
thread_info.h
timer.h
timex.h
tlb.h
tlbflush.h remove unused flush_tlb_pgtables 2007-10-19 11:53:34 -07:00
topology.h
traps.h
tsunami.h
turbosparc.h
types.h sparc: types: use <asm-generic/int-*.h> for the sparc architecture 2008-05-02 16:18:41 -07:00
uaccess.h aout: remove unnecessary inclusions of {asm, linux}/a.out.h 2008-02-08 09:22:30 -08:00
unaligned.h kernel: Move arches to use common unaligned access 2008-04-29 08:06:27 -07:00
unistd.h [SPARC]: Add new timerfd syscall entries. 2008-02-06 04:12:23 -08:00
user.h [SPARC]: Remove SunOS and Solaris binary support. 2008-04-21 15:10:15 -07:00
vac-ops.h
vaddrs.h
vfc_ioctls.h
vga.h
viking.h
winmacro.h
xor.h