0001 .. SPDX-License-Identifier: GPL-2.0
0002
0003 ==================================
0004 x86-specific ELF Auxiliary Vectors
0005 ==================================
0006
0007 This document describes the semantics of the x86 auxiliary vectors.
0008
0009 Introduction
0010 ============
0011
0012 ELF Auxiliary vectors enable the kernel to efficiently provide
0013 configuration-specific parameters to userspace. In this example, a program
0014 allocates an alternate stack based on the kernel-provided size::
0015
0016 #include <sys/auxv.h>
0017 #include <elf.h>
0018 #include <signal.h>
0019 #include <stdlib.h>
0020 #include <assert.h>
0021 #include <err.h>
0022
0023 #ifndef AT_MINSIGSTKSZ
0024 #define AT_MINSIGSTKSZ 51
0025 #endif
0026
0027 ....
0028 stack_t ss;
0029
0030 ss.ss_sp = malloc(ss.ss_size);
0031 assert(ss.ss_sp);
0032
0033 ss.ss_size = getauxval(AT_MINSIGSTKSZ) + SIGSTKSZ;
0034 ss.ss_flags = 0;
0035
0036 if (sigaltstack(&ss, NULL))
0037 err(1, "sigaltstack");
0038
0039
0040 The exposed auxiliary vectors
0041 =============================
0042
0043 AT_SYSINFO is used for locating the vsyscall entry point. It is not
0044 exported on 64-bit mode.
0045
0046 AT_SYSINFO_EHDR is the start address of the page containing the vDSO.
0047
0048 AT_MINSIGSTKSZ denotes the minimum stack size required by the kernel to
0049 deliver a signal to user-space. AT_MINSIGSTKSZ comprehends the space
0050 consumed by the kernel to accommodate the user context for the current
0051 hardware configuration. It does not comprehend subsequent user-space stack
0052 consumption, which must be added by the user. (e.g. Above, user-space adds
0053 SIGSTKSZ to AT_MINSIGSTKSZ.)