git: c71b8367dec5 - stable/13 - _elf_aux_info(3): add support for AT_USRSTACK{BASE,LIM}
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 30 Sep 2022 02:04:11 UTC
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c71b8367dec5b8eb70cfedf10f276876e3d2005b commit c71b8367dec5b8eb70cfedf10f276876e3d2005b Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2022-09-12 19:36:24 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-09-30 00:29:09 +0000 _elf_aux_info(3): add support for AT_USRSTACK{BASE,LIM} (cherry picked from commit 8f2668b0605e26b04a103f63096cfcc856d950c1) --- lib/libc/gen/auxv.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/libc/gen/auxv.c b/lib/libc/gen/auxv.c index ae21d088a8d1..af59a2dda90a 100644 --- a/lib/libc/gen/auxv.c +++ b/lib/libc/gen/auxv.c @@ -73,6 +73,7 @@ static char *canary, *pagesizes, *execpath; static void *ps_strings, *timekeep; static u_long hwcap, hwcap2; static void *fxrng_seed_version; +static u_long usrstackbase, usrstacklim; #ifdef __powerpc__ static int powerpc_new_auxv_format = 0; @@ -144,6 +145,14 @@ init_aux(void) case AT_FXRNG: fxrng_seed_version = aux->a_un.a_ptr; break; + + case AT_USRSTACKBASE: + usrstackbase = aux->a_un.a_val; + break; + + case AT_USRSTACKLIM: + usrstacklim = aux->a_un.a_val; + break; #ifdef __powerpc__ /* * Since AT_STACKPROT is always set, and the common @@ -370,6 +379,20 @@ _elf_aux_info(int aux, void *buf, int buflen) } else res = EINVAL; break; + case AT_USRSTACKBASE: + if (buflen == sizeof(u_long)) { + *(u_long *)buf = usrstackbase; + res = 0; + } else + res = EINVAL; + break; + case AT_USRSTACKLIM: + if (buflen == sizeof(u_long)) { + *(u_long *)buf = usrstacklim; + res = 0; + } else + res = EINVAL; + break; default: res = ENOENT; break;