Call __libc_init_malloc from scudo.
Currently, scudo doesn't call libc's malloc initialisers. This causes problems with any functionality that relies on an initialised__libc_globals inside of bionic malloc's stubs (e.g. malloc()). This manifests in two ways (that I can think of): 1. Dispatch tables don't work with scudo, so malloc_debug has never worked in an executable linked against scudo. 2. Allocators that require initialisation and are called from bionic malloc's stubs (GWP-ASan) never get initialised. Bug: 135634846 Test: atest bionic-unit-tests-scudo Change-Id: I3e3344d7d510ce4e8d3709cd69c8cb0fe5adedda
This commit is contained in:
parent
6dc945babd
commit
c11e39bcff
1 changed files with 5 additions and 0 deletions
|
@ -35,6 +35,11 @@
|
|||
|
||||
__LIBC_HIDDEN__ WriteProtected<libc_globals> __libc_globals;
|
||||
|
||||
// Call the libc malloc initialisers.
|
||||
__attribute__((constructor(1))) static void __scudo_preinit() {
|
||||
__libc_globals.mutate(__libc_init_malloc);
|
||||
}
|
||||
|
||||
#if defined(__i386__)
|
||||
__LIBC_HIDDEN__ void* __libc_sysinfo = reinterpret_cast<void*>(__libc_int0x80);
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue