mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
Introduce MAP_HUGETLB
This commit is contained in:
parent
9b87dd2b87
commit
f029375d39
6 changed files with 7 additions and 3 deletions
|
@ -1641,7 +1641,6 @@ static privileged void AllowMmapExec(struct Filter *f) {
|
||||||
//
|
//
|
||||||
// - MAP_LOCKED (0x02000)
|
// - MAP_LOCKED (0x02000)
|
||||||
// - MAP_NONBLOCK (0x10000)
|
// - MAP_NONBLOCK (0x10000)
|
||||||
// - MAP_HUGETLB (0x40000)
|
|
||||||
//
|
//
|
||||||
static privileged void AllowMmapNoexec(struct Filter *f) {
|
static privileged void AllowMmapNoexec(struct Filter *f) {
|
||||||
static const struct sock_filter fragment[] = {
|
static const struct sock_filter fragment[] = {
|
||||||
|
@ -1650,7 +1649,7 @@ static privileged void AllowMmapNoexec(struct Filter *f) {
|
||||||
/*L2*/ BPF_STMT(BPF_ALU | BPF_AND | BPF_K, ~(PROT_READ | PROT_WRITE)),
|
/*L2*/ BPF_STMT(BPF_ALU | BPF_AND | BPF_K, ~(PROT_READ | PROT_WRITE)),
|
||||||
/*L3*/ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 0, 0, 8 - 4),
|
/*L3*/ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 0, 0, 8 - 4),
|
||||||
/*L4*/ BPF_STMT(BPF_LD | BPF_W | BPF_ABS, OFF(args[3])), // flags
|
/*L4*/ BPF_STMT(BPF_LD | BPF_W | BPF_ABS, OFF(args[3])), // flags
|
||||||
/*L5*/ BPF_STMT(BPF_ALU | BPF_AND | BPF_K, 0x52000),
|
/*L5*/ BPF_STMT(BPF_ALU | BPF_AND | BPF_K, 0x12000),
|
||||||
/*L6*/ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 0, 0, 1),
|
/*L6*/ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 0, 0, 1),
|
||||||
/*L7*/ BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW),
|
/*L7*/ BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW),
|
||||||
/*L8*/ BPF_STMT(BPF_LD | BPF_W | BPF_ABS, OFF(nr)),
|
/*L8*/ BPF_STMT(BPF_LD | BPF_W | BPF_ABS, OFF(nr)),
|
||||||
|
|
|
@ -30,6 +30,7 @@ const char *(DescribeMapFlags)(char buf[64], int x) {
|
||||||
{MAP_SHARED, "SHARED"}, //
|
{MAP_SHARED, "SHARED"}, //
|
||||||
{MAP_FIXED, "FIXED"}, //
|
{MAP_FIXED, "FIXED"}, //
|
||||||
{MAP_FIXED_NOREPLACE, "FIXED_NOREPLACE"}, //
|
{MAP_FIXED_NOREPLACE, "FIXED_NOREPLACE"}, //
|
||||||
|
{MAP_HUGETLB, "HUGETLB"}, //
|
||||||
{MAP_CONCEAL, "CONCEAL"}, //
|
{MAP_CONCEAL, "CONCEAL"}, //
|
||||||
{MAP_LOCKED, "LOCKED"}, //
|
{MAP_LOCKED, "LOCKED"}, //
|
||||||
{MAP_NORESERVE, "NORESERVE"}, //
|
{MAP_NORESERVE, "NORESERVE"}, //
|
||||||
|
|
|
@ -230,6 +230,7 @@ syscon mmap MAP_NORESERVE 0x00004000 0x00004000 0x00000040 0x00000040 0
|
||||||
syscon mmap MAP_POPULATE 0x00008000 0x00008000 0 0 0x00040000 0 0 0 # MAP_PREFAULT_READ on FreeBSD; can avoid madvise(MADV_WILLNEED) on private file mapping
|
syscon mmap MAP_POPULATE 0x00008000 0x00008000 0 0 0x00040000 0 0 0 # MAP_PREFAULT_READ on FreeBSD; can avoid madvise(MADV_WILLNEED) on private file mapping
|
||||||
syscon mmap MAP_NONBLOCK 0x00010000 0x00010000 0 0 0 0 0 0
|
syscon mmap MAP_NONBLOCK 0x00010000 0x00010000 0 0 0 0 0 0
|
||||||
syscon mmap MAP_SYNC 0x00080000 0x00080000 0 0 0 0 0 0 # perform synchronous page faults for mapping (Linux 4.15+)
|
syscon mmap MAP_SYNC 0x00080000 0x00080000 0 0 0 0 0 0 # perform synchronous page faults for mapping (Linux 4.15+)
|
||||||
|
syscon mmap MAP_HUGETLB 0x00040000 -1 -1 -1 -1 -1 -1 -1 # make it inherit across execve()
|
||||||
syscon mmap MAP_INHERIT -1 -1 -1 -1 -1 -1 0x00000080 -1 # make it inherit across execve()
|
syscon mmap MAP_INHERIT -1 -1 -1 -1 -1 -1 0x00000080 -1 # make it inherit across execve()
|
||||||
syscon mmap MAP_HASSEMAPHORE 0 0 0x00000200 0x00000200 0x00000200 0 0x00000200 0 # does it matter on x86?
|
syscon mmap MAP_HASSEMAPHORE 0 0 0x00000200 0x00000200 0x00000200 0 0x00000200 0 # does it matter on x86?
|
||||||
syscon mmap MAP_NOSYNC 0 0 0 0 0x00000800 0 0 0 # flush to physical media only when necessary rather than gratuitously; be sure to use write() rather than ftruncate() with this!
|
syscon mmap MAP_NOSYNC 0 0 0 0 0x00000800 0 0 0 # flush to physical media only when necessary rather than gratuitously; be sure to use write() rather than ftruncate() with this!
|
||||||
|
|
2
libc/sysv/consts/MAP_HUGETLB.S
Normal file
2
libc/sysv/consts/MAP_HUGETLB.S
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
#include "libc/sysv/consts/syscon.internal.h"
|
||||||
|
.syscon mmap,MAP_HUGETLB,0x00040000,-1,-1,-1,-1,-1,-1,-1
|
|
@ -13,6 +13,7 @@ extern const int MAP_FILE;
|
||||||
extern const int MAP_FIXED;
|
extern const int MAP_FIXED;
|
||||||
extern const int MAP_FIXED_NOREPLACE;
|
extern const int MAP_FIXED_NOREPLACE;
|
||||||
extern const int MAP_HASSEMAPHORE;
|
extern const int MAP_HASSEMAPHORE;
|
||||||
|
extern const int MAP_HUGETLB;
|
||||||
extern const int MAP_INHERIT;
|
extern const int MAP_INHERIT;
|
||||||
extern const int MAP_JIT;
|
extern const int MAP_JIT;
|
||||||
extern const int MAP_LOCKED;
|
extern const int MAP_LOCKED;
|
||||||
|
|
2
third_party/dlmalloc/platform.inc
vendored
2
third_party/dlmalloc/platform.inc
vendored
|
@ -111,7 +111,7 @@
|
||||||
#if (MORECORE_CONTIGUOUS || defined(WIN32))
|
#if (MORECORE_CONTIGUOUS || defined(WIN32))
|
||||||
#define DEFAULT_GRANULARITY (0) /* 0 means to compute in init_mparams */
|
#define DEFAULT_GRANULARITY (0) /* 0 means to compute in init_mparams */
|
||||||
#else /* MORECORE_CONTIGUOUS */
|
#else /* MORECORE_CONTIGUOUS */
|
||||||
#define DEFAULT_GRANULARITY ((size_t)64U * (size_t)1024U)
|
#define DEFAULT_GRANULARITY ((size_t)256U * (size_t)1024U)
|
||||||
#endif /* MORECORE_CONTIGUOUS */
|
#endif /* MORECORE_CONTIGUOUS */
|
||||||
#endif /* DEFAULT_GRANULARITY */
|
#endif /* DEFAULT_GRANULARITY */
|
||||||
#ifndef DEFAULT_TRIM_THRESHOLD
|
#ifndef DEFAULT_TRIM_THRESHOLD
|
||||||
|
|
Loading…
Reference in a new issue