I have a small project which implements function hooking in MAC using mach_override() by Jonathan 'Wolf' Rentzsch:https://github.com/rentzsch/mach_override
I have hooked one of the functions of kextstat process from mac.
So when I am executing
$kextstat
OSX is killing this process saying below error:
CODE SIGNING: process 2211[kextstat]: rejecting invalid page at address 0x7fff5132d000 from offset 0xca53000 in file "/private/var/db/dyld/dyld_shared_cache_x86_64h" (cs_mtime:1531207073.366350606 == mtime:1531207073.366350606) (signed:0 validated:0 tainted:0 nx:0 wpmapped:1 dirty:1 depth:2)
my dynamic library is code-signed. In my initial observation, i could conclude that mach_override() function in failing in following code:
atomic_mov64((uint64_t *)originalFunctionPtr, jumpRelativeInstruction);
above code could be found : mach_override.c:342 https://github.com/rentzsch/mach_override