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:
authorTavis Ormandy <taviso@gmail.com>2020-03-03 22:01:03 +0300
committerTavis Ormandy <taviso@gmail.com>2020-03-03 22:01:03 +0300
commite949a2a733f1cf733a9e6abf58c96bc7a831f553 (patch)
treef49fbd57833631a423ee7dc041fc6100ad4c1e65
parent3650f51f6fa2b3210432137fd491975acc250214 (diff)
warn if selinux will block stub creation
-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);