From: Stefan Jumarea Date: Wed, 31 May 2023 17:14:41 +0000 (+0300) Subject: glue: Init libc.auxv to point to a zero value X-Git-Tag: RELEASE-0.14.0~16 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=7dcb5a02f61b0e3b1d5000ea28184ede928ded3a;p=unikraft%2Flibs%2Fmusl.git glue: Init libc.auxv to point to a zero value The `libc.auxv` is not supposed to be 0, since it will be dereferenced by any call to `getauxval`. It should point to a 0 value instead. Signed-off-by: Stefan Jumarea Reviewed-by: Marco Schlumpp Approved-by: Razvan Deaconescu Tested-by: Unikraft CI GitHub-Closes: #53 --- diff --git a/__uk_init_tls.c b/__uk_init_tls.c index 68e0fc5..5f4f2c6 100644 --- a/__uk_init_tls.c +++ b/__uk_init_tls.c @@ -159,9 +159,12 @@ static void __uk_init_tls(void *tls_area) UK_CRASH("Failed to initialize the main thread\n"); } +/* We initialize the auxiliary vector to point to a zero value */ +static size_t __libc_auxv[1] = { 0 }; + static void __uk_init_libc(void) { - libc.auxv = 0; + libc.auxv = __libc_auxv; __hwcap = 0; __sysinfo = 0; libc.page_size = __PAGE_SIZE;