Go to file
Thomas Gleixner 815976f881 signal: Add an optional check for altstack size
commit 1bdda24c4a upstream.

New x86 FPU features will be very large, requiring ~10k of stack in
signal handlers.  These new features require a new approach called
"dynamic features".

The kernel currently tries to ensure that altstacks are reasonably
sized. Right now, on x86, sys_sigaltstack() requires a size of >=2k.
However, that 2k is a constant. Simply raising that 2k requirement
to >10k for the new features would break existing apps which have a
compiled-in size of 2k.

Instead of universally enforcing a larger stack, prohibit a process from
using dynamic features without properly-sized altstacks. This must be
enforced in two places:

 * A dynamic feature can not be enabled without an large-enough altstack
   for each process thread.
 * Once a dynamic feature is enabled, any request to install a too-small
   altstack will be rejected

The dynamic feature enabling code must examine each thread in a
process to ensure that the altstacks are large enough. Add a new lock
(sigaltstack_lock()) to ensure that threads can not race and change
their altstack after being examined.

Add the infrastructure in form of a config option and provide empty
stubs for architectures which do not need dynamic altstack size checks.

This implementation will be fleshed out for x86 in a future patch called

  x86/arch_prctl: Add controls for dynamic XSTATE components

  [dhansen: commit message. ]

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-2-chang.seok.bae@intel.com
Signed-off-by: Chen Zhuo <sagazchen@tencent.com>
Signed-off-by: Xinghui Li <korantli@tencent.com>
2024-06-11 21:10:14 +08:00
Documentation x86/elf: Support a new ELF aux vector AT_MINSIGSTKSZ 2024-06-11 21:09:36 +08:00
LICENSES LICENSES: Rename other to deprecated 2019-05-03 06:34:32 -06:00
arch signal: Add an optional check for altstack size 2024-06-11 21:10:14 +08:00
block ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
certs ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
crypto ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
dist ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
drivers dmaengine: idxd: fix resource leak on dmaengine driver disable 2024-06-11 21:09:35 +08:00
fs introduction of regset ->get() wrappers, switching ELF coredumps to those 2024-06-11 21:05:54 +08:00
include signal: Add an optional check for altstack size 2024-06-11 21:10:14 +08:00
init ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
ipc ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
kernel signal: Add an optional check for altstack size 2024-06-11 21:10:14 +08:00
lib ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
mm x86/cpufeatures: Force disable X86_FEATURE_ENQCMD and remove update_pasid() 2024-06-11 21:05:59 +08:00
net ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
package ice: update E810 100g nic driver 2024-06-11 21:05:23 +08:00
samples ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
scripts x86/extable: Rework the exception table mechanics 2024-06-11 21:09:40 +08:00
security ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
sound ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
tools selftest/x86/signal: Include test cases for validating sigaltstack 2024-06-11 21:09:37 +08:00
usr tkernel: add base tlinux kernel interfaces 2024-06-11 20:09:33 +08:00
virt KVM: SVM: avoid infinite loop on NPF from bad address 2024-06-11 21:05:42 +08:00
.clang-format clang-format: Update with the latest for_each macro list 2019-08-31 10:00:51 +02:00
.cocciconfig
.get_maintainer.ignore Opt out of scripts/get_maintainer.pl 2019-05-16 10:53:40 -07:00
.gitattributes ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
.gitignore ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
COPYING COPYING: use the new text with points to the license files 2018-03-23 12:41:45 -06:00
CREDITS MAINTAINERS: Remove Simon as Renesas SoC Co-Maintainer 2019-10-10 08:12:51 -07:00
Kbuild kbuild: do not descend to ./Kbuild when cleaning 2019-08-21 21:03:58 +09:00
Kconfig docs: kbuild: convert docs to ReST and rename to *.rst 2019-06-14 14:21:21 -06:00
MAINTAINERS dmaengine: idxd: Init and probe for Intel data accelerators 2024-06-11 21:08:31 +08:00
Makefile ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
README Drop all 00-INDEX files from Documentation/ 2018-09-09 15:08:58 -06:00
README.md tkernel: add base tlinux kernel interfaces 2024-06-11 20:09:33 +08:00
backport_remove_lists.txt tkernel: add base tlinux kernel interfaces 2024-06-11 20:09:33 +08:00
tools_key.pub tkernel: add base tlinux kernel interfaces 2024-06-11 20:09:33 +08:00

README.md

Tencent Linux Kernel 4.0