diff options
author | van Hauser <vh@thc.org> | 2020-07-05 11:00:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-05 11:00:45 +0200 |
commit | 3144f72e1cf197612888868275575e615f6cbfb5 (patch) | |
tree | ba7955d34acb5d9ae43d3fbaa81d6fb0fe895ece | |
parent | 147b0a151c8707a40d9e208e4ae4d817704488f9 (diff) | |
parent | 29102d6bf169bc26171d9b24430ac4e8a1c91452 (diff) | |
download | afl++-3144f72e1cf197612888868275575e615f6cbfb5.tar.gz |
Merge pull request #440 from devnexen/libdislocator_solaris_upd
libdislocator: hugepage enabled for illumos too.
-rw-r--r-- | libdislocator/libdislocator.so.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libdislocator/libdislocator.so.c b/libdislocator/libdislocator.so.c index 7a70fd15..b93f43c1 100644 --- a/libdislocator/libdislocator.so.c +++ b/libdislocator/libdislocator.so.c @@ -166,7 +166,7 @@ static u32 alloc_canary; static void *__dislocator_alloc(size_t len) { - u8 * ret; + u8 * ret, *base; size_t tlen; int flags, fd, sp; @@ -189,6 +189,7 @@ static void *__dislocator_alloc(size_t len) { /* We will also store buffer length and a canary below the actual buffer, so let's add 8 bytes for that. */ + base = NULL; tlen = (1 + PG_COUNT(rlen + 8)) * PAGE_SIZE; flags = MAP_PRIVATE | MAP_ANONYMOUS; fd = -1; @@ -201,12 +202,19 @@ static void *__dislocator_alloc(size_t len) { if (sp) flags |= MAP_HUGETLB; #elif defined(__FreeBSD__) if (sp) flags |= MAP_ALIGNED_SUPER; + #elif defined(__sun) + if (sp) { + + base = (void *)(caddr_t)(1<<21); + flags |= MAP_ALIGN; + + } #endif #else (void)sp; #endif - ret = (u8 *)mmap(NULL, tlen, PROT_READ | PROT_WRITE, flags, fd, 0); + ret = (u8 *)mmap(base, tlen, PROT_READ | PROT_WRITE, flags, fd, 0); #if defined(USEHUGEPAGE) /* We try one more time with regular call */ if (ret == MAP_FAILED) { @@ -217,6 +225,8 @@ static void *__dislocator_alloc(size_t len) { flags &= -MAP_HUGETLB; #elif defined(__FreeBSD__) flags &= -MAP_ALIGNED_SUPER; + #elif defined(__sun) + flags &= -MAP_ALIGN; #endif ret = (u8 *)mmap(NULL, tlen, PROT_READ | PROT_WRITE, flags, fd, 0); |