linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Francis Laniel <flaniel@linux.microsoft.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org,
	Masami Hiramatsu <mhiramat@kernel.org>,
	linux-trace-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v1 1/1] tracing/kprobe: Add multi-probe support for 'perf_kprobe' PMU
Date: Fri, 18 Aug 2023 11:01:19 +0200	[thread overview]
Message-ID: <5702105.DvuYhMxLoT@pwmachine> (raw)
In-Reply-To: <20230817111303.47b50197@gandalf.local.home>

Hi.

Le jeudi 17 août 2023, 17:13:03 CEST Steven Rostedt a écrit :
> On Thu, 17 Aug 2023 12:59:30 +0200
> 
> Francis Laniel <flaniel@linux.microsoft.com> wrote:
> > > Why can't you just pass in the address like sysfs does?
> > 
> > To get the addresses from /proc/kallsyms, you need to either have
> > CAP_SYSLOG or even CAP_SYS_ADMIN.
> > But to call perf_event_open(), you only need CAP_PERFMON.
> > This way, by giving only the name you can trace function with less
> > privileges (i.e. without CAP_SYS_ADMIN).
> > Please correct me if I am wrong as I am not an expert in knowing the
> > minimal set of capabilities you need to trace.
> 
> I wonder if we should add an option to put in the non-relocated address?
> One that can be acquired by debuginfo in the vmlinux. I'm assuming that the
> kernel has access to the added offset (I haven't looked). If it does, then
> we could allow users to just add something like "+@0xffffffffdeadbeef" and
> add the relocation offset to get to the mapped address of the function.
> 
> This would allow those without kallsym privileges to pass in kernel address
> for tracing.

This seems interesting but I am wondering about this when using KASLR.
Would it be possible to compute the final address as:
final_address = debuginfo_address + relocation_offset + kaslr_offset?
I will check regarding both the relocation offset and how KASLR works (I only 
know what it does, not how it does it).

Moreover, regarding accessing vmlinux, I can only think to access it through 
vmlinuz which is in /boot.
Sadly, you cannot read /boot/vmlinuz without being root on a several 
distributions.
Note that, the same occurs for /boot/System.map*.

> -- Steve

Best regards.



  reply	other threads:[~2023-08-18  9:02 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230816163517.112518-1-flaniel@linux.microsoft.com>
2023-08-16 16:35 ` [RFC PATCH v1 1/1] tracing/kprobe: Add multi-probe support for 'perf_kprobe' PMU Francis Laniel
2023-08-16 18:42   ` Steven Rostedt
2023-08-17 10:59     ` Francis Laniel
2023-08-17 15:13       ` Steven Rostedt
2023-08-18  9:01         ` Francis Laniel [this message]
2023-08-18 12:37         ` Masami Hiramatsu
2023-08-18 15:41           ` Steven Rostedt
2023-08-18 18:13             ` Francis Laniel
2023-08-18 18:20               ` Steven Rostedt
2023-08-19  1:15                 ` Masami Hiramatsu
2023-08-19 15:22                   ` Song Liu
2023-08-20  9:32                     ` Masami Hiramatsu
2023-08-20 10:02                       ` Song Liu
2023-08-20 13:16                         ` Masami Hiramatsu
2023-08-21  6:09                           ` Song Liu
2023-08-21 10:01                             ` Masami Hiramatsu
2023-08-21 14:45                               ` Steven Rostedt
2023-08-21 18:07                                 ` Kees Cook
2023-08-21 14:29                         ` Steven Rostedt
2023-08-21 15:19                           ` Masami Hiramatsu
2023-08-21 15:28                             ` Steven Rostedt
2023-08-17  7:50   ` Masami Hiramatsu
2023-08-17 11:06     ` Francis Laniel
2023-08-18 13:05       ` Masami Hiramatsu
2023-08-18 18:12         ` Francis Laniel
2023-08-19  1:11           ` Masami Hiramatsu
2023-08-20 20:23             ` Jiri Olsa
2023-08-21 12:22               ` Francis Laniel
2023-08-20 20:34             ` Jiri Olsa
2023-08-21 12:24               ` Francis Laniel
2023-08-22 13:13                 ` Jiri Olsa
2023-08-21 12:55             ` Francis Laniel
2023-08-23  0:36               ` Masami Hiramatsu
2023-08-23  9:54                 ` Francis Laniel
2023-08-23 13:45                   ` Masami Hiramatsu

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=5702105.DvuYhMxLoT@pwmachine \
    --to=flaniel@linux.microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).