Skip to content

Commit 04c7be2

Browse files
committed
Replace the mmap call with a system call. mmap is a function with a high probability of being inlinehooked, which will lead to potential hook conflicts.
1 parent 664c148 commit 04c7be2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bytehook/src/main/cpp/bh_trampo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ static void *bh_trampo_allocate(size_t sz) {
182182
// get/create an usable block
183183
if (remaining < sz) {
184184
// create new memory map
185-
block = mmap(NULL, BH_TRAMPO_BLOCK_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS,
186-
-1, 0);
185+
block = sys_mmap(NULL, BH_TRAMPO_BLOCK_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC,
186+
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
187187
if (MAP_FAILED == block) {
188188
ret = NULL;
189189
goto end;

0 commit comments

Comments
 (0)