[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#717912: libc0.1: getauxval() nonfunctional on kfreebsd



Hi.

it does work. Try i.e.

~$ LD_SHOW_AUXV=1 /bin/true
AT_PHDR:         0x400040
AT_PHENT:        56
AT_PHNUM:        9
AT_PAGESZ:       4096
AT_FLAGS:        0x0
AT_ENTRY:        0x401274
AT_BASE:         0x800604000
AT_EXECPATH:     /bin/true
AT_OSRELDATE:    900044
AT_CANARY:       0x7fffffffef96
AT_CANARYLEN:    64
AT_NCPUS:        1
AT_PAGESIZES:    0x7fffffffef7e
AT_PAGESIZESLEN: 24
AT_STACKPROT:    0x7

The AT_* constant are standardized only partially,
FreeBSD kernel knows these:

/* Values for a_type. */
#define AT_NULL         0       /* Terminates the vector. */
#define AT_IGNORE       1       /* Ignored entry. */
#define AT_EXECFD       2       /* File descriptor of program to load. */
#define AT_PHDR         3       /* Program header of program already loaded. */
#define AT_PHENT        4       /* Size of each program header entry. */
#define AT_PHNUM        5       /* Number of program header entries. */
#define AT_PAGESZ       6       /* Page size in bytes. */
#define AT_BASE         7       /* Interpreter's base address. */
#define AT_FLAGS        8       /* Flags (unused for i386). */
#define AT_ENTRY        9       /* Where interpreter should transfer control. */
#define AT_NOTELF       10      /* Program is not ELF ?? */
#define AT_UID          11      /* Real uid. */
#define AT_EUID         12      /* Effective uid. */
#define AT_GID          13      /* Real gid. */
#define AT_EGID         14      /* Effective gid. */
#define AT_EXECPATH     15      /* Path to the executable. */
#define AT_CANARY       16      /* Canary for SSP. */
#define AT_CANARYLEN    17      /* Length of the canary. */
#define AT_OSRELDATE    18      /* OSRELDATE. */
#define AT_NCPUS        19      /* Number of CPUs. */
#define AT_PAGESIZES    20      /* Pagesizes. */
#define AT_PAGESIZESLEN 21      /* Number of pagesizes. */
#define AT_TIMEKEEP     22      /* Pointer to timehands. */
#define AT_STACKPROT    23      /* Initial stack protection. */

#define AT_COUNT        24      /* Count of defined aux entry types. */


The number 23 is AT_STACKPROT, and value 7 is correct one.
The {e,}{u,g}id values are not passed from kernel (see above)
and therefore "On success, getauxval() returns the value corresponding to type. If type is not found, 0 is returned."

Unfortunately, glibc so far does not allow
to override AT_* constant lists by a sysdeps bits.

What is your use case for getauxval() ?

Petr


Reply to: