live-patching.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Evgenii Shatokhin <eshatokhin@virtuozzo.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Kristen Carlson Accardi <kristen@linux.intel.com>,
	live-patching@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org,
	Konstantin Khorenko <khorenko@virtuozzo.com>
Subject: Re: 'perf probe' and symbols from .text.<something>
Date: Thu, 18 Feb 2021 13:35:08 -0600	[thread overview]
Message-ID: <20210218193508.mw6ugmh6bjlplbwe@treble> (raw)
In-Reply-To: <09257fb8-3ded-07b0-b3cc-55d5431698d8@virtuozzo.com>

On Thu, Feb 18, 2021 at 08:09:17PM +0300, Evgenii Shatokhin wrote:
> Is there a way to allow probing of functions in .text.<something> ?
> 
> Of course, one could place probes using absolute addresses of the functions
> but that would be less convenient.
> 
> This also affects many livepatch modules where the kernel code can be
> compiled with -ffunction-sections and each function may end up in a separate
> section .text.<function_name>. 'perf probe' cannot be used there, except
> with the absolute addresses.
> 
> Moreover, if FGKASLR patches are merged (https://lwn.net/Articles/832434/)
> and the kernel is built with FGKASLR enabled, -ffunction-sections will be
> used too. 'perf probe' will be unable to see the kernel functions then.

A hack fix like the below would probably work, but as you pointed out,
FGKASLR is going to be a problem.  I suspect the proper fix is for perf
to learn how to deal with multiple executable ELF sections.

diff --git a/scripts/module.lds.S b/scripts/module.lds.S
index 69b9b71a6a47..0c522a87f6ce 100644
--- a/scripts/module.lds.S
+++ b/scripts/module.lds.S
@@ -4,6 +4,10 @@
  * combine them automatically.
  */
 SECTIONS {
+	.text : {
+		*(.text)
+		*(.text.*)
+	}
 	/DISCARD/ : {
 		*(.discard)
 		*(.discard.*)


  reply	other threads:[~2021-02-18 19:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-18 17:09 Evgenii Shatokhin
2021-02-18 19:35 ` Josh Poimboeuf [this message]
2021-02-22 15:05 ` Masami Hiramatsu
2021-02-22 15:12   ` Masami Hiramatsu
2021-02-22 17:51   ` Josh Poimboeuf
2021-02-23  1:23     ` Masami Hiramatsu
2021-02-23  7:36       ` Masami Hiramatsu
2021-02-23 19:45         ` Josh Poimboeuf
2021-02-24  8:00           ` Masami Hiramatsu
2021-02-23  1:48   ` [PATCH] perf-probe: Failback to symbol-base probe for probes on module Masami Hiramatsu
2021-02-23  7:36     ` Masami Hiramatsu
2021-02-23  7:09   ` 'perf probe' and symbols from .text.<something> Masami Hiramatsu
2021-02-23  7:37   ` [PATCH] perf-probe: dso: Add symbols in .text.* subsections to text symbol map in kenrel modules Masami Hiramatsu
2021-02-23 15:02     ` Evgenii Shatokhin
2021-02-23 20:11       ` Arnaldo Carvalho de Melo
2021-02-24  7:47         ` Evgenii Shatokhin

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=20210218193508.mw6ugmh6bjlplbwe@treble \
    --to=jpoimboe@redhat.com \
    --cc=acme@kernel.org \
    --cc=eshatokhin@virtuozzo.com \
    --cc=khorenko@virtuozzo.com \
    --cc=kristen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --subject='Re: '\''perf probe'\'' and symbols from .text.<something>' \
    /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

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).