Skip to content

Replace shell execution with no-shell subprocess/execv#12

Merged
jzh18 merged 2 commits into
mainfrom
refactor/safe-subprocess-exec
Jun 17, 2026
Merged

Replace shell execution with no-shell subprocess/execv#12
jzh18 merged 2 commits into
mainfrom
refactor/safe-subprocess-exec

Conversation

@jzh18

@jzh18 jzh18 commented Jun 15, 2026

Copy link
Copy Markdown
Member

The launcher built drrun/postprocess commands as shell strings via srutils.shell_system and interpolated user input (--so_name, paths) unquoted — a shell-injection and quoting hazard. The native client did the same with a bare system() pointing at a hardcoded, machine-specific preprocess.py path that does not exist in the OSS layout (so rich-mode boundary detection silently never ran).

Python (main.py): build drrun and postprocess invocations as argument lists and run them with subprocess.run (no shell). boundary_detection.py: run FunSeeker via subprocess.run with an argv list, merging stderr into stdout to preserve the previous parsing/error behavior. Drop the srutils dependency entirely (pyproject/ci/dev.sh/build-bundle/docs).

Native client (rtrace.cc): replace system() with a fork + execvp helper (no shell); take the interpreter and cache directory as --python and --cache_dir droptions passed by main.py instead of hardcoded paths; and unlock stats_mutex on the early return in event_module_load.

jzh18 added 2 commits June 15, 2026 04:17
The launcher built drrun/postprocess commands as shell strings via
srutils.shell_system and interpolated user input (--so_name, paths)
unquoted — a shell-injection and quoting hazard. The native client did
the same with a bare system() pointing at a hardcoded, machine-specific
preprocess.py path that does not exist in the OSS layout (so rich-mode
boundary detection silently never ran).

Python (main.py): build drrun and postprocess invocations as argument
lists and run them with subprocess.run (no shell). boundary_detection.py:
run FunSeeker via subprocess.run with an argv list, merging stderr into
stdout to preserve the previous parsing/error behavior. Drop the srutils
dependency entirely (pyproject/ci/dev.sh/build-bundle/docs).

Native client (rtrace.cc): replace system() with a fork + execvp helper
(no shell); take the interpreter and cache directory as --python and
--cache_dir droptions passed by main.py instead of hardcoded paths; and
unlock stats_mutex on the early return in event_module_load.
WS2 added <sys/wait.h> to rtrace.cc for waitpid(); it transitively
includes <signal.h>, whose siginfo-consts.h defines an enum constant
TRAP_BRANCH that collides with our types.h TRAP_BRANCH, breaking the
bundle build. Namespace the trap constants as RTRACE_TRAP_*.
@jzh18 jzh18 merged commit cee1318 into main Jun 17, 2026
7 checks passed
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.

1 participant