Skip to content

fix: guard execve against null executor, inline-hook fork for dlopen (#42)#43

Merged
Bahtya merged 1 commit into
mainfrom
fix/issue-42-execve-null-executor
May 26, 2026
Merged

fix: guard execve against null executor, inline-hook fork for dlopen (#42)#43
Bahtya merged 1 commit into
mainfrom
fix/issue-42-execve-null-executor

Conversation

@Bahtya
Copy link
Copy Markdown
Owner

@Bahtya Bahtya commented May 26, 2026

Summary

  • Fixes libvproc.so execve hook blocks second ProcessBuilder.start() on Android #42: second ProcessBuilder.start() fails with error=795275776 when libvproc.so is loaded via dlopen
  • Add null executor check to execve early-return guard so ART's fork children safely fall through to raw syscall
  • Add null guards to all executor functions that dereference get_current_executor()
  • Add hook_libc_fork() to inline-hook fork (matching existing hook_libc_execve() pattern), ensuring REAL_FORK_CHILD is set even in dlopen scenario

Root Cause

When loaded via dlopen, only execve is inline-hooked, not fork. ART's fork bypasses vproc, so REAL_FORK_CHILD is never set in the child. The child's execve enters virtual_execve, dereferences a null executor (TLS reset by bionic's pthread_atfork), and crashes.

Test plan

  • Build libvproc.so for aarch64-android
  • Load via dlopen in test app, call ProcessBuilder.start() twice
  • Verify both calls succeed
  • Check logcat for vproc diagnostics
  • Verify existing LD_PRELOAD path still works

Bahtya

…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
@Bahtya Bahtya merged commit 1b3997a into main May 26, 2026
@Bahtya Bahtya deleted the fix/issue-42-execve-null-executor branch May 26, 2026 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

libvproc.so execve hook blocks second ProcessBuilder.start() on Android

1 participant