mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2024-12-19 04:44:27 -05:00
move pthread_atfork wrapper to util header
This commit is contained in:
parent
b5187a0aff
commit
fc8f2c3b60
10
h_malloc.c
10
h_malloc.c
@ -21,17 +21,7 @@
|
||||
#include "random.h"
|
||||
#include "util.h"
|
||||
|
||||
// use __register_atfork directly to avoid linking with libpthread for glibc < 2.28
|
||||
#if defined(__GLIBC__) && !__GLIBC_PREREQ(2, 28)
|
||||
extern void *__dso_handle;
|
||||
extern int __register_atfork(void (*)(void), void (*)(void), void (*)(void), void *);
|
||||
#define atfork(prepare, parent, child) __register_atfork(prepare, parent, child, __dso_handle)
|
||||
#else
|
||||
#define atfork pthread_atfork
|
||||
#endif
|
||||
|
||||
#define SLAB_QUARANTINE (SLAB_QUARANTINE_RANDOM_LENGTH > 0 || SLAB_QUARANTINE_QUEUE_LENGTH > 0)
|
||||
|
||||
#define MREMAP_MOVE_THRESHOLD (32 * 1024 * 1024)
|
||||
|
||||
static_assert(sizeof(void *) == 8, "64-bit only");
|
||||
|
9
util.h
9
util.h
@ -38,6 +38,15 @@ typedef uint32_t u32;
|
||||
typedef uint64_t u64;
|
||||
typedef unsigned __int128 u128;
|
||||
|
||||
// use __register_atfork directly to avoid linking with libpthread for glibc < 2.28
|
||||
#if defined(__GLIBC__) && !__GLIBC_PREREQ(2, 28)
|
||||
extern void *__dso_handle;
|
||||
extern int __register_atfork(void (*)(void), void (*)(void), void (*)(void), void *);
|
||||
#define atfork(prepare, parent, child) __register_atfork(prepare, parent, child, __dso_handle)
|
||||
#else
|
||||
#define atfork pthread_atfork
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SEAL_METADATA
|
||||
#if defined(__GLIBC__) && __GLIBC_PREREQ(2, 27)
|
||||
#define USE_PKEY
|
||||
|
Loading…
Reference in New Issue
Block a user