]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
x86/signal: Implement sigaltstack size validation
authorThomas Gleixner <tglx@linutronix.de>
Thu, 21 Oct 2021 22:55:06 +0000 (15:55 -0700)
committerStefan Bader <stefan.bader@canonical.com>
Thu, 5 May 2022 07:14:17 +0000 (09:14 +0200)
commit90ad1e89b7a600c8233e8f339e98246d3625626a
tree3581bd3a2e4b228ec4cfcd4ebc646062a5e0f75e
parent2256cacf85008feb2ec64ff3eb4d213c70e488e2
x86/signal: Implement sigaltstack size validation

BugLink: https://bugs.launchpad.net/bugs/1967750
For historical reasons MINSIGSTKSZ is a constant which became already too
small with AVX512 support.

Add a mechanism to enforce strict checking of the sigaltstack size against
the real size of the FPU frame.

The strict check can be enabled via a config option and can also be
controlled via the kernel command line option 'strict_sas_size' independent
of the config switch.

Enabling it might break existing applications which allocate a too small
sigaltstack but 'work' because they never get a signal delivered. Though it
can be handy to filter out binaries which are not yet aware of
AT_MINSIGSTKSZ.

Also the upcoming support for dynamically enabled FPU features requires a
strict sanity check to ensure that:

   - Enabling of a dynamic feature, which changes the sigframe size fits
     into an enabled sigaltstack

   - Installing a too small sigaltstack after a dynamic feature has been
     added is not possible.

Implement the base check which is controlled by config and command line
options.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20211021225527.10184-3-chang.seok.bae@intel.com
(cherry picked from commit 3aac3ebea08f2d342364f827c8979ab0e1dd591e)
Acked-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Documentation/admin-guide/kernel-parameters.txt
arch/x86/Kconfig
arch/x86/kernel/signal.c