[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250121124851.2205a8b2@gandalf.local.home>
Date: Tue, 21 Jan 2025 12:48:51 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Zheng Yejian <zhengyejian1@...wei.com>
Cc: Martin Kelly <martin.kelly@...wdstrike.com>, "masahiroy@...nel.org"
<masahiroy@...nel.org>, "ojeda@...nel.org" <ojeda@...nel.org>,
"jpoimboe@...nel.org" <jpoimboe@...nel.org>, "pasha.tatashin@...een.com"
<pasha.tatashin@...een.com>, "mhiramat@...nel.org" <mhiramat@...nel.org>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"james.clark@....com" <james.clark@....com>, "mpe@...erman.id.au"
<mpe@...erman.id.au>, "akpm@...ux-foundation.org"
<akpm@...ux-foundation.org>, "mingo@...hat.com" <mingo@...hat.com>,
"nicolas@...sle.eu" <nicolas@...sle.eu>, "tglx@...utronix.de"
<tglx@...utronix.de>, "christophe.leroy@...roup.eu"
<christophe.leroy@...roup.eu>, "nathan@...nel.org" <nathan@...nel.org>,
"npiggin@...il.com" <npiggin@...il.com>, "mark.rutland@....com"
<mark.rutland@....com>, "hpa@...or.com" <hpa@...or.com>,
"surenb@...gle.com" <surenb@...gle.com>, "peterz@...radead.org"
<peterz@...radead.org>, "naveen.n.rao@...ux.ibm.com"
<naveen.n.rao@...ux.ibm.com>, "kent.overstreet@...ux.dev"
<kent.overstreet@...ux.dev>, "bp@...en8.de" <bp@...en8.de>,
"yeweihua4@...wei.com" <yeweihua4@...wei.com>,
"mathieu.desnoyers@...icios.com" <mathieu.desnoyers@...icios.com>,
"mcgrof@...nel.org" <mcgrof@...nel.org>, Amit Dang
<amit.dang@...wdstrike.com>, "linux-modules@...r.kernel.org"
<linux-modules@...r.kernel.org>, "linux-kbuild@...r.kernel.org"
<linux-kbuild@...r.kernel.org>, "x86@...nel.org" <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
"linux-trace-kernel@...r.kernel.org" <linux-trace-kernel@...r.kernel.org>,
"bpf@...r.kernel.org" <bpf@...r.kernel.org>
Subject: Re: [PATCH v2 0/5] kallsyms: Emit symbol for holes in text and fix
weak function issue
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@...wei.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
Powered by blists - more mailing lists