aboutsummaryrefslogtreecommitdiff
path: root/libdislocator
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-07-21 13:15:59 +0200
committerGitHub <noreply@github.com>2020-07-21 13:15:59 +0200
commitb6e65f98827470745d7df5cf1e38b506b9e839b0 (patch)
tree602abd8c1a1929aebda3f80665ffe02b435fdd00 /libdislocator
parentfc5cfc6cb309b072a45b991be117c17396e46a89 (diff)
parentc2b04bdf6c596f5d220f27caead20d09452ed42d (diff)
downloadafl++-b6e65f98827470745d7df5cf1e38b506b9e839b0.tar.gz
Merge pull request #461 from AFLplusplus/new_splicing
New splicing
Diffstat (limited to 'libdislocator')
-rw-r--r--libdislocator/libdislocator.so.c15
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);