Repository navigation
os: add debugger_present implementation for OpenBSD - #24490
Merged
Merged
Conversation
Check if a child process could trace its parent process, if not a
debugger must be present.
On OpenBSD, impossible to trace a parent process from its child. But
with errors (errno), it's possible to determine if a debugger is present
or not.
Possible errors for ptrace / PT_ATTACH in child process:
- EBUSY: process already traced
- EPERM: process is not a child of tracer (sysctl kern.global_ptrace=0)
- EINVAL: process is an ancestor of the current process and not
init (sysctl kern.global_ptrace=1)
Signed-off-by: Laurent Cheylus <foxy@free.fr>
|
Connected to Huly®: V_0.6-22859 |
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.
Check if a child process could trace its parent process, if not a debugger must be present.
On OpenBSD, impossible to trace a parent process from its child. But with errors (errno), it's possible to determine if a debugger is present or not.
Possible errors for ptrace / PT_ATTACH in child process:
Closes #23603
Tests OK on OpenBSD current/adm64
Code
debugger_present.vto test if debugger is present or not$ ~/tmp/debugger_present Call 1: no debugger Call 2: no debugger$ gdb ~/tmp/debugger_present (...) (gdb) run Starting program: /home/fox/tmp/debugger_present Call 1: [New process 84238] debugger here Call 2: debugger here Program exited normally. (gdb) quit