]> xenbits.xensource.com Git - unikraft/libs/musl.git/commitdiff
glue: Init libc.auxv to point to a zero value
authorStefan Jumarea <stefanjumarea02@gmail.com>
Wed, 31 May 2023 17:14:41 +0000 (20:14 +0300)
committerUnikraft <monkey@unikraft.io>
Wed, 28 Jun 2023 13:21:19 +0000 (13:21 +0000)
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 <stefanjumarea02@gmail.com>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #53

__uk_init_tls.c

index 68e0fc5ded7d00f18381ef1370fb5dc59f997f04..5f4f2c6c1a3cf98e0cc8722b59eee1409f5ef0d2 100644 (file)
@@ -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;