glibc/sysdeps
H.J. Lu 6c57d32048 sysconf: Add _SC_MINSIGSTKSZ/_SC_SIGSTKSZ [BZ #20305]
Add _SC_MINSIGSTKSZ for the minimum signal stack size derived from
AT_MINSIGSTKSZ, which is the minimum number of bytes of free stack
space required in order to gurantee successful, non-nested handling
of a single signal whose handler is an empty function, and _SC_SIGSTKSZ
which is the suggested minimum number of bytes of stack space required
for a signal stack.

If AT_MINSIGSTKSZ isn't available, sysconf (_SC_MINSIGSTKSZ) returns
MINSIGSTKSZ.  On Linux/x86 with XSAVE, the signal frame used by kernel
is composed of the following areas and laid out as:

 ------------------------------
 | alignment padding          |
 ------------------------------
 | xsave buffer               |
 ------------------------------
 | fsave header (32-bit only) |
 ------------------------------
 | siginfo + ucontext         |
 ------------------------------

Compute AT_MINSIGSTKSZ value as size of xsave buffer + size of fsave
header (32-bit only) + size of siginfo and ucontext + alignment padding.

If _SC_SIGSTKSZ_SOURCE or _GNU_SOURCE are defined, MINSIGSTKSZ and SIGSTKSZ
are redefined as

/* Default stack size for a signal handler: sysconf (SC_SIGSTKSZ).  */
 # undef SIGSTKSZ
 # define SIGSTKSZ sysconf (_SC_SIGSTKSZ)

/* Minimum stack size for a signal handler: SIGSTKSZ.  */
 # undef MINSIGSTKSZ
 # define MINSIGSTKSZ SIGSTKSZ

Compilation will fail if the source assumes constant MINSIGSTKSZ or
SIGSTKSZ.

The reason for not simply increasing the kernel's MINSIGSTKSZ #define
(apart from the fact that it is rarely used, due to glibc's shadowing
definitions) was that userspace binaries will have baked in the old
value of the constant and may be making assumptions about it.

For example, the type (char [MINSIGSTKSZ]) changes if this #define
changes.  This could be a problem if an newly built library tries to
memcpy() or dump such an object defined by and old binary.
Bounds-checking and the stack sizes passed to things like sigaltstack()
and makecontext() could similarly go wrong.
2021-02-01 11:00:52 -08:00
..
aarch64 aarch64: Fix the list of tested IFUNC variants [BZ #26818] 2021-01-25 16:15:54 +00:00
alpha Update alpha libm-test-ulps 2021-01-28 14:05:14 -03:00
arc ARC: nofpu: Regenerate ulps 2021-01-17 16:39:45 -08:00
arm Update arm libm-test-ulps. 2021-01-18 20:22:51 +00:00
csky Update C-SKY libm-test-ulps 2021-01-23 19:00:00 +00:00
generic sysconf: Add _SC_MINSIGSTKSZ/_SC_SIGSTKSZ [BZ #20305] 2021-02-01 11:00:52 -08:00
gnu Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
hppa Update hppa libm-test-ulps 2021-01-18 14:23:10 +00:00
htl Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
hurd Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
i386 configure: Check for static PIE support 2021-01-21 15:54:50 +00:00
ia64 Update ia64 libm-test-ulps 2021-01-28 14:05:15 -03:00
ieee754 math: Add BZ#18980 fix back on dbl-64 cosh 2021-01-11 16:56:33 -03:00
m68k Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
mach hurd TIOCFLUSH: Cope BSD 4.1 semantic 2021-02-01 19:39:48 +01:00
microblaze Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
mips Update MIPS libm-test-ulps. 2021-01-18 21:36:00 +00:00
nios2 Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
nptl Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
posix posix: consume less entropy on tempname 2021-01-12 09:50:54 -03:00
powerpc powerpc64: Workaround sigtramp vdso return call 2021-01-28 13:57:50 -03:00
pthread Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
riscv riscv: Initialize $gp before resolving the IRELATIVE relocation 2021-01-10 21:25:16 -05:00
s390 Remove dbl-64/wordsize-64 (part 2) 2021-01-07 15:26:26 +00:00
sh sh: Update libm-tests-ulps 2021-01-28 14:05:14 -03:00
sparc Update sparc libm-test-ulps 2021-01-28 14:05:14 -03:00
unix sysconf: Add _SC_MINSIGSTKSZ/_SC_SIGSTKSZ [BZ #20305] 2021-02-01 11:00:52 -08:00
wordsize-32 Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
wordsize-64 Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
x86 sysconf: Add _SC_MINSIGSTKSZ/_SC_SIGSTKSZ [BZ #20305] 2021-02-01 11:00:52 -08:00
x86_64 configure: Check for static PIE support 2021-01-21 15:54:50 +00:00