mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-15 07:32:52 +00:00
Previously, getauxval() got the address of the auxiliary vector by traversing to the end of the `environ` pointer. The assumption that the auxiliary vector comes after the environment array is true at program startup, however the environment array may be re-allocated and change its address during runtime which would cause getauxval() to work with an incorrect auxiliary vector address. To fix this, we now get the address of the auxiliary vector once in __libc_init and store it in a libc-internal pointer which is then used by getauxval(). Fixes #10087.
30 lines
753 B
C
30 lines
753 B
C
/*
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__BEGIN_DECLS
|
|
|
|
typedef void (*AtExitFunction)(void*);
|
|
|
|
extern void __libc_init();
|
|
extern void __malloc_init();
|
|
extern void __stdio_init();
|
|
extern void _init();
|
|
extern bool __environ_is_malloced;
|
|
extern bool __stdio_is_initialized;
|
|
extern bool __heap_is_stable;
|
|
extern void* __auxiliary_vector;
|
|
|
|
int __cxa_atexit(AtExitFunction exit_function, void* parameter, void* dso_handle);
|
|
void __cxa_finalize(void* dso_handle);
|
|
__attribute__((noreturn)) void __cxa_pure_virtual() __attribute__((weak));
|
|
__attribute__((noreturn)) void __stack_chk_fail();
|
|
__attribute__((noreturn)) void __stack_chk_fail_local();
|
|
|
|
__END_DECLS
|