linux/arch/parisc/kernel
Helge Deller 71a71fb537 parisc: Fix syscall restarts
On parisc syscalls which are interrupted by signals sometimes failed to
restart and instead returned -ENOSYS which in the worst case lead to
userspace crashes.
A similiar problem existed on MIPS and was fixed by commit e967ef02
("MIPS: Fix restart of indirect syscalls").

On parisc the current syscall restart code assumes that all syscall
callers load the syscall number in the delay slot of the ble
instruction. That's how it is e.g. done in the unistd.h header file:
	ble 0x100(%sr2, %r0)
	ldi #syscall_nr, %r20
Because of that assumption the current code never restored %r20 before
returning to userspace.

This assumption is at least not true for code which uses the glibc
syscall() function, which instead uses this syntax:
	ble 0x100(%sr2, %r0)
	copy regX, %r20
where regX depend on how the compiler optimizes the code and register
usage.

This patch fixes this problem by adding code to analyze how the syscall
number is loaded in the delay branch and - if needed - copy the syscall
number to regX prior returning to userspace for the syscall restart.

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2015-12-21 10:16:18 +01:00
..
.gitignore
Makefile
asm-offsets.c parisc: Map kernel text and data on huge pages 2015-11-22 12:23:19 +01:00
audit.c
binfmt_elf32.c
cache.c parisc: Fix some PTE/TLB race conditions and optimize __flush_tlb_range based on timing results 2015-07-10 21:47:47 +02:00
compat_audit.c
drivers.c
entry.S parisc: Add Huge Page and HUGETLBFS support 2015-11-22 12:23:10 +01:00
firmware.c
ftrace.c
hardware.c
head.S parisc: Increase initial kernel mapping to 32MB on 64bit kernel 2015-11-22 12:22:53 +01:00
hpmc.S
inventory.c
irq.c parisc: Filter out spurious interrupts in PA-RISC irq handler 2015-09-08 15:31:16 +02:00
module.c mm: vmalloc: pass additional vm_flags to __vmalloc_node_range() 2015-02-13 21:21:42 -08:00
pa7300lc.c
pacache.S
parisc_ksyms.c
pci-dma.c parisc: use for_each_sg() 2015-06-24 17:49:40 -07:00
pci.c parisc: Remove unused pcibios_init_bus() 2015-12-12 16:07:35 +01:00
pdc_chassis.c
pdc_cons.c parisc: don't use module_init for non-modular core pdc_cons code 2015-06-16 14:12:30 -04:00
perf.c parisc64: don't use module_init for non-modular core perf code 2015-06-16 14:12:30 -04:00
perf_asm.S
perf_images.h
process.c parisc: copy_thread(): rename 'arg' argument to 'kthread_arg' 2015-04-24 13:45:55 +02:00
processor.c
ptrace.c Merge git://git.infradead.org/users/eparis/audit 2014-10-19 16:25:56 -07:00
real2.S
setup.c parisc: Add Huge Page and HUGETLBFS support 2015-11-22 12:23:10 +01:00
signal.c parisc: Fix syscall restarts 2015-12-21 10:16:18 +01:00
signal32.c
signal32.h
smp.c parisc: Remove unused function 2015-02-17 10:41:19 +01:00
stacktrace.c
sys_parisc.c parisc,metag: Fix crashes due to stack randomization on stack-grows-upwards architectures 2015-05-12 22:03:44 +02:00
sys_parisc32.c
syscall.S parisc: Use long branch to do_syscall_trace_exit 2015-11-22 12:23:02 +01:00
syscall_table.S parisc: Wire up mlock2 syscall 2015-12-12 16:07:44 +01:00
time.c parisc: Use platform_device_register_simple("rtc-generic") 2015-09-08 17:53:48 +02:00
topology.c
traps.c parisc: Initialize the fault vector earlier in the boot process. 2015-11-22 12:22:43 +01:00
unaligned.c
unwind.c
vmlinux.lds.S parisc: Map kernel text and data on huge pages 2015-11-22 12:23:19 +01:00