public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/alternative: move apply_relocation() out of init section
@ 2023-12-04  7:28 Arnd Bergmann
  2023-12-09  1:33 ` kernel test robot
  2023-12-19 13:33 ` [tip: x86/percpu] x86/alternatives: Move " tip-bot2 for Arnd Bergmann
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2023-12-04  7:28 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	Uros Bizjak
  Cc: Arnd Bergmann, H. Peter Anvin, Peter Zijlstra, Kees Cook,
	Sami Tolvanen, Josh Poimboeuf, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

This function is now called from a few places that are no __init_or_module,
resulting a link time warning:

WARNING: modpost: vmlinux: section mismatch in reference: patch_dest+0x8a (section: .text) -> apply_relocation (section: .init.text)

Remove the annotation here.

Fixes: 17bce3b2ae2d ("x86/callthunks: Handle %rip-relative relocations in call thunk template")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
Not entire sure about this one, it does address the warning, but it
might be possible to find and change all the callers instead if they
fit the __init_or_module pattern.
---
 arch/x86/kernel/alternative.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index d973bcf7db78..4a25642ab714 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -44,7 +44,7 @@ EXPORT_SYMBOL_GPL(alternatives_patched);
 #define DA_ENDBR	0x08
 #define DA_SMP		0x10
 
-static unsigned int __initdata_or_module debug_alternative;
+static unsigned int debug_alternative;
 
 static int __init debug_alt(char *str)
 {
@@ -206,7 +206,7 @@ static int skip_nops(u8 *instr, int offset, int len)
  * Optimize a sequence of NOPs, possibly preceded by an unconditional jump
  * to the end of the NOP sequence into a single NOP.
  */
-static bool __init_or_module
+static bool
 __optimize_nops(u8 *instr, size_t len, struct insn *insn, int *next, int *prev, int *target)
 {
 	int i = *next - insn->length;
@@ -325,7 +325,7 @@ bool need_reloc(unsigned long offset, u8 *src, size_t src_len)
 	return (target < src || target > src + src_len);
 }
 
-void __init_or_module apply_relocation(u8 *buf, size_t len, u8 *dest, u8 *src, size_t src_len)
+void apply_relocation(u8 *buf, size_t len, u8 *dest, u8 *src, size_t src_len)
 {
 	int prev, target = 0;
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/alternative: move apply_relocation() out of init section
  2023-12-04  7:28 [PATCH] x86/alternative: move apply_relocation() out of init section Arnd Bergmann
@ 2023-12-09  1:33 ` kernel test robot
  2023-12-19 13:33 ` [tip: x86/percpu] x86/alternatives: Move " tip-bot2 for Arnd Bergmann
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2023-12-09  1:33 UTC (permalink / raw)
  To: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, Uros Bizjak
  Cc: llvm, oe-kbuild-all, Arnd Bergmann, H. Peter Anvin,
	Peter Zijlstra, Kees Cook, Sami Tolvanen, Josh Poimboeuf,
	linux-kernel

Hi Arnd,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tip/master]
[also build test WARNING on tip/x86/percpu next-20231208]
[cannot apply to tip/auto-latest linus/master v6.7-rc4]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Arnd-Bergmann/x86-alternative-move-apply_relocation-out-of-init-section/20231204-153129
base:   tip/master
patch link:    https://lore.kernel.org/r/20231204072856.1033621-1-arnd%40kernel.org
patch subject: [PATCH] x86/alternative: move apply_relocation() out of init section
config: i386-allnoconfig (https://download.01.org/0day-ci/archive/20231209/202312090936.qsdfR8TM-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231209/202312090936.qsdfR8TM-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312090936.qsdfR8TM-lkp@intel.com/

All warnings (new ones prefixed by >>, old ones prefixed by <<):

WARNING: modpost: missing MODULE_DESCRIPTION() in vmlinux.o
>> WARNING: modpost: vmlinux: section mismatch in reference: __optimize_nops+0xa7 (section: .text) -> add_nop (section: .init.text)

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip: x86/percpu] x86/alternatives: Move apply_relocation() out of init section
  2023-12-04  7:28 [PATCH] x86/alternative: move apply_relocation() out of init section Arnd Bergmann
  2023-12-09  1:33 ` kernel test robot
@ 2023-12-19 13:33 ` tip-bot2 for Arnd Bergmann
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Arnd Bergmann @ 2023-12-19 13:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Arnd Bergmann, Ingo Molnar, Uros Bizjak, x86, linux-kernel

The following commit has been merged into the x86/percpu branch of tip:

Commit-ID:     86ed430cf5296ca97a66f1f37e30b7dfe47cd36f
Gitweb:        https://git.kernel.org/tip/86ed430cf5296ca97a66f1f37e30b7dfe47cd36f
Author:        Arnd Bergmann <arnd@arndb.de>
AuthorDate:    Mon, 04 Dec 2023 08:28:41 +01:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 19 Dec 2023 14:21:49 +01:00

x86/alternatives: Move apply_relocation() out of init section

This function is now called from a few places that are no __init_or_module,
resulting a link time warning:

  WARNING: modpost: vmlinux: section mismatch in reference: patch_dest+0x8a (section: .text) -> apply_relocation (section: .init.text)

Remove the annotation here.

[ mingo: Also sync up add_nop() with these changes. ]

Fixes: 17bce3b2ae2d ("x86/callthunks: Handle %rip-relative relocations in call thunk template")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Uros Bizjak <ubizjak@gmail.com>
Link: https://lore.kernel.org/r/20231204072856.1033621-1-arnd@kernel.org
---
 arch/x86/kernel/alternative.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 5052371..1781e02 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -44,7 +44,7 @@ EXPORT_SYMBOL_GPL(alternatives_patched);
 #define DA_ENDBR	0x08
 #define DA_SMP		0x10
 
-static unsigned int __initdata_or_module debug_alternative;
+static unsigned int debug_alternative;
 
 static int __init debug_alt(char *str)
 {
@@ -132,7 +132,7 @@ const unsigned char * const x86_nops[ASM_NOP_MAX+1] =
  * each single-byte NOPs). If @len to fill out is > ASM_NOP_MAX, pad with INT3 and
  * *jump* over instead of executing long and daft NOPs.
  */
-static void __init_or_module add_nop(u8 *instr, unsigned int len)
+static void add_nop(u8 *instr, unsigned int len)
 {
 	u8 *target = instr + len;
 
@@ -206,7 +206,7 @@ static int skip_nops(u8 *instr, int offset, int len)
  * Optimize a sequence of NOPs, possibly preceded by an unconditional jump
  * to the end of the NOP sequence into a single NOP.
  */
-static bool __init_or_module
+static bool
 __optimize_nops(u8 *instr, size_t len, struct insn *insn, int *next, int *prev, int *target)
 {
 	int i = *next - insn->length;
@@ -325,7 +325,7 @@ bool need_reloc(unsigned long offset, u8 *src, size_t src_len)
 	return (target < src || target > src + src_len);
 }
 
-void __init_or_module apply_relocation(u8 *buf, size_t len, u8 *dest, u8 *src, size_t src_len)
+void apply_relocation(u8 *buf, size_t len, u8 *dest, u8 *src, size_t src_len)
 {
 	int prev, target = 0;
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-19 13:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-04  7:28 [PATCH] x86/alternative: move apply_relocation() out of init section Arnd Bergmann
2023-12-09  1:33 ` kernel test robot
2023-12-19 13:33 ` [tip: x86/percpu] x86/alternatives: Move " tip-bot2 for Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox