fix: guard execve against null executor, inline-hook fork for dlopen (#42)#43
Merged
Merged
Conversation
…42) When libvproc.so is loaded via dlopen (not LD_PRELOAD), fork is not intercepted — ART's ProcessBuilder fork bypasses vproc, leaving REAL_FORK_CHILD unset. The fork child's execve enters virtual_execve and dereferences a null executor (TLS reset by bionic's pthread_atfork), crashing the second ProcessBuilder.start() call. - Add executor null check to execve early-return guard (preload.rs) - Add null guards to all executor functions that dereference the pointer - Add hook_libc_fork() to inline-hook fork like execve is hooked, ensuring REAL_FORK_CHILD is set even in dlopen scenario Bahtya
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ProcessBuilder.start()fails with error=795275776 when libvproc.so is loaded via dlopenget_current_executor()hook_libc_fork()to inline-hook fork (matching existinghook_libc_execve()pattern), ensuringREAL_FORK_CHILDis set even in dlopen scenarioRoot Cause
When loaded via dlopen, only execve is inline-hooked, not fork. ART's fork bypasses vproc, so
REAL_FORK_CHILDis never set in the child. The child's execve entersvirtual_execve, dereferences a null executor (TLS reset by bionic's pthread_atfork), and crashes.Test plan
Bahtya