Support AT_PS_STRINGS in _elf_aux_info().

This will be used by setproctitle().

Reviewed by:	kib
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D24407
This commit is contained in:
Brooks Davis 2020-04-15 20:26:41 +00:00
parent 3780fcd950
commit 1e4a35add8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=359990

View File

@ -70,7 +70,7 @@ static pthread_once_t aux_once = PTHREAD_ONCE_INIT;
static int pagesize, osreldate, canary_len, ncpus, pagesizes_len, bsdflags;
static int hwcap_present, hwcap2_present;
static char *canary, *pagesizes, *execpath;
static void *timekeep;
static void *ps_strings, *timekeep;
static u_long hwcap, hwcap2;
#ifdef __powerpc__
@ -135,6 +135,10 @@ init_aux(void)
case AT_TIMEKEEP:
timekeep = aux->a_un.a_ptr;
break;
case AT_PS_STRINGS:
ps_strings = aux->a_un.a_ptr;
break;
#ifdef __powerpc__
/*
* Since AT_STACKPROT is always set, and the common
@ -337,6 +341,16 @@ _elf_aux_info(int aux, void *buf, int buflen)
} else
res = EINVAL;
break;
case AT_PS_STRINGS:
if (buflen == sizeof(void *)) {
if (ps_strings != NULL) {
*(void **)buf = ps_strings;
res = 0;
} else
res = ENOENT;
} else
res = EINVAL;
break;
default:
res = ENOENT;
break;