glibc/sysdeps/unix/sysv/linux/bits
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
..
types Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
a.out.h
dirent_ext.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dirent.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
epoll.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
errno.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
eventfd.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
fcntl-linux.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
fcntl.h
in.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
initspin.h
inotify.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
ioctl-types.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
ioctls.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
ipc-perm.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
ipc.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
local_lim.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
mman-linux.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
mman-map-flags-generic.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
mman-shared.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
mman.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
mqueue.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
msq.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
param.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
poll.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
posix_opt.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
procfs-extra.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
procfs-id.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
procfs-prregset.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
procfs.h Unify some sys/procfs.h headers. 2018-09-25 16:48:15 +00:00
ptrace-shared.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
resource.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sched.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sem.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
semaphore.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
shm.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
shmlba.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sigaction.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sigcontext.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sigevent-consts.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
siginfo-arch.h
siginfo-consts-arch.h
siginfo-consts.h Add SEGV_MTEAERR and SEGV_MTESERR from Linux 5.10. 2021-01-06 18:23:00 +00:00
signal_ext.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
signalfd.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
signum-arch.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sigstack.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sigstksz.h sysconf: Add _SC_MINSIGSTKSZ/_SC_SIGSTKSZ [BZ #20305] 2021-02-01 11:00:52 -08:00
socket_type.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
socket-constants.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
socket.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
ss_flags.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
stat.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
statfs.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
statvfs.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
statx.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
struct_stat.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
termios-baud.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
termios-c_cc.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
termios-c_cflag.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
termios-c_iflag.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
termios-c_lflag.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
termios-c_oflag.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
termios-misc.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
termios-struct.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
termios-tcflow.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
termios.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
time.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
timerfd.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
timex.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
uio_lim.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
uio-ext.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
unistd_ext.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
utsname.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
waitflags.h Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00