Add AT_BSDFLAGS support to _elf_aux_info(3).

Tested by:	pho
Disscussed with:	cem, emaste, jilles
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D12773
This commit is contained in:
Konstantin Belousov 2020-02-09 12:12:03 +00:00
parent 944cf37bb5
commit a1fd89b45f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357696

View file

@ -67,7 +67,7 @@ __init_elf_aux_vector(void)
}
static pthread_once_t aux_once = PTHREAD_ONCE_INIT;
static int pagesize, osreldate, canary_len, ncpus, pagesizes_len;
static int pagesize, osreldate, canary_len, ncpus, pagesizes_len, bsdflags;
static int hwcap_present, hwcap2_present;
static char *canary, *pagesizes, *execpath;
static void *timekeep;
@ -86,6 +86,10 @@ init_aux(void)
for (aux = __elf_aux_vector; aux->a_type != AT_NULL; aux++) {
switch (aux->a_type) {
case AT_BSDFLAGS:
bsdflags = aux->a_un.a_val;
break;
case AT_CANARY:
canary = (char *)(aux->a_un.a_ptr);
break;
@ -326,6 +330,13 @@ _elf_aux_info(int aux, void *buf, int buflen)
} else
res = EINVAL;
break;
case AT_BSDFLAGS:
if (buflen == sizeof(int)) {
*(int *)buf = bsdflags;
res = 0;
} else
res = EINVAL;
break;
default:
res = ENOENT;
break;