glibc/sysdeps/unix/sysv/linux/x86
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
..
bits Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
include sysconf: Add _SC_MINSIGSTKSZ/_SC_SIGSTKSZ [BZ #20305] 2021-02-01 11:00:52 -08:00
sys Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
arch-pkey.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
cpu-features.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dl-cet.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dl-minsigstacksize.h sysconf: Add _SC_MINSIGSTKSZ/_SC_SIGSTKSZ [BZ #20305] 2021-02-01 11:00:52 -08:00
dl-sysdep.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
elf-read-prop.h ldconfig/x86: Store ISA level in cache and aux cache 2021-01-13 05:51:17 -08:00
elision-conf.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
elision-conf.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
elision-lock.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
elision-timed.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
elision-trylock.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
elision-unlock.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
force-elision.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
gettimeofday.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
hle.h x86: Use RTM intrinsics in pthread mutex lock elision 2018-10-02 07:51:57 -07:00
Implies Consolidate pthreadtype.h placementConsolidate pthreadtype.h placement 2017-04-10 17:33:10 -03:00
jmp_buf-ssp.sym x86: Make a space in jmpbuf for shadow stack pointer 2017-11-30 04:58:01 -08:00
lowlevellock.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
Makefile x86/CET: Update vfork to prevent child return 2020-10-15 04:00:36 -07:00
pkey_get.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
pkey_set.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
pthread_mutex_cond_lock.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
pthread_mutex_lock.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
pthread_mutex_timedlock.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
pthread_mutex_trylock.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
readelflib.c ldconfig/x86: Store ISA level in cache and aux cache 2021-01-13 05:51:17 -08:00
setjmpP.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sysconf.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
time.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
tst-cet-property-1.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
tst-cet-property-2.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
tst-cet-property-dep-2.S Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
tst-cet-setcontext-1.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
tst-cet-vfork-1.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
tst-saved_mask-1.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
xstatver.h Remove mknod wrapper functions, move them to symbols 2020-10-09 17:02:06 -03:00