[tip:,x86/percpu] x86/callthunks: Mark apply_relocation() as __init_or_module

Message ID 170137899106.398.14613676631297252898.tip-bot2@tip-bot2
State New
Headers
Series [tip:,x86/percpu] x86/callthunks: Mark apply_relocation() as __init_or_module |

Commit Message

tip-bot2 for Thomas Gleixner Nov. 30, 2023, 9:16 p.m. UTC
  The following commit has been merged into the x86/percpu branch of tip:

Commit-ID:     6724ba89e0b03667d56616614f55e1f772d38fdb
Gitweb:        https://git.kernel.org/tip/6724ba89e0b03667d56616614f55e1f772d38fdb
Author:        Ingo Molnar <mingo@kernel.org>
AuthorDate:    Thu, 30 Nov 2023 20:15:51 +01:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Thu, 30 Nov 2023 20:15:51 +01:00

x86/callthunks: Mark apply_relocation() as __init_or_module

Do it like the rest of the methods using it.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Uros Bizjak <ubizjak@gmail.com>
Link: https://lore.kernel.org/r/20231105213731.1878100-3-ubizjak@gmail.com
---
 arch/x86/include/asm/text-patching.h | 2 +-
 arch/x86/kernel/alternative.c        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
  

Comments

Borislav Petkov Dec. 7, 2023, 11:15 a.m. UTC | #1
On Thu, Nov 30, 2023 at 09:16:31PM -0000, tip-bot2 for Ingo Molnar wrote:
> -void apply_relocation(u8 *buf, size_t len, u8 *dest, u8 *src, size_t src_len)
> +void __init_or_module apply_relocation(u8 *buf, size_t len, u8 *dest, u8 *src, size_t src_len)
>  {
>  	int prev, target = 0;

Can't do that for a CONFIG_MODULES=n build:

WARNING: modpost: vmlinux: section mismatch in reference: patch_dest+0x61 (section: .text) -> apply_relocation (section: .init.text)
ERROR: modpost: Section mismatches detected.
  

Patch

diff --git a/arch/x86/include/asm/text-patching.h b/arch/x86/include/asm/text-patching.h
index ba8d900..fb338f0 100644
--- a/arch/x86/include/asm/text-patching.h
+++ b/arch/x86/include/asm/text-patching.h
@@ -18,7 +18,7 @@  static inline void apply_paravirt(struct paravirt_patch_site *start,
 #define __parainstructions_end	NULL
 #endif
 
-void apply_relocation(u8 *buf, size_t len, u8 *dest, u8 *src, size_t src_len);
+extern void apply_relocation(u8 *buf, size_t len, u8 *dest, u8 *src, size_t src_len);
 
 /*
  * Currently, the max observed size in the kernel code is
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index aa86415..5052371 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -325,7 +325,7 @@  bool need_reloc(unsigned long offset, u8 *src, size_t src_len)
 	return (target < src || target > src + src_len);
 }
 
-void apply_relocation(u8 *buf, size_t len, u8 *dest, u8 *src, size_t src_len)
+void __init_or_module apply_relocation(u8 *buf, size_t len, u8 *dest, u8 *src, size_t src_len)
 {
 	int prev, target = 0;