Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/fbobjc/VendorLib/FBRetainCycleDetector/src/rcd_fishhook/rcd_fishhook.c b/fbobjc/VendorLib/FBRetainCycleDetector/src/rcd_fishhook/rcd_fishhook.c
- --- a/fbobjc/VendorLib/FBRetainCycleDetector/src/rcd_fishhook/rcd_fishhook.c
- +++ b/fbobjc/VendorLib/FBRetainCycleDetector/src/rcd_fishhook/rcd_fishhook.c
- @@ -24,8 +24,10 @@
- #include "rcd_fishhook.h"
- #include <dlfcn.h>
- +#include <stdbool.h>
- #include <stdlib.h>
- #include <string.h>
- +#include <sys/mman.h>
- #include <sys/types.h>
- #include <mach-o/dyld.h>
- #include <mach-o/loader.h>
- @@ -82,8 +84,12 @@
- nlist_t *symtab,
- char *strtab,
- uint32_t *indirect_symtab) {
- + const bool isDataConst = strcmp(section->segname, "__DATA_CONST") == 0;
- uint32_t *indirect_symbol_indices = indirect_symtab + section->reserved1;
- void **indirect_symbol_bindings = (void **)((uintptr_t)slide + section->addr);
- + if (isDataConst) {
- + mprotect(indirect_symbol_bindings, section->size, PROT_READ | PROT_WRITE);
- + }
- for (uint i = 0; i < section->size / sizeof(void *); i++) {
- uint32_t symtab_index = indirect_symbol_indices[i];
- if (symtab_index == INDIRECT_SYMBOL_ABS || symtab_index == INDIRECT_SYMBOL_LOCAL ||
- @@ -110,6 +116,9 @@
- }
- symbol_loop:;
- }
- + if (isDataConst) {
- + mprotect(indirect_symbol_bindings, section->size, PROT_READ);
- + }
- }
- static void rebind_symbols_for_image(struct rcd_rebindings_entry *rebindings,
- diff --git a/fbobjc/VendorLib/fishhook/src/fishhook.c b/fbobjc/VendorLib/fishhook/src/fishhook.c
- --- a/fbobjc/VendorLib/fishhook/src/fishhook.c
- +++ b/fbobjc/VendorLib/fishhook/src/fishhook.c
- @@ -24,8 +24,10 @@
- #include "fishhook.h"
- #include <dlfcn.h>
- +#include <stdbool.h>
- #include <stdlib.h>
- #include <string.h>
- +#include <sys/mman.h>
- #include <sys/types.h>
- #include <mach-o/dyld.h>
- #include <mach-o/loader.h>
- @@ -82,8 +84,12 @@
- nlist_t *symtab,
- char *strtab,
- uint32_t *indirect_symtab) {
- + const bool isDataConst = strcmp(section->segname, "__DATA_CONST") == 0;
- uint32_t *indirect_symbol_indices = indirect_symtab + section->reserved1;
- void **indirect_symbol_bindings = (void **)((uintptr_t)slide + section->addr);
- + if (isDataConst) {
- + mprotect(indirect_symbol_bindings, section->size, PROT_READ | PROT_WRITE);
- + }
- for (uint i = 0; i < section->size / sizeof(void *); i++) {
- uint32_t symtab_index = indirect_symbol_indices[i];
- if (symtab_index == INDIRECT_SYMBOL_ABS || symtab_index == INDIRECT_SYMBOL_LOCAL ||
- @@ -110,6 +116,9 @@
- }
- symbol_loop:;
- }
- + if (isDataConst) {
- + mprotect(indirect_symbol_bindings, section->size, PROT_READ);
- + }
- }
- static void rebind_symbols_for_image(struct rebindings_entry *rebindings,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement