linux-stable/arch/m68k
Finn Thain f7d19a366c 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 12:44:09 +01:00
..
68000 m68k: Check syscall_trace_enter() return code 2023-03-11 16:43:55 +01:00
amiga
apollo
atari
bvme6000
coldfire m68k: Check syscall_trace_enter() return code 2023-03-11 16:43:55 +01:00
configs
emu m68k: emu: Fix invalid free in nfeth_cleanup() 2021-09-15 09:47:28 +02:00
fpsp040
hp300
ifpsp060
include m68k: use fallback for random_get_entropy() instead of zero 2022-06-22 14:11:15 +02:00
kernel m68k: Move signal frame following exception on 68020/030 2023-05-30 12:44:09 +01:00
lib
mac
math-emu
mm exit: Add and use make_task_dead. 2023-02-06 07:52:49 +01:00
mvme16x
mvme147
q40
sun3
sun3x
tools/amiga
install.sh
Kconfig
Kconfig.bus m68knommu: only set CONFIG_ISA_DMA_API for ColdFire sub-arch 2021-09-22 12:26:34 +02:00
Kconfig.cpu m68k: math-emu: Fix dependencies of math emulation support 2022-06-14 18:11:37 +02:00
Kconfig.debug
Kconfig.devices m68k: /proc/hardware should depend on PROC_FS 2023-03-11 16:43:41 +01:00
Kconfig.machine m68knommu: fix undefined reference to `_init_sp' 2022-06-14 18:11:56 +02:00
Makefile