linux/arch/m68k/kernel
Finn Thain 0845660508 m68k: Move signal frame following exception on 68020/030
commit b845b574f8 upstream.

On 68030/020, an instruction such as, moveml %a2-%a3/%a5,%sp@- may cause
a stack page fault during instruction execution (i.e. not at an
instruction boundary) and produce a format 0xB exception frame.

In this situation, the value of USP will be unreliable.  If a signal is
to be delivered following the exception, this USP value is used to
calculate the location for a signal frame.  This can result in a
corrupted user stack.

The corruption was detected in dash (actually in glibc) where it showed
up as an intermittent "stack smashing detected" message and crash
following signal delivery for SIGCHLD.

It was hard to reproduce that failure because delivery of the signal
raced with the page fault and because the kernel places an unpredictable
gap of up to 7 bytes between the USP and the signal frame.

A format 0xB exception frame can be produced by a bus error or an
address error.  The 68030 Users Manual says that address errors occur
immediately upon detection during instruction prefetch.  The instruction
pipeline allows prefetch to overlap with other instructions, which means
an address error can arise during the execution of a different
instruction.  So it seems likely that this patch may help in the address
error case also.

Reported-and-tested-by: Stan Johnson <userm57@yahoo.com>
Link: https://lore.kernel.org/all/CAMuHMdW3yD22_ApemzW_6me3adq6A458u1_F0v-1EYwK_62jPA@mail.gmail.com/
Cc: Michael Schmitz <schmitzmic@gmail.com>
Cc: Andreas Schwab <schwab@linux-m68k.org>
Cc: stable@vger.kernel.org
Co-developed-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Finn Thain <fthain@linux-m68k.org>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/r/9e66262a754fcba50208aa424188896cc52a1dd1.1683365892.git.fthain@linux-m68k.org
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-30 14:03:18 +01:00
..
syscalls arch: syscalls: simplify uapi/kapi directory creation 2022-03-31 12:03:46 +09:00
.gitignore
asm-offsets.c m68k: Remove set_fs() 2021-09-24 13:35:07 +02:00
bootinfo_proc.c
dma.c m68k: dma: Remove unnecessary include of asm/cacheflush.h 2021-05-10 11:47:00 +02:00
early_printk.c
entry.S m68k: Check syscall_trace_enter() return code 2023-03-10 09:33:51 +01:00
head.S m68k: Introduce a virtual m68k machine 2022-04-11 11:48:01 +02:00
ints.c
irq.c
machine_kexec.c
Makefile kbuild: use obj-y instead extra-y for objects placed at the head 2022-10-02 18:04:05 +09:00
module.c
pcibios.c
process.c This set of changes updates init and user mode helper tasks to be 2022-06-03 16:03:05 -07:00
ptrace.c m68knommu: changes for linux 5.19 2022-05-30 10:56:18 -07:00
relocate_kernel.S
setup_mm.c m68k: mm: Move initrd phys_to_virt handling after paging_init() 2023-03-17 08:50:26 +01:00
setup_no.c More power management updates for 5.19-rc1 2022-05-30 11:37:26 -07:00
setup.c
signal.c m68k: Move signal frame following exception on 68020/030 2023-05-30 14:03:18 +01:00
sun3-head.S
sys_m68k.c arch/m68k/kernel/sys_m68k: use vma_lookup() in sys_cacheflush() 2021-06-29 10:53:51 -07:00
syscalltable.S m68k: syscalls: switch to generic syscalltbl.sh 2021-04-06 09:33:20 +02:00
time.c m68knommu: fix undefined reference to `mach_get_rtc_pll' 2022-05-25 00:03:58 +10:00
traps.c m68k: Only force 030 bus error if PC not in exception table 2023-03-30 12:49:17 +02:00
uboot.c
vectors.c
vmlinux-nommu.lds
vmlinux-std.lds
vmlinux-sun3.lds
vmlinux.lds.S