Allow tracing kernel threads - #385
Open
Nehal70 wants to merge 1 commit into
Open
Conversation
When attaching to a kernel thread, /proc/$pid/exe is unavailable. Detect kernel threads by ppid=kthreadd (PID 2) and resolve symbols from vmlinux instead. Show kernel threads in the fzf attach picker and require kernel tracing flags when attaching to them. Fixes janestreet#226 Signed-off-by: Nehal Singhal <nehalsinghal06@gmail.com>
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.
Summary
/proc/$pid/exe.-trace-include-kernelor-trace-kernel-onlywhen attaching to them.Fixes #226
Reproduction
On this WSL2 system, kernel thread PID 342 has
ppid=2andreadlink /proc/342/exefails. Before this change,magic-trace attach -pid 342would fail when resolving the executable path.Test plan
/proc/$pid/statppid parsing andis_kernel_threadon the current process.dune runtest(requires opam switch with project dependencies).magic-trace attach -pid <kernel-thread-pid> -trace-kernel-only, snapshot with Ctrl-C, verify trace decodes with kernel symbols.Signed-off-by: Nehal Singhal nehalsinghal06@gmail.com