DynamoRIO / DynamoRIO/dynamorio

`drinject -noinject` still attempts takeover in init on unix

Open
#3,147 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
3.2k
Forks
629
Avg merge
2d 18h
Merged PRs (30d)
30

Description

drinject calls `dr_inject_process_create` or `dr_inject_prepare_to_exec`: https://github.com/DynamoRIO/dynamorio/blob/master/tools/drdeploy.c#L1641-L1653

`dr_inject_process_create` calls `fork_suspended_child` which sets `DYNAMORIO_TAKEOVER_IN_INIT=1` (https://github.com/DynamoRIO/dynamorio/blob/master/core/unix/injector.c#L351), and `dr_inject_prepare_to_exec` sets `DYNAMORIO_TAKEOVER_IN_INIT=1` directly: https://github.com/DynamoRIO/dynamorio/blob/master/core/unix/injector.c#L528-L543

And in unix/os.c we take over during static initialization if DYNAMORIO_TAKEOVER_IN_INIT is "1": https://github.com/DynamoRIO/dynamorio/blob/master/core/unix/os.c#L741

`-no_inject` seems to only affect whether `dr_inject_process_inject` is called.

Contributor guide

Open the contributing guide

Research direction

Start in tools/drdeploy.c at the dr_inject_process_create and dr_inject_prepare_to_exec calls, then trace DYNAMORIO_TAKEOVER_IN_INIT through core/unix/injector.c and core/unix/os.c. Verify how -no_inject is handled and confirm that drinject -noinject no longer attempts takeover during initialization on Unix.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.