kernel_optimize_test/include/asm-sparc64
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
..
agp.h
apb.h
asi.h
atomic.h
auxio.h
auxvec.h
backoff.h
bbc.h
bitops.h generic: implement __fls on all 64-bit archs 2008-04-26 19:21:16 +02:00
bpp.h
bug.h
bugs.h
byteorder.h
cache.h
cacheflush.h
chafsr.h
checksum.h
chmctrl.h
cmt.h
compat_signal.h
compat.h
cpudata.h
cputime.h
current.h
dcr.h
dcu.h
delay.h
device.h
display7seg.h
div64.h
dma-mapping.h
dma.h
ebus.h
elf.h
emergency-restart.h
envctrl.h
errno.h
estate.h
fb.h
fbio.h
fcntl.h
fhc.h
floppy.h sparc64: Kill unused local ISA bus layer. 2008-04-26 21:41:23 -07:00
fpumacro.h
futex.h asm-*/futex.h should include linux/uaccess.h 2008-04-30 08:29:52 -07:00
hardirq.h
head.h
hugetlb.h hugetlbfs: common code update for s390 2008-04-28 08:58:25 -07:00
hvtramp.h
hw_irq.h
hypervisor.h
ide.h ide: remove ide_default_io_ctl() macro 2008-04-18 00:46:34 +02:00
idprom.h
intr_queue.h
io.h
ioctl.h
ioctls.h [SPARC]: Remove SunOS and Solaris binary support. 2008-04-21 15:10:15 -07:00
iommu.h [SPARC64]: NUMA device infrastructure. 2008-04-23 23:32:16 -07:00
ipcbuf.h
irq_regs.h
irq.h
irqflags.h
Kbuild [SPARC]: Remove SunOS and Solaris binary support. 2008-04-21 15:10:15 -07:00
kdebug.h
kgdb.h sparc: Add kgdb support. 2008-04-29 02:38:50 -07:00
kmap_types.h
kprobes.h
kvm.h
ldc.h
linkage.h
lmb.h
local.h
lsu.h
mc146818rtc.h
mdesc.h
mman.h [SPARC]: Remove SunOS and Solaris binary support. 2008-04-21 15:10:15 -07:00
mmu_context.h
mmu.h
mmzone.h [SPARC64]: Add NUMA support. 2008-04-23 23:32:17 -07:00
module.h
mostek.h
msgbuf.h
mutex.h
namei.h [SPARC]: Remove SunOS and Solaris binary support. 2008-04-21 15:10:15 -07:00
ns87303.h
of_device.h
of_platform.h
openprom.h
openpromio.h
oplib.h
page.h hugetlbfs: architecture header cleanup 2008-04-28 08:58:25 -07:00
param.h
parport.h
pci.h
percpu.h
perfctr.h
pgalloc.h
pgtable.h mm: introduce pte_special pte bit 2008-04-28 08:58:23 -07:00
pil.h sparc64: Kill PIL_RESERVED, unused. 2008-04-28 04:03:06 -07:00
poll.h
posix_types.h
processor.h
prom.h
psrcompat.h sparc: Fix debugger syscall restart interactions. 2008-05-11 02:07:19 -07:00
pstate.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
reboot.h
reg.h
resource.h
rtc.h
rwsem-const.h
rwsem.h
sbus.h
scatterlist.h
scratchpad.h
seccomp.h
sections.h
semaphore.h Generic semaphore implementation 2008-04-17 10:42:34 -04:00
sembuf.h
setup.h
sfafsr.h
sfp-machine.h
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
socket.h [SPARC]: Remove SunOS and Solaris binary support. 2008-04-21 15:10:15 -07:00
sockios.h
sparsemem.h [SPARC64]: Decrease SECTION_SIZE_BITS to 30. 2008-04-23 23:32:13 -07:00
spinlock_types.h
spinlock.h
spitfire.h
sstate.h
stacktrace.h
starfire.h
stat.h
statfs.h
string.h
sunbpp.h
syscalls.h
system.h sparc: Add kgdb support. 2008-04-29 02:38:50 -07:00
termbits.h
termios.h [SPARC]: Remove SunOS and Solaris binary support. 2008-04-21 15:10:15 -07:00
thread_info.h sparc: Remove old style signal frame support. 2008-04-27 02:26:36 -07:00
timer.h
timex.h
tlb.h
tlbflush.h
topology.h [SPARC64]: Add NUMA support. 2008-04-23 23:32:17 -07:00
tsb.h
ttable.h sparc: Fix debugger syscall restart interactions. 2008-05-11 02:07:19 -07:00
types.h sparc64: types: use <asm-generic/int-*.h> for the sparc64 architecture 2008-05-02 16:18:41 -07:00
uaccess.h
uctx.h
unaligned.h kernel: Move arches to use common unaligned access 2008-04-29 08:06:27 -07:00
unistd.h [SPARC]: Remove SunOS and Solaris binary support. 2008-04-21 15:10:15 -07:00
upa.h
user.h [SPARC]: Remove SunOS and Solaris binary support. 2008-04-21 15:10:15 -07:00
utrap.h
vga.h
vio.h
visasm.h
watchdog.h
xor.h