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
|
## 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:
|
supported dependencies:
|
||||||
|
|
||||||
* glibc 2.24
|
* glibc 2.28
|
||||||
* Linux 4.9
|
* Linux 4.19
|
||||||
* Clang 3.8 or GCC 6.3
|
* Clang 7.0 or GCC 8.3.0
|
||||||
|
|
||||||
However, using more recent releases is highly recommended. Older versions of
|
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
|
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);
|
mutex_unlock(&lock);
|
||||||
|
|
||||||
// may allocate, so wait until the allocator is initialized to avoid deadlocking
|
// 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");
|
fatal_error("pthread_atfork failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
10
random.c
10
random.c
|
@ -5,17 +5,7 @@
|
||||||
#include "random.h"
|
#include "random.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#if __has_include(<sys/random.h>)
|
|
||||||
// glibc 2.25 and later
|
|
||||||
#include <sys/random.h>
|
#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) {
|
static void get_random_seed(void *buf, size_t size) {
|
||||||
while (size) {
|
while (size) {
|
||||||
|
|
19
util.h
19
util.h
|
@ -38,28 +38,11 @@ typedef uint32_t u32;
|
||||||
typedef uint64_t u64;
|
typedef uint64_t u64;
|
||||||
typedef unsigned __int128 u128;
|
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
|
#if CONFIG_SEAL_METADATA
|
||||||
|
|
||||||
#ifdef __GLIBC__
|
#ifdef __GLIBC__
|
||||||
#if __GLIBC_PREREQ(2, 27)
|
|
||||||
#define USE_PKEY
|
#define USE_PKEY
|
||||||
#endif
|
#else
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef USE_PKEY
|
|
||||||
#error "CONFIG_SEAL_METADATA requires Memory Protection Key support"
|
#error "CONFIG_SEAL_METADATA requires Memory Protection Key support"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue