linux_dsm_epyc7002/arch/s390/kernel
Martin Schwidefsky 20b40a794b [S390] signal race with restarting system calls
For a ERESTARTNOHAND/ERESTARTSYS/ERESTARTNOINTR restarting system call
do_signal will prepare the restart of the system call with a rewind of
the PSW before calling get_signal_to_deliver (where the debugger might
take control). For A ERESTART_RESTARTBLOCK restarting system call
do_signal will set -EINTR as return code.
There are two issues with this approach:
1) strace never sees ERESTARTNOHAND, ERESTARTSYS, ERESTARTNOINTR or
   ERESTART_RESTARTBLOCK as the rewinding already took place or the
   return code has been changed to -EINTR
2) if get_signal_to_deliver does not return with a signal to deliver
   the restart via the repeat of the svc instruction is left in place.
   This opens a race if another signal is made pending before the
   system call instruction can be reexecuted. The original system call
   will be restarted even if the second signal would have ended the
   system call with -EINTR.

These two issues can be solved by dropping the early rewind of the
system call before get_signal_to_deliver has been called and by using
the TIF_RESTART_SVC magic to do the restart if no signal has to be
delivered. The only situation where the system call restart via the
repeat of the svc instruction is appropriate is when a SA_RESTART
signal is delivered to user space.

Unfortunately this breaks inferior calls by the debugger again. The
system call number and the length of the system call instruction is
lost over the inferior call and user space will see ERESTARTNOHAND/
ERESTARTSYS/ERESTARTNOINTR/ERESTART_RESTARTBLOCK. To correct this a
new ptrace interface is added to save/restore the system call number
and system call instruction length.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2011-10-30 15:16:43 +01:00
..
vdso32 [S390] vdso: disable gcov profiling 2011-05-23 10:24:29 +02:00
vdso64 [S390] vdso: disable gcov profiling 2011-05-23 10:24:29 +02:00
asm-offsets.c [S390] signal race with restarting system calls 2011-10-30 15:16:43 +01:00
audit.c [S390] Get rid of a bunch of sparse warnings again. 2007-10-12 16:13:06 +02:00
audit.h [S390] Get rid of a bunch of sparse warnings again. 2007-10-12 16:13:06 +02:00
base.S [S390] kdump backend code 2011-10-30 15:16:42 +01:00
bitmap.c [S390] move EXPORT_SYMBOLs to definitions 2009-03-26 15:24:11 +01:00
compat_audit.c [S390] Get rid of a bunch of sparse warnings again. 2007-10-12 16:13:06 +02:00
compat_exec_domain.c [S390] Get rid of a lot of sparse warnings. 2007-02-05 21:16:47 +01:00
compat_linux.c BKL: remove extraneous #include <smp_lock.h> 2010-11-17 08:59:32 -08:00
compat_linux.h Mark arguments to certain syscalls as being const 2010-08-13 16:53:13 -07:00
compat_ptrace.h [S390] ptrace cleanup 2011-01-05 12:47:31 +01:00
compat_signal.c [S390] signal race with restarting system calls 2011-10-30 15:16:43 +01:00
compat_wrapper.S [S390] use ENTRY macro for sys_setns_wrapper 2011-10-30 15:16:16 +01:00
cpcmd.c [S390] convert cpcmd printks to pr_xxx macros. 2008-12-25 13:39:19 +01:00
crash_dump.c [S390] kdump backend code 2011-10-30 15:16:42 +01:00
crash.c [S390] Get rid of a lot of sparse warnings. 2007-02-05 21:16:47 +01:00
debug.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
diag.c [S390] replace diag10() with diag10_range() function 2011-05-10 17:13:43 +02:00
dis.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
early.c [S390] nss,initrd: kernel image and initrd must be in different segments 2011-08-24 17:15:23 +02:00
ebcdic.c [S390] Get rid of a lot of sparse warnings. 2007-02-05 21:16:47 +01:00
entry64.S [S390] signal race with restarting system calls 2011-10-30 15:16:43 +01:00
entry.h [S390] cleanup program check handler prototypes 2011-07-24 10:48:21 +02:00
entry.S [S390] signal race with restarting system calls 2011-10-30 15:16:43 +01:00
ftrace.c [S390] cleanup ftrace backend functions 2011-01-05 12:47:31 +01:00
head31.S [S390] iucv cr0 enablement bit 2011-07-24 10:48:22 +02:00
head64.S [S390] initial cr0 bits 2011-07-24 10:48:22 +02:00
head_kdump.S [S390] kdump backend code 2011-10-30 15:16:42 +01:00
head.S [S390] kdump backend code 2011-10-30 15:16:42 +01:00
init_task.c Use new __init_task_data macro in arch init_task.c files. 2009-09-21 06:27:08 +02:00
ipl.c [S390] kdump backend code 2011-10-30 15:16:42 +01:00
irq.c [S390] fix mismatch in summation of I/O IRQ statistics 2011-10-30 15:16:15 +01:00
jump_label.c jump label: Add s390 support 2011-04-04 13:43:16 -04:00
kprobes.c [S390] ptrace cleanup 2011-01-05 12:47:31 +01:00
machine_kexec.c [S390] Add architecture code for unmapping crashkernel memory 2011-10-30 15:16:42 +01:00
Makefile [S390] kdump backend code 2011-10-30 15:16:42 +01:00
mcount64.S [S390] fix s390 assembler code alignments 2011-07-24 10:48:21 +02:00
mcount.S [S390] fix s390 assembler code alignments 2011-07-24 10:48:21 +02:00
mem_detect.c [S390] kdump backend code 2011-10-30 15:16:42 +01:00
module.c modules: make arch's use default loader hooks 2011-07-24 22:06:04 +09:30
nmi.c [S390] irq: have detailed statistics for interrupt types 2011-01-05 12:47:25 +01:00
process.c [S390] Remove unused includes in process.c 2011-05-23 10:24:32 +02:00
processor.c [S390] avoid warning in show_cpuinfo 2011-10-30 15:16:15 +01:00
ptrace.c [S390] signal race with restarting system calls 2011-10-30 15:16:43 +01:00
reipl64.S [S390] lowcore cleanup 2011-10-30 15:16:42 +01:00
reipl.S [S390] kdump backend code 2011-10-30 15:16:42 +01:00
relocate_kernel64.S [S390] fix s390 assembler code alignments 2011-07-24 10:48:21 +02:00
relocate_kernel.S [S390] fix s390 assembler code alignments 2011-07-24 10:48:21 +02:00
s390_ksyms.c [S390] move sie code to entry.S 2011-07-24 10:48:21 +02:00
sclp.S [S390] fix s390 assembler code alignments 2011-07-24 10:48:21 +02:00
setup.c [S390] Add architecture code for unmapping crashkernel memory 2011-10-30 15:16:42 +01:00
signal.c [S390] signal race with restarting system calls 2011-10-30 15:16:43 +01:00
smp.c [S390] kdump backend code 2011-10-30 15:16:42 +01:00
stacktrace.c [S390] Fix stacktrace compile bug. 2008-07-17 17:22:09 +02:00
suspend.c PM / Hibernate: Include storage keys in hibernation image on s390 2011-10-16 23:27:46 +02:00
switch_cpu64.S [S390] fix s390 assembler code alignments 2011-07-24 10:48:21 +02:00
switch_cpu.S [S390] fix s390 assembler code alignments 2011-07-24 10:48:21 +02:00
swsusp_asm64.S PM / Hibernate: Include storage keys in hibernation image on s390 2011-10-16 23:27:46 +02:00
sys_s390.c [S390] sys_personality: follow u_long to unsigned int conversion 2010-08-13 10:06:54 +02:00
syscalls.S All Arch: remove linkage for sys_nfsservctl system call 2011-08-26 15:09:58 -07:00
sysinfo.c [S390] topology: add SCHED_MC config option 2010-10-29 16:50:49 +02:00
time.c time, s390: Get rid of compile warning 2011-10-12 10:24:10 +02:00
topology.c [S390] topology: fix alloc_masks annotation 2011-10-30 15:16:15 +01:00
traps.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
vdso.c mm: arch: rename in_gate_area_no_task to in_gate_area_no_mm 2011-03-23 16:36:55 -04:00
vmlinux.lds.S percpu: Always align percpu output section to PAGE_SIZE 2011-03-24 18:50:09 +01:00
vtime.c [S390] irq: merge irq.c and s390_ext.c 2011-05-26 09:48:24 +02:00