From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id EC9FF1580EB for ; Wed, 28 May 2025 14:02:50 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id D3DA034314D for ; Wed, 28 May 2025 14:02:50 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id A44B1110287; Wed, 28 May 2025 14:02:49 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id 9AC59110287 for ; Wed, 28 May 2025 14:02:49 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 4385234308A for ; Wed, 28 May 2025 14:02:49 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A8028254C for ; Wed, 28 May 2025 14:02:47 +0000 (UTC) From: "Mike Pagano" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Pagano" Message-ID: <1748440940.268f211d274fd5f502d17d16f0e50e12a4ded631.mpagano@gentoo> Subject: [gentoo-commits] proj/linux-patches:6.14 commit in: / X-VCS-Repository: proj/linux-patches X-VCS-Files: 0000_README 1710_ftrace-x86-Fix-compile-err-get_kernel_nofault.patch X-VCS-Directories: / X-VCS-Committer: mpagano X-VCS-Committer-Name: Mike Pagano X-VCS-Revision: 268f211d274fd5f502d17d16f0e50e12a4ded631 X-VCS-Branch: 6.14 Date: Wed, 28 May 2025 14:02:47 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: dd0152ce-e1ec-4d8c-a95b-2d5d1f92d4ed X-Archives-Hash: ba50b84eeda3eef06c175d2433533c14 commit: 268f211d274fd5f502d17d16f0e50e12a4ded631 Author: Mike Pagano gentoo org> AuthorDate: Wed May 28 14:02:20 2025 +0000 Commit: Mike Pagano gentoo org> CommitDate: Wed May 28 14:02:20 2025 +0000 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=268f211d ftrace: x86: Fix a compile error about get_kernel_nofault() Bug: https://bugs.gentoo.org/956059 Signed-off-by: Mike Pagano gentoo.org> 0000_README | 4 + ...ce-x86-Fix-compile-err-get_kernel_nofault.patch | 119 +++++++++++++++++++++ 2 files changed, 123 insertions(+) diff --git a/0000_README b/0000_README index e3e2e7cb..459563fb 100644 --- a/0000_README +++ b/0000_README @@ -82,6 +82,10 @@ Patch: 1700_sparc-address-warray-bound-warnings.patch From: https://github.com/KSPP/linux/issues/109 Desc: Address -Warray-bounds warnings +Patch: 1710_ftrace-x86-Fix-compile-err-get_kernel_nofault.patch +From: https://lore.kernel.org/all/173881156244.211648.1242168038709680511.stgit@devnote2/ +Desc: ftrace: x86: Fix a compile error about get_kernel_nofault() + Patch: 1730_parisc-Disable-prctl.patch From: https://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux.git Desc: prctl: Temporarily disable prctl(PR_SET_MDWE) on parisc diff --git a/1710_ftrace-x86-Fix-compile-err-get_kernel_nofault.patch b/1710_ftrace-x86-Fix-compile-err-get_kernel_nofault.patch new file mode 100644 index 00000000..ad8cd545 --- /dev/null +++ b/1710_ftrace-x86-Fix-compile-err-get_kernel_nofault.patch @@ -0,0 +1,119 @@ +From git@z Thu Jan 1 00:00:00 1970 +Subject: [PATCH] ftrace: x86: Fix a compile error about + get_kernel_nofault() +From: "Masami Hiramatsu (Google)" +Date: Thu, 06 Feb 2025 12:12:42 +0900 +Message-Id: <173881156244.211648.1242168038709680511.stgit@devnote2> +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 7bit + +Fix a compile error about get_kernel_nofault() which is defined in the +linux/uaccess.h. Since asm/ftrace.h is widely used, including +linux/uaccess.h in asm/ftrace.h caused another error. Thus this +moves arch_ftrace_get_symaddr() into arch/x86/kernel/ftrace.c. + +The original errors look like: + +In file included from ./arch/x86/include/asm/asm-prototypes.h:2, + from :3: +./arch/x86/include/asm/ftrace.h: In function 'arch_ftrace_get_symaddr': +./arch/x86/include/asm/ftrace.h:46:21: error: implicit declaration of function 'get_kernel_nofault' [-Werror=implicit-function-declaration] + 46 | if (get_kernel_nofault(instr, (u32 *)(fentry_ip - ENDBR_INSN_SIZE))) + | ^~~~~~~~~~~~~~~~~~ + +This also makes ftrace_get_symaddr() available only when +CONFIG_HAVE_FENTRY=y on x86. + +Reported-by: Gabriel de Perthuis +Closes: https://lore.kernel.org/all/a87f98bf-45b1-4ef5-aa77-02f7e61203f4@gmail.com/ +Reported-by: Haiyue Wang +Closes: https://lore.kernel.org/all/20250205180116.88644-1-haiyuewa@163.com/ +Fixes: 2bc56fdae1ba ("ftrace: Add ftrace_get_symaddr to convert fentry_ip to symaddr") +Signed-off-by: Masami Hiramatsu (Google) +Acked-by: Masami Hiramatsu (Google) +Signed-off-by: Peter Zijlstra (Intel) +Acked-by: Alexei Starovoitov +Acked-by: Andrii Nakryiko +--- + arch/x86/include/asm/ftrace.h | 23 ++++------------------- + arch/x86/kernel/ftrace.c | 26 +++++++++++++++++++++++++- + 2 files changed, 29 insertions(+), 20 deletions(-) + +diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h +index f9cb4d07df58..1ed08f2de366 100644 +--- a/arch/x86/include/asm/ftrace.h ++++ b/arch/x86/include/asm/ftrace.h +@@ -34,26 +34,11 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr) + return addr; + } + +-static inline unsigned long arch_ftrace_get_symaddr(unsigned long fentry_ip) +-{ +-#ifdef CONFIG_X86_KERNEL_IBT +- u32 instr; +- +- /* We want to be extra safe in case entry ip is on the page edge, +- * but otherwise we need to avoid get_kernel_nofault()'s overhead. +- */ +- if ((fentry_ip & ~PAGE_MASK) < ENDBR_INSN_SIZE) { +- if (get_kernel_nofault(instr, (u32 *)(fentry_ip - ENDBR_INSN_SIZE))) +- return fentry_ip; +- } else { +- instr = *(u32 *)(fentry_ip - ENDBR_INSN_SIZE); +- } +- if (is_endbr(instr)) +- fentry_ip -= ENDBR_INSN_SIZE; +-#endif +- return fentry_ip; +-} ++/* This does not support mcount. */ ++#ifdef CONFIG_HAVE_FENTRY ++unsigned long arch_ftrace_get_symaddr(unsigned long fentry_ip); + #define ftrace_get_symaddr(fentry_ip) arch_ftrace_get_symaddr(fentry_ip) ++#endif + + #ifdef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS + +diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c +index 166bc0ea3bdf..7250118005fc 100644 +--- a/arch/x86/kernel/ftrace.c ++++ b/arch/x86/kernel/ftrace.c +@@ -29,11 +29,35 @@ + + #include + +-#include + #include ++#include ++#include + #include + #include + ++#ifdef CONFIG_HAVE_FENTRY ++/* Convert fentry address to the symbol address. */ ++unsigned long arch_ftrace_get_symaddr(unsigned long fentry_ip) ++{ ++#ifdef CONFIG_X86_KERNEL_IBT ++ u32 instr; ++ ++ /* We want to be extra safe in case entry ip is on the page edge, ++ * but otherwise we need to avoid get_kernel_nofault()'s overhead. ++ */ ++ if ((fentry_ip & ~PAGE_MASK) < ENDBR_INSN_SIZE) { ++ if (get_kernel_nofault(instr, (u32 *)(fentry_ip - ENDBR_INSN_SIZE))) ++ return fentry_ip; ++ } else { ++ instr = *(u32 *)(fentry_ip - ENDBR_INSN_SIZE); ++ } ++ if (is_endbr(instr)) ++ fentry_ip -= ENDBR_INSN_SIZE; ++#endif ++ return fentry_ip; ++} ++#endif ++ + #ifdef CONFIG_DYNAMIC_FTRACE + + static int ftrace_poke_late = 0; +