mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2025-04-19 22:10:19 +02:00
Merge branch 'master' into test_harness
This commit is contained in:
commit
bb005aada1
4 changed files with 6 additions and 33 deletions
|
@ -63,12 +63,12 @@ used instead as this allocator fundamentally doesn't support that environment.
|
|||
|
||||
## Dependencies
|
||||
|
||||
Debian oldstable (currently Debian 9) determines the most ancient set of
|
||||
Debian stable (currently Debian 10) determines the most ancient set of
|
||||
supported dependencies:
|
||||
|
||||
* glibc 2.24
|
||||
* Linux 4.9
|
||||
* Clang 3.8 or GCC 6.3
|
||||
* glibc 2.28
|
||||
* Linux 4.19
|
||||
* Clang 7.0 or GCC 8.3.0
|
||||
|
||||
However, using more recent releases is highly recommended. Older versions of
|
||||
the dependencies may be compatible at the moment but are not tested and will
|
||||
|
|
|
@ -1156,7 +1156,7 @@ COLD static void init_slow_path(void) {
|
|||
mutex_unlock(&lock);
|
||||
|
||||
// may allocate, so wait until the allocator is initialized to avoid deadlocking
|
||||
if (atfork(full_lock, full_unlock, post_fork_child)) {
|
||||
if (pthread_atfork(full_lock, full_unlock, post_fork_child)) {
|
||||
fatal_error("pthread_atfork failed");
|
||||
}
|
||||
}
|
||||
|
|
10
random.c
10
random.c
|
@ -5,17 +5,7 @@
|
|||
#include "random.h"
|
||||
#include "util.h"
|
||||
|
||||
#if __has_include(<sys/random.h>)
|
||||
// glibc 2.25 and later
|
||||
#include <sys/random.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
static ssize_t getrandom(void *buf, size_t buflen, unsigned int flags) {
|
||||
return syscall(SYS_getrandom, buf, buflen, flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void get_random_seed(void *buf, size_t size) {
|
||||
while (size) {
|
||||
|
|
19
util.h
19
util.h
|
@ -38,28 +38,11 @@ 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
|
||||
#ifdef __GLIBC__
|
||||
#if !__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)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef atfork
|
||||
#define atfork pthread_atfork
|
||||
#endif
|
||||
|
||||
#if CONFIG_SEAL_METADATA
|
||||
|
||||
#ifdef __GLIBC__
|
||||
#if __GLIBC_PREREQ(2, 27)
|
||||
#define USE_PKEY
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef USE_PKEY
|
||||
#else
|
||||
#error "CONFIG_SEAL_METADATA requires Memory Protection Key support"
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue