linux/include
Chang S. Bae afb04d0b55 x86/signal: Detect and prevent an alternate signal stack overflow
[ Upstream commit 2beb4a53fc ]

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: c2bc11f10a ("x86, AVX-512: Enable AVX-512 States Context Switch")
Reported-by: Florian Weimer <fweimer@redhat.com>
Suggested-by: Jann Horn <jannh@google.com>
Suggested-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Len Brown <len.brown@intel.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20210518200320.17239-6-chang.seok.bae@intel.com
Link: https://bugzilla.kernel.org/show_bug.cgi?id=153531
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2021-07-20 16:00:27 +02:00
..
acpi Merge branches 'acpi-cppc', 'acpi-video' and 'acpi-utils' 2021-04-26 17:04:27 +02:00
asm-generic mm: define default MAX_PTRS_PER_* in include/pgtable.h 2021-07-14 17:06:38 +02:00
clocksource clocksource/drivers/timer-ti-dm: Save and restore timer TIOCP_CFG 2021-07-14 17:06:51 +02:00
crypto crypto: shash - avoid comparing pointers to exported functions under CFI 2021-07-14 17:06:26 +02:00
drm Merge drm/drm-fixes into drm-next 2021-04-13 23:15:09 +02:00
dt-bindings clk: imx8mq: remove SYS PLL 1/2 clock gates 2021-07-14 17:07:04 +02:00
keys integrity-v5.13 2021-05-01 15:32:18 -07:00
kunit kunit: fix -Wunused-function warning for __kunit_fail_current_test 2021-04-06 15:22:39 -06:00
kvm Merge branch 'kvm-arm64/kill_oprofile_dependency' into kvmarm-master/next 2021-04-22 13:41:49 +01:00
linux x86/signal: Detect and prevent an alternate signal stack overflow 2021-07-20 16:00:27 +02:00
math-emu treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
media media: subdev: disallow ioctl for saa6588/davinci 2021-07-19 10:04:53 +02:00
memory memory: renesas-rpc-if: Make rpcif_enable/disable_rpm() as static inline 2020-11-28 12:37:18 +01:00
misc ocxl: Update the Process Element Entry 2020-12-04 01:01:30 +11:00
net sctp: validate from_addr_param return 2021-07-19 10:04:46 +02:00
pcmcia pcmcia: Replace zero-length array with flexible-array 2020-05-18 10:28:31 +02:00
ras mm,hwpoison: introduce MF_MSG_UNSPLIT_THP 2020-10-16 11:11:17 -07:00
rdma RDMA/restrack: Add support to get resource tracking for SRQ 2021-04-22 10:30:27 -03:00
scsi scsi: iscsi: Fix conn use after free during resets 2021-07-20 16:00:15 +02:00
soc Networking changes for 5.13. 2021-04-29 11:57:23 -07:00
sound ASoC: Fixes for v5.13 2021-05-25 08:58:01 +02:00
target scsi: target: core: Make completion affinity configurable 2021-03-04 17:37:03 -05:00
trace NFS client updates for Linux 5.13 2021-05-07 11:23:41 -07:00
uapi virtiofs: propagate sync() to file server 2021-07-20 16:00:24 +02:00
vdso time64.h: Consolidated PSEC_PER_SEC definition 2021-04-06 16:32:17 -07:00
video video: fbdev: sstfb: Updated logging to fix set but not used warnings 2020-11-30 20:04:59 +01:00
xen xen/arm: move xen_swiotlb_detect to arm/swiotlb-xen.h 2021-05-14 15:52:05 +02:00