Get tracer PID without reliance on the proc FS
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest1 patch 16 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/1 | ptrace: Get tracer PID without reliance on the proc FSinclude/ kernel/ | +11 | 16 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/1] Get tracer PID without reliance on the proc FS
For debugging, it might be useful to run the debug trap instruction to break into the debugger. To detect the debugger presence, the kernel provides the /proc/self/status pseudo-file that needs to be searched for the "TracerPid:" string.
Provide a prctl command that returns the PID of the tracer if any. That allows for much simpler logic in the user land, and makes it possible to detect tracer presence even if PROC_FS is not enabled.
As an example where this might be useful, one might refer to the standard C++ and Rust libraries. See these links for the details:
* https://en.cppreference.com/w/cpp/utility/breakpoint_if_debugging
* https://lists.llvm.org/pipermail/libcxx-commits/2024-May/083574.html
* https://patchwork-proxy.ozlabs.org/project/gcc/patch/[email protected]/#3321542
* https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2546r0.html
* https://github.com/rust-lang/rust/pull/129019
Roman Kisel (1):
ptrace: Get tracer PID without reliance on the proc FS
include/uapi/linux/ptrace.h | 1 + kernel/ptrace.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-)
base-commit: ad618736883b8970f66af799e34007475fe33a68
Signature · 1 line
2.34.1