diff options
| author | van Hauser <vh@thc.org> | 2020-08-03 13:39:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-03 13:39:55 +0200 |
| commit | d5d8d664d0d4b95792aaccd16264f3a3cff48cc8 (patch) | |
| tree | fa82a04acca16ea3e088b0d7d3aaec4b01ddf8f9 /libdislocator | |
| parent | 4a51cb71fb8785325dedac693cdea4648f6e5279 (diff) | |
| parent | 409e4ae945ab5aeb31b1e3a1497ce5fc65226f07 (diff) | |
| download | afl++-d5d8d664d0d4b95792aaccd16264f3a3cff48cc8.tar.gz | |
Merge pull request #477 from AFLplusplus/dev
Push to stable
Diffstat (limited to 'libdislocator')
| -rw-r--r-- | libdislocator/libdislocator.so.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libdislocator/libdislocator.so.c b/libdislocator/libdislocator.so.c index 7a70fd15..2324e390 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,20 @@ 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 +226,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); |
