Any tracing mechanism can track the executed instructions of a user process in the kernel?

Pavel Skripkin paskripkin at
Mon Oct 18 03:08:32 EDT 2021

On 10/18/21 05:45, Dongliang Mu wrote:
> Hi all,
> I am writing to kindly ask one question: is there any tracing
> mechanism in Linux kernel that can trace all the executed instructions
> of a user process? If this user process is run on different
> processors, traces of this process on different processors should be
> also recorded.

I think, kernel is not supposed to do that kind of things. I mean, there 
is no such wrapper in the kernel to do this task, AFAIK.

You have an access to all system calls, so you can implement your own 
gdb in the kernel via ptrace() :)

If you need only report about instructions, you can call `perf record` + 
`perf report` via call_usermodehelper() and somehow parse the output of 
these helpers.

> Any comment is welcome.

With regards,
Pavel Skripkin

More information about the Kernelnewbies mailing list