linux-brain/include/linux/sched
Chang S. Bae 00fcd8f33e x86/signal: Detect and prevent an alternate signal stack overflow
[ Upstream commit 2beb4a53fc3f1081cedc1c1a198c7f56cc4fc60c ]

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>
2021-07-20 16:10:49 +02:00
..
autogroup.h
clock.h
coredump.h mm, oom_adj: don't loop through tasks in __set_oom_adj when not necessary 2020-10-29 09:57:45 +01:00
cpufreq.h cpufreq: Avoid leaving stale IRQ work items during CPU offline 2019-12-31 16:46:06 +01:00
cputime.h posix-cpu-timers: Move state tracking to struct posix_cputimers 2019-08-28 11:50:42 +02:00
deadline.h cpusets: Rebuild root domain deadline accounting information 2019-07-25 15:55:01 +02:00
debug.h
hotplug.h
idle.h
init.h
isolation.h KVM: LAPIC: Inject timer interrupt via posted interrupt 2019-07-20 09:00:40 +02:00
jobctl.h
loadavg.h
mm.h include/linux/sched/mm.h: use rcu_dereference in in_vfork() 2021-03-17 17:03:56 +01:00
nohz.h timers/nohz: Update NOHZ load in remote tick 2020-03-05 16:43:36 +01:00
numa_balancing.h sched/fair: Don't free p->numa_faults with concurrent readers 2019-07-25 15:37:04 +02:00
prio.h
rt.h
signal.h x86/signal: Detect and prevent an alternate signal stack overflow 2021-07-20 16:10:49 +02:00
smt.h
stat.h
sysctl.h sched/uclamp: Add system default clamps 2019-06-24 19:23:45 +02:00
task.h tasks, sched/core: With a grace period after finish_task_switch(), remove unnecessary code 2019-09-25 17:42:29 +02:00
task_stack.h
topology.h sched/topology: Add partition_sched_domains_locked() 2019-07-25 15:51:57 +02:00
types.h posix-cpu-timers: Provide array based access to expiry cache 2019-08-28 11:50:35 +02:00
user.h keys: Move the user and user-session keyrings to the user_namespace 2019-06-26 21:02:32 +01:00
wake_q.h
xacct.h