Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/taviso/loadlibrary.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--intercept/hook.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/intercept/hook.c b/intercept/hook.c
index 610db5e..d6fdb5b 100644
--- a/intercept/hook.c
+++ b/intercept/hook.c
@@ -131,7 +131,10 @@ bool insert_function_redirect(void *function, void *redirect, uint32_t flags)
- (uintptr_t)(sizeof(struct branch));
// Fix permissions on the redirect.
- mprotect((void *)((uintptr_t) fixup & PAGE_MASK), PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC);
+ if (mprotect((void *)((uintptr_t) fixup & PAGE_MASK), PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC) != 0) {
+ printf("mprotect() failed on stub => %m, try `sudo setenforce 0`\n", fixup);
+ return false;
+ }
// Copy over the code we are going to clobber by installing the redirect.
memcpy(&fixup->data, function, redirectsize);