All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Skripkin <paskripkin@gmail.com>
To: Dongliang Mu <mudongliangabcd@gmail.com>,
	kernelnewbies <kernelnewbies@kernelnewbies.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: Any tracing mechanism can track the executed instructions of a user process in the kernel?
Date: Mon, 18 Oct 2021 10:08:32 +0300	[thread overview]
Message-ID: <bd6cc56f-f5dd-31cf-cc0b-6fea123b7563@gmail.com> (raw)
In-Reply-To: <CAD-N9QWd6Orm8d9AMk7mybByAKZod=GJ-HSNPOfhFDStSPwSUA@mail.gmail.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: Pavel Skripkin <paskripkin@gmail.com>
To: Dongliang Mu <mudongliangabcd@gmail.com>,
	kernelnewbies <kernelnewbies@kernelnewbies.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: Any tracing mechanism can track the executed instructions of a user process in the kernel?
Date: Mon, 18 Oct 2021 10:08:32 +0300	[thread overview]
Message-ID: <bd6cc56f-f5dd-31cf-cc0b-6fea123b7563@gmail.com> (raw)
In-Reply-To: <CAD-N9QWd6Orm8d9AMk7mybByAKZod=GJ-HSNPOfhFDStSPwSUA@mail.gmail.com>

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

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  parent reply	other threads:[~2021-10-18  7:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-18  2:45 Any tracing mechanism can track the executed instructions of a user process in the kernel? Dongliang Mu
2021-10-18  2:45 ` Dongliang Mu
2021-10-18  4:09 ` Aruna Hewapathirane
2021-10-18  7:08 ` Pavel Skripkin [this message]
2021-10-18  7:08   ` Pavel Skripkin
2021-10-18  8:06 ` FMDF
2021-10-18  8:41   ` Dongliang Mu
2021-10-18  8:41     ` Dongliang Mu
2021-10-18  8:48     ` Greg KH
2021-10-18  8:48       ` Greg KH
2021-10-18  9:17     ` Dongliang Mu
2021-10-18  9:17       ` Dongliang Mu
2021-10-18  9:48       ` FMDF
2021-10-18 10:12         ` FMDF
2021-10-18 15:10     ` Valdis Klētnieks
2021-10-18 15:10       ` Valdis Klētnieks
2021-10-18 21:00 ` jim.cromie
2021-10-18 21:00   ` jim.cromie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bd6cc56f-f5dd-31cf-cc0b-6fea123b7563@gmail.com \
    --to=paskripkin@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mudongliangabcd@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.