x86/signal: Detect and prevent an alternate signal stack overflow
Chang S. Bae authored
[ Upstream commit 2beb4a53 ]

The kernel pushes context on to the userspace stack to prepare for the
user's signal handler. When the user has supplied an alternate signal
stack, via sigaltstack(2), it is easy for the kernel to verify that the
stack size is sufficient for the current hardware context.

Check if writing the hardware context to the alternate stack will exceed
it's size. If yes, then instead of corrupting user-data and proceeding with
the original signal handler, an immediate SIGSEGV signal is delivered.

Refactor the stack pointer check code from on_sig_stack() and use the new
helper.

While the kernel allows new source code to discover and use a sufficient
alternate signal stack size, this check is still necessary to protect
binaries with insufficient alternate signal stack size from data
corruption.

Fixes: c2bc11f1 ("x86, AVX-512: Enable AVX-512 States Context Switch")
Reported-by: Floria...
afb04d0b
Name Last commit Last update
..
acpi Merge branches 'acpi-cppc', 'acpi-video' and 'acpi-utils'
asm-generic mm: define default MAX_PTRS_PER_* in include/pgtable.h
clocksource clocksource/drivers/timer-ti-dm: Save and restore timer TIOCP_CFG
crypto crypto: shash - avoid comparing pointers to exported functions under CFI
drm Merge drm/drm-fixes into drm-next
dt-bindings clk: imx8mq: remove SYS PLL 1/2 clock gates
keys Merge tag 'integrity-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity
kunit kunit: fix -Wunused-function warning for __kunit_fail_current_test
kvm Merge branch 'kvm-arm64/kill_oprofile_dependency' into kvmarm-master/next
linux x86/signal: Detect and prevent an alternate signal stack overflow
math-emu treewide: Use fallthrough pseudo-keyword
media media: subdev: disallow ioctl for saa6588/davinci
memory memory: renesas-rpc-if: Make rpcif_enable/disable_rpm() as static inline
misc ocxl: Update the Process Element Entry
net sctp: validate from_addr_param return
pcmcia pcmcia: Replace zero-length array with flexible-array
ras mm,hwpoison: introduce MF_MSG_UNSPLIT_THP
rdma RDMA/restrack: Add support to get resource tracking for SRQ
scsi scsi: iscsi: Fix conn use after free during resets
soc Merge tag 'net-next-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
sound Merge tag 'asoc-fix-v5.13-rc3' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
target scsi: target: core: Make completion affinity configurable
trace Merge tag 'nfs-for-5.13-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
uapi virtiofs: propagate sync() to file server
vdso time64.h: Consolidated PSEC_PER_SEC definition
video
xen