x86/elf: Support a new ELF aux vector AT_MINSIGSTKSZ
authorChang S. Bae <chang.seok.bae@intel.com>
Tue, 18 May 2021 20:03:17 +0000 (13:03 -0700)
committerBorislav Petkov <bp@suse.de>
Wed, 19 May 2021 10:18:45 +0000 (12:18 +0200)
commit1c33bb0507508af24fd754dd7123bd8e997fab2f
tree0a245b44e47ae22c57669af809f34ff1d9549314
parent939ef713297df2cc910592305aa26af0e87f28ac
x86/elf: Support a new ELF aux vector AT_MINSIGSTKSZ

Historically, signal.h defines MINSIGSTKSZ (2KB) and SIGSTKSZ (8KB), for
use by all architectures with sigaltstack(2). Over time, the hardware state
size grew, but these constants did not evolve. Today, literal use of these
constants on several architectures may result in signal stack overflow, and
thus user data corruption.

A few years ago, the ARM team addressed this issue by establishing
getauxval(AT_MINSIGSTKSZ). This enables the kernel to supply a value
at runtime that is an appropriate replacement on current and future
hardware.

Add getauxval(AT_MINSIGSTKSZ) support to x86, analogous to the support
added for ARM in

  94b07c1f8c39 ("arm64: signal: Report signal frame size to userspace via auxv").

Also, include a documentation to describe x86-specific auxiliary vectors.

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-4-chang.seok.bae@intel.com
Documentation/x86/elf_auxvec.rst [new file with mode: 0644]
Documentation/x86/index.rst
arch/x86/include/asm/elf.h
arch/x86/include/uapi/asm/auxvec.h
arch/x86/kernel/signal.c