From: Haiyue Wang <haiyuewa@163.com>
To: Peter Zijlstra <peterz@infradead.org>,
Masami Hiramatsu <mhiramat@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Gabriel de Perthuis <g2p.code@gmail.com>,
Sami Tolvanen <samitolvanen@google.com>,
Mark Rutland <mark.rutland@arm.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H . Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, linux-trace-kernel@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ftrace: x86: Fix a compile error about get_kernel_nofault()
Date: Thu, 6 Feb 2025 21:25:37 +0800 [thread overview]
Message-ID: <b4ef10d0-a1eb-4d9c-8ddc-d7815a2bb607@163.com> (raw)
In-Reply-To: <20250206123307.GO7145@noisy.programming.kicks-ass.net>
On 2025/2/6 20:33, Peter Zijlstra wrote:
> On Thu, Feb 06, 2025 at 01:13:28PM +0100, Peter Zijlstra wrote:
>
>> No, it just cleans up this utter trainwreck. I also noticed this is a
>> second (new) copy of this garbage. Clearly I didn't yell loud enough
>> last time and people didn't think to vomit when doing the copy/paste :/
>>
>> Function will look something like:
>>
>> unsigned long arch_ftrace_get_symaddr(unsigned long fentry_ip)
>> {
>> if (is_endbr(fentry_ip - ENDBR_INSN_SIZE))
>> fentry_op -= ENDBR_INSN_SIZE;
>> return fentry_ip;
>> }
>>
>> Let me finish local build test before I push out.
>
> Bah, still waiting for a LLVM build, but patch should be here:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git x86/ibt
>
> I was supposed to merge this last cycle, but then akpm shat all over
> arch/x86/kernel/alternative.c and we had to clean that up :/
>
> Notably, this patch, not sure it applies out of order.
>
> ---
>
> Subject: x86/ibt: Clean up is_endbr()
> From: Peter Zijlstra <peterz@infradead.org>
> Date: Mon Nov 27 09:58:06 CET 2023
>
> Pretty much every caller of is_endbr() actually wants to test something at an
> address and ends up doing get_kernel_nofault(). Fold the lot into a more
> convenient helper.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> Acked-by: Alexei Starovoitov <ast@kernel.org>
> Acked-by: Andrii Nakryiko <andrii@kernel.org>
> ---
> arch/x86/events/core.c | 2 +-
> arch/x86/include/asm/ftrace.h | 17 +++--------------
> arch/x86/include/asm/ibt.h | 5 +++--
> arch/x86/kernel/alternative.c | 20 ++++++++++++++------
> arch/x86/kernel/kprobes/core.c | 11 +----------
> arch/x86/net/bpf_jit_comp.c | 4 ++--
> kernel/trace/bpf_trace.c | 20 +++-----------------
> 7 files changed, 27 insertions(+), 52 deletions(-)
>
> --- a/arch/x86/events/core.c
> +++ b/arch/x86/events/core.c
> @@ -2857,7 +2857,7 @@ static bool is_uprobe_at_func_entry(stru
> return true;
>
> /* endbr64 (64-bit only) */
> - if (user_64bit_mode(regs) && is_endbr(*(u32 *)auprobe->insn))
> + if (user_64bit_mode(regs) && is_endbr((u32 *)auprobe->insn))
> return true;
>
> return false;
> --- a/arch/x86/include/asm/ftrace.h
> +++ b/arch/x86/include/asm/ftrace.h
> @@ -2,6 +2,7 @@
> #ifndef _ASM_X86_FTRACE_H
> #define _ASM_X86_FTRACE_H
>
> +#include "asm/ibt.h"
Then
https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/tree/arch/x86/include/asm/ftrace.h?h=x86/ibt#n17
# include <asm/ibt.h> --> This line can be removed ?
> #include <asm/ptrace.h>
>
> #ifdef CONFIG_FUNCTION_TRACER
> @@ -36,21 +37,9 @@ static inline unsigned long ftrace_call_
>
> static inline unsigned long arch_ftrace_get_symaddr(unsigned long fentry_ip)
> {
next prev parent reply other threads:[~2025-02-06 13:26 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-06 3:12 Masami Hiramatsu (Google)
2025-02-06 8:12 ` Peter Zijlstra
2025-02-06 11:54 ` Masami Hiramatsu
2025-02-06 12:13 ` Peter Zijlstra
2025-02-06 12:33 ` Peter Zijlstra
2025-02-06 13:25 ` Haiyue Wang [this message]
2025-02-07 10:09 ` Peter Zijlstra
2025-02-06 23:59 ` Masami Hiramatsu
2025-02-10 22:30 ` Steven Rostedt
2025-02-11 10:09 ` Peter Zijlstra
2025-02-11 15:50 ` Steven Rostedt
2025-02-12 16:52 ` Sami Tolvanen
2025-02-13 10:08 ` Peter Zijlstra
2025-02-13 10:25 ` Haiyue Wang
2025-02-13 10:40 ` Peter Zijlstra
2025-02-13 10:50 ` Haiyue Wang
2025-02-13 10:26 ` Peter Zijlstra
2025-02-13 13:35 ` Masami Hiramatsu
2025-02-13 0:03 ` Masami Hiramatsu
2025-02-06 18:19 ` Gabriel de Perthuis
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=b4ef10d0-a1eb-4d9c-8ddc-d7815a2bb607@163.com \
--to=haiyuewa@163.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=g2p.code@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=samitolvanen@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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
all inboxes | Powered by JetHome®