posix_spawn and KAUTH_FILEOP_EXEC anomaly

Questions and Answers about all things *OS (macOS, iOS, tvOS, watchOS)

posix_spawn and KAUTH_FILEOP_EXEC anomaly

Postby LuigiVampa » Mon Jul 18, 2016 3:27 pm

So it turns out the famous EXEC handler in KAUTH_SCOPE_FILEOP behaves very differently when called from execve() as opposed to being called from posix_spawn()...
In the former (proper and normal, for gds sake) case, it is called from the child's process context, but the in the latter it is called from the parent's one... So the PID I get in the callback in the latter case is of the parent (from reading posix_spawn()'s code it is actually clear why this is the case)
This means that if I want to do some proc/mem analysis from within this callback, I cannot do it if a process was created via posix_spawn().
In addition, there appears to be no handler (MAC, KAUTH or otherwise) which can be used to intercept a child process in such a way that I have time to do some analysis thereof...

Any ideas? At the very least, any ideas how to get the PID of the child process from the KAUTH callback after being called from posix_spawn()?
Tx.
LuigiVampa
 
Posts: 4
Joined: Mon Jun 15, 2015 2:20 pm

Return to Questions and Answers

Who is online

Users browsing this forum: LIJI and 2 guests