Skip to content

Commit

Permalink
Fix mmap flags: MAP_32BIT is x86_64 only, and MAP_FIXED is inappropri…
Browse files Browse the repository at this point in the history
…ate for this application
  • Loading branch information
wrwilliams committed Jun 8, 2016
1 parent a1dae47 commit 0a31e58
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dyninstAPI_RT/src/RTheap-linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Address DYNINSTheap_loAddr = 0x50000000;
Address DYNINSTheap_hiAddr = 0xb0000000;
#endif

int DYNINSTheap_mmapFlags = MAP_ANONYMOUS | MAP_FIXED | MAP_PRIVATE;
int DYNINSTheap_mmapFlags = MAP_ANONYMOUS | MAP_PRIVATE;


RT_Boolean DYNINSTheap_useMalloc(void *lo, void *hi)
Expand Down
3 changes: 2 additions & 1 deletion dyninstAPI_RT/src/RTposix.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,11 @@ int DYNINSTwriteEvent(void *ev, size_t sz)
void *map_region(void *addr, int len, int fd) {
void *result;
int flags = DYNINSTheap_mmapFlags;
#if defined(arch_x86_64)
if(addr == 0) flags |= MAP_32BIT;
#endif
result = mmap(addr, len, PROT_READ|PROT_WRITE|PROT_EXEC,
flags, fd, 0);
flags, fd, 0);
if (result == MAP_FAILED)
return NULL;
return result;
Expand Down

0 comments on commit 0a31e58

Please sign in to comment.