linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Zheng Yejian <zhengyejian1@huawei.com>
Cc: Martin Kelly <martin.kelly@crowdstrike.com>,
	"masahiroy@kernel.org" <masahiroy@kernel.org>,
	"ojeda@kernel.org" <ojeda@kernel.org>,
	"jpoimboe@kernel.org" <jpoimboe@kernel.org>,
	"pasha.tatashin@soleen.com" <pasha.tatashin@soleen.com>,
	"mhiramat@kernel.org" <mhiramat@kernel.org>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"james.clark@arm.com" <james.clark@arm.com>,
	"mpe@ellerman.id.au" <mpe@ellerman.id.au>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"nicolas@fjasle.eu" <nicolas@fjasle.eu>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"christophe.leroy@csgroup.eu" <christophe.leroy@csgroup.eu>,
	"nathan@kernel.org" <nathan@kernel.org>,
	"npiggin@gmail.com" <npiggin@gmail.com>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"surenb@google.com" <surenb@google.com>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"naveen.n.rao@linux.ibm.com" <naveen.n.rao@linux.ibm.com>,
	"kent.overstreet@linux.dev" <kent.overstreet@linux.dev>,
	"bp@alien8.de" <bp@alien8.de>,
	"yeweihua4@huawei.com" <yeweihua4@huawei.com>,
	"mathieu.desnoyers@efficios.com" <mathieu.desnoyers@efficios.com>,
	"mcgrof@kernel.org" <mcgrof@kernel.org>,
	Amit Dang <amit.dang@crowdstrike.com>,
	"linux-modules@vger.kernel.org" <linux-modules@vger.kernel.org>,
	"linux-kbuild@vger.kernel.org" <linux-kbuild@vger.kernel.org>,
	"x86@kernel.org" <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"linux-trace-kernel@vger.kernel.org"
	<linux-trace-kernel@vger.kernel.org>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>
Subject: Re: [PATCH v2 0/5] kallsyms: Emit symbol for holes in text and fix weak function issue
Date: Tue, 21 Jan 2025 12:48:51 -0500	[thread overview]
Message-ID: <20250121124851.2205a8b2@gandalf.local.home> (raw)
In-Reply-To: <7266ee61-3085-74fc-2560-c62fc34c2148@huawei.com>


Sorry for the late reply. Forgot about this as I was focused on other end-of-year issues.

On Sat, 14 Dec 2024 16:37:59 +0800
Zheng Yejian <zhengyejian1@huawei.com> wrote:

> The direct cause of this issue is the wrong fentry being founded by ftrace_location(),
> following the approach of "FTRACE_MCOUNT_MAX_OFFSET", narrowing down the search range
> and re-finding may also solve this problem, demo patch like below (not
> fully tested):
> 
>      diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
>      index 9b17efb1a87d..7d34320ca9d1 100644
>      --- a/kernel/trace/ftrace.c
>      +++ b/kernel/trace/ftrace.c
>      @@ -1678,8 +1678,11 @@ unsigned long ftrace_location(unsigned long ip)
>                              goto out;
>      
>                      /* map sym+0 to __fentry__ */
>      -               if (!offset)
>      +               if (!offset) {
>                              loc = ftrace_location_range(ip, ip + size - 1);
>      +                       while (loc > ip && loc - ip > FTRACE_MCOUNT_MAX_OFFSET)
>      +                               loc = ftrace_location_range(ip, loc - 1);
>      +               }
>              }
> 
> Steve, Peter, what do you think?

Hmm, removing the weak functions from the __mcount_loc location should also
solve this, as the ftrace_location_range() will not return a weak function
if it's not part of the __mcount_loc table.

That is, would this patchset work?

  https://lore.kernel.org/all/20250102232609.529842248@goodmis.org/

-- Steve


  reply	other threads:[~2025-01-21 17:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-23  6:32 [PATCH v2 0/5] kallsyms: Emit symbol for holes in text and fix weak function issue Zheng Yejian
2024-07-23  6:32 ` [PATCH v2 1/5] kallsyms: Emit symbol at the holes in the text Zheng Yejian
2024-07-24  1:51   ` kernel test robot
2024-07-24  5:11   ` kernel test robot
2024-07-23  6:32 ` [PATCH v2 2/5] module: kallsyms: Determine exact function size Zheng Yejian
2024-07-23  6:32 ` [PATCH v2 3/5] ftrace: Skip invalid __fentry__ in ftrace_process_locs() Zheng Yejian
2024-07-23  6:32 ` [PATCH v2 4/5] ftrace: Fix possible out-of-bound issue " Zheng Yejian
2024-07-23  6:32 ` [PATCH v2 5/5] ftrace: Revert the FTRACE_MCOUNT_MAX_OFFSET workaround Zheng Yejian
2024-12-10 19:15 ` [PATCH v2 0/5] kallsyms: Emit symbol for holes in text and fix weak function issue Martin Kelly
2024-12-10 20:01   ` Christophe Leroy
2024-12-10 20:49     ` Martin Kelly
2024-12-12  9:52       ` Zheng Yejian
2024-12-13 19:31         ` Martin Kelly
2024-12-14  8:37           ` Zheng Yejian
2025-01-21 17:48             ` Steven Rostedt [this message]
2025-02-07  3:16               ` Zheng Yejian

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=20250121124851.2205a8b2@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=amit.dang@crowdstrike.com \
    --cc=bp@alien8.de \
    --cc=bpf@vger.kernel.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=james.clark@arm.com \
    --cc=jpoimboe@kernel.org \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mark.rutland@arm.com \
    --cc=martin.kelly@crowdstrike.com \
    --cc=masahiroy@kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mcgrof@kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=nathan@kernel.org \
    --cc=naveen.n.rao@linux.ibm.com \
    --cc=nicolas@fjasle.eu \
    --cc=npiggin@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=pasha.tatashin@soleen.com \
    --cc=peterz@infradead.org \
    --cc=surenb@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=yeweihua4@huawei.com \
    --cc=zhengyejian1@huawei.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 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).