* [tip:x86/core 16/17] vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60
@ 2025-03-02 23:47 kernel test robot
2025-03-03 9:24 ` Peter Zijlstra
0 siblings, 1 reply; 8+ messages in thread
From: kernel test robot @ 2025-03-02 23:47 UTC (permalink / raw)
To: Peter Zijlstra
Cc: llvm, oe-kbuild-all, linux-kernel, x86, Ingo Molnar, Kees Cook
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/core
head: dfebe7362f6f461d771cdb9ac2c5172a4721f064
commit: 0c92385dc05ee9637c04372ea95a11bbf6e010ff [16/17] x86/ibt: Implement FineIBT-BHI mitigation
config: x86_64-randconfig-071-20250303 (https://download.01.org/0day-ci/archive/20250303/202503030704.H9KFysNS-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250303/202503030704.H9KFysNS-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/202503030704.H9KFysNS-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [tip:x86/core 16/17] vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60
2025-03-02 23:47 [tip:x86/core 16/17] vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60 kernel test robot
@ 2025-03-03 9:24 ` Peter Zijlstra
2025-03-03 9:43 ` Peter Zijlstra
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Peter Zijlstra @ 2025-03-03 9:24 UTC (permalink / raw)
To: kernel test robot
Cc: llvm, oe-kbuild-all, linux-kernel, x86, Ingo Molnar, Kees Cook
On Mon, Mar 03, 2025 at 07:47:57AM +0800, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/core
> head: dfebe7362f6f461d771cdb9ac2c5172a4721f064
> commit: 0c92385dc05ee9637c04372ea95a11bbf6e010ff [16/17] x86/ibt: Implement FineIBT-BHI mitigation
> config: x86_64-randconfig-071-20250303 (https://download.01.org/0day-ci/archive/20250303/202503030704.H9KFysNS-lkp@intel.com/config)
> compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250303/202503030704.H9KFysNS-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/202503030704.H9KFysNS-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> >> vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60
Thanks, below seems to cure it for me.
---
Subject: x86/ibt: Make cfi_bhi a constant for FINEIBT_BHI=n
From: Peter Zijlstra <peterz@infradead.org>
Date: Mon Mar 3 10:21:47 CET 2025
Robot yielded a .config that tripped:
vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60
This is the result of using __bhi_args[1] in unreachable code; make
sure the compiler is able to determine this is unreachable and trigger
DCE.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202503030704.H9KFysNS-lkp@intel.com/
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
arch/x86/include/asm/cfi.h | 5 +++++
arch/x86/kernel/alternative.c | 3 +++
2 files changed, 8 insertions(+)
--- a/arch/x86/include/asm/cfi.h
+++ b/arch/x86/include/asm/cfi.h
@@ -100,7 +100,12 @@ enum cfi_mode {
};
extern enum cfi_mode cfi_mode;
+
+#ifdef CONFIG_FINEIBT_BHI
extern bool cfi_bhi;
+#else
+#define cfi_bhi (0)
+#endif
typedef u8 bhi_thunk[32];
extern bhi_thunk __bhi_args[];
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -936,7 +936,10 @@ void __init_or_module apply_seal_endbr(s
#endif
enum cfi_mode cfi_mode __ro_after_init = __CFI_DEFAULT;
+
+#ifdef CONFIG_FINEIBT_BHI
bool cfi_bhi __ro_after_init = false;
+#endif
#ifdef CONFIG_CFI_CLANG
struct bpf_insn;
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [tip:x86/core 16/17] vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60
2025-03-03 9:24 ` Peter Zijlstra
@ 2025-03-03 9:43 ` Peter Zijlstra
2025-03-03 9:49 ` Peter Zijlstra
2025-03-03 17:11 ` [tip:x86/core 16/17] vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60 Kees Cook
2 siblings, 0 replies; 8+ messages in thread
From: Peter Zijlstra @ 2025-03-03 9:43 UTC (permalink / raw)
To: kernel test robot
Cc: llvm, oe-kbuild-all, linux-kernel, x86, Ingo Molnar, Kees Cook
On Mon, Mar 03, 2025 at 10:24:59AM +0100, Peter Zijlstra wrote:
> On Mon, Mar 03, 2025 at 07:47:57AM +0800, kernel test robot wrote:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/core
> > head: dfebe7362f6f461d771cdb9ac2c5172a4721f064
> > commit: 0c92385dc05ee9637c04372ea95a11bbf6e010ff [16/17] x86/ibt: Implement FineIBT-BHI mitigation
> > config: x86_64-randconfig-071-20250303 (https://download.01.org/0day-ci/archive/20250303/202503030704.H9KFysNS-lkp@intel.com/config)
> > compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250303/202503030704.H9KFysNS-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/202503030704.H9KFysNS-lkp@intel.com/
> >
> > All warnings (new ones prefixed by >>):
> >
> > >> vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60
>
> Thanks, below seems to cure it for me.
>
> ---
> Subject: x86/ibt: Make cfi_bhi a constant for FINEIBT_BHI=n
> From: Peter Zijlstra <peterz@infradead.org>
> Date: Mon Mar 3 10:21:47 CET 2025
>
> Robot yielded a .config that tripped:
>
> vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60
>
> This is the result of using __bhi_args[1] in unreachable code; make
> sure the compiler is able to determine this is unreachable and trigger
> DCE.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202503030704.H9KFysNS-lkp@intel.com/
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Durr, doesn't build with FINEIBT && FINEIBT_BHI=n, let me cure that.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [tip:x86/core 16/17] vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60
2025-03-03 9:24 ` Peter Zijlstra
2025-03-03 9:43 ` Peter Zijlstra
@ 2025-03-03 9:49 ` Peter Zijlstra
2025-03-03 10:02 ` [tip: x86/core] x86/ibt: Make cfi_bhi a constant for FINEIBT_BHI=n tip-bot2 for Peter Zijlstra
2025-03-03 17:11 ` [tip:x86/core 16/17] vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60 Kees Cook
2 siblings, 1 reply; 8+ messages in thread
From: Peter Zijlstra @ 2025-03-03 9:49 UTC (permalink / raw)
To: kernel test robot
Cc: llvm, oe-kbuild-all, linux-kernel, x86, Ingo Molnar, Kees Cook
On Mon, Mar 03, 2025 at 10:24:59AM +0100, Peter Zijlstra wrote:
> On Mon, Mar 03, 2025 at 07:47:57AM +0800, kernel test robot wrote:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/core
> > head: dfebe7362f6f461d771cdb9ac2c5172a4721f064
> > commit: 0c92385dc05ee9637c04372ea95a11bbf6e010ff [16/17] x86/ibt: Implement FineIBT-BHI mitigation
> > config: x86_64-randconfig-071-20250303 (https://download.01.org/0day-ci/archive/20250303/202503030704.H9KFysNS-lkp@intel.com/config)
> > compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250303/202503030704.H9KFysNS-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/202503030704.H9KFysNS-lkp@intel.com/
> >
> > All warnings (new ones prefixed by >>):
> >
> > >> vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60
>
> Thanks, below seems to cure it for me.
>
> ---
> Subject: x86/ibt: Make cfi_bhi a constant for FINEIBT_BHI=n
> From: Peter Zijlstra <peterz@infradead.org>
> Date: Mon Mar 3 10:21:47 CET 2025
>
> Robot yielded a .config that tripped:
>
> vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60
>
> This is the result of using __bhi_args[1] in unreachable code; make
> sure the compiler is able to determine this is unreachable and trigger
> DCE.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202503030704.H9KFysNS-lkp@intel.com/
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
diff --git a/arch/x86/include/asm/cfi.h b/arch/x86/include/asm/cfi.h
index 2f6a01f098b5..3e51ba459154 100644
--- a/arch/x86/include/asm/cfi.h
+++ b/arch/x86/include/asm/cfi.h
@@ -100,7 +100,12 @@ enum cfi_mode {
};
extern enum cfi_mode cfi_mode;
+
+#ifdef CONFIG_FINEIBT_BHI
extern bool cfi_bhi;
+#else
+#define cfi_bhi (0)
+#endif
typedef u8 bhi_thunk[32];
extern bhi_thunk __bhi_args[];
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 32e4b801db99..bf82c6f7d690 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -936,7 +936,10 @@ void __init_or_module apply_seal_endbr(s32 *start, s32 *end) { }
#endif
enum cfi_mode cfi_mode __ro_after_init = __CFI_DEFAULT;
+
+#ifdef CONFIG_FINEIBT_BHI
bool cfi_bhi __ro_after_init = false;
+#endif
#ifdef CONFIG_CFI_CLANG
struct bpf_insn;
@@ -1070,11 +1073,15 @@ static __init int cfi_parse_cmdline(char *str)
pr_err("Ignoring paranoid; depends on fineibt.\n");
}
} else if (!strcmp(str, "bhi")) {
+#ifdef CONFIG_FINEIBT_BHI
if (cfi_mode == CFI_FINEIBT) {
cfi_bhi = true;
} else {
pr_err("Ignoring bhi; depends on fineibt.\n");
}
+#else
+ pr_err("Ignoring bhi; depends on FINEIBT_BHI=y.\n");
+#endif
} else {
pr_err("Ignoring unknown cfi option (%s).", str);
}
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [tip: x86/core] x86/ibt: Make cfi_bhi a constant for FINEIBT_BHI=n
2025-03-03 9:49 ` Peter Zijlstra
@ 2025-03-03 10:02 ` tip-bot2 for Peter Zijlstra
0 siblings, 0 replies; 8+ messages in thread
From: tip-bot2 for Peter Zijlstra @ 2025-03-03 10:02 UTC (permalink / raw)
To: linux-tip-commits
Cc: kernel test robot, Peter Zijlstra (Intel), x86, linux-kernel
The following commit has been merged into the x86/core branch of tip:
Commit-ID: 73e8079be9e7ae5ed197d074e0ba6c43674c52f7
Gitweb: https://git.kernel.org/tip/73e8079be9e7ae5ed197d074e0ba6c43674c52f7
Author: Peter Zijlstra <peterz@infradead.org>
AuthorDate: Mon, 03 Mar 2025 10:21:47 +01:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Mon, 03 Mar 2025 10:54:11 +01:00
x86/ibt: Make cfi_bhi a constant for FINEIBT_BHI=n
Robot yielded a .config that tripped:
vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60
This is the result of using __bhi_args[1] in unreachable code; make
sure the compiler is able to determine this is unreachable and trigger
DCE.
Closes: https://lore.kernel.org/oe-kbuild-all/202503030704.H9KFysNS-lkp@intel.com/
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20250303094911.GL5880@noisy.programming.kicks-ass.net
---
arch/x86/include/asm/cfi.h | 5 +++++
arch/x86/kernel/alternative.c | 7 +++++++
2 files changed, 12 insertions(+)
diff --git a/arch/x86/include/asm/cfi.h b/arch/x86/include/asm/cfi.h
index 2f6a01f..3e51ba4 100644
--- a/arch/x86/include/asm/cfi.h
+++ b/arch/x86/include/asm/cfi.h
@@ -100,7 +100,12 @@ enum cfi_mode {
};
extern enum cfi_mode cfi_mode;
+
+#ifdef CONFIG_FINEIBT_BHI
extern bool cfi_bhi;
+#else
+#define cfi_bhi (0)
+#endif
typedef u8 bhi_thunk[32];
extern bhi_thunk __bhi_args[];
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 32e4b80..bf82c6f 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -936,7 +936,10 @@ void __init_or_module apply_seal_endbr(s32 *start, s32 *end) { }
#endif
enum cfi_mode cfi_mode __ro_after_init = __CFI_DEFAULT;
+
+#ifdef CONFIG_FINEIBT_BHI
bool cfi_bhi __ro_after_init = false;
+#endif
#ifdef CONFIG_CFI_CLANG
struct bpf_insn;
@@ -1070,11 +1073,15 @@ static __init int cfi_parse_cmdline(char *str)
pr_err("Ignoring paranoid; depends on fineibt.\n");
}
} else if (!strcmp(str, "bhi")) {
+#ifdef CONFIG_FINEIBT_BHI
if (cfi_mode == CFI_FINEIBT) {
cfi_bhi = true;
} else {
pr_err("Ignoring bhi; depends on fineibt.\n");
}
+#else
+ pr_err("Ignoring bhi; depends on FINEIBT_BHI=y.\n");
+#endif
} else {
pr_err("Ignoring unknown cfi option (%s).", str);
}
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [tip:x86/core 16/17] vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60
2025-03-03 9:24 ` Peter Zijlstra
2025-03-03 9:43 ` Peter Zijlstra
2025-03-03 9:49 ` Peter Zijlstra
@ 2025-03-03 17:11 ` Kees Cook
2025-03-03 18:57 ` Peter Zijlstra
2 siblings, 1 reply; 8+ messages in thread
From: Kees Cook @ 2025-03-03 17:11 UTC (permalink / raw)
To: Peter Zijlstra
Cc: kernel test robot, llvm, oe-kbuild-all, linux-kernel, x86,
Ingo Molnar
On Mon, Mar 03, 2025 at 10:24:59AM +0100, Peter Zijlstra wrote:
> On Mon, Mar 03, 2025 at 07:47:57AM +0800, kernel test robot wrote:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/core
> > head: dfebe7362f6f461d771cdb9ac2c5172a4721f064
> > commit: 0c92385dc05ee9637c04372ea95a11bbf6e010ff [16/17] x86/ibt: Implement FineIBT-BHI mitigation
> > config: x86_64-randconfig-071-20250303 (https://download.01.org/0day-ci/archive/20250303/202503030704.H9KFysNS-lkp@intel.com/config)
> > compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250303/202503030704.H9KFysNS-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/202503030704.H9KFysNS-lkp@intel.com/
> >
> > All warnings (new ones prefixed by >>):
> >
> > >> vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60
>
> Thanks, below seems to cure it for me.
>
> ---
> Subject: x86/ibt: Make cfi_bhi a constant for FINEIBT_BHI=n
> From: Peter Zijlstra <peterz@infradead.org>
> Date: Mon Mar 3 10:21:47 CET 2025
>
> Robot yielded a .config that tripped:
>
> vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60
>
> This is the result of using __bhi_args[1] in unreachable code; make
> sure the compiler is able to determine this is unreachable and trigger
> DCE.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202503030704.H9KFysNS-lkp@intel.com/
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
> arch/x86/include/asm/cfi.h | 5 +++++
> arch/x86/kernel/alternative.c | 3 +++
> 2 files changed, 8 insertions(+)
>
> --- a/arch/x86/include/asm/cfi.h
> +++ b/arch/x86/include/asm/cfi.h
> @@ -100,7 +100,12 @@ enum cfi_mode {
> };
>
> extern enum cfi_mode cfi_mode;
> +
> +#ifdef CONFIG_FINEIBT_BHI
> extern bool cfi_bhi;
> +#else
> +#define cfi_bhi (0)
> +#endif
Just for my own curiosity, how did you track this down? (The
relationship between cfi_bhi and do_jit is not immediately obvious to
me. Or rather, what was needing DCE?)
-Kees
--
Kees Cook
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [tip:x86/core 16/17] vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60
2025-03-03 17:11 ` [tip:x86/core 16/17] vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60 Kees Cook
@ 2025-03-03 18:57 ` Peter Zijlstra
2025-03-03 19:09 ` Kees Cook
0 siblings, 1 reply; 8+ messages in thread
From: Peter Zijlstra @ 2025-03-03 18:57 UTC (permalink / raw)
To: Kees Cook
Cc: kernel test robot, llvm, oe-kbuild-all, linux-kernel, x86,
Ingo Molnar
On Mon, Mar 03, 2025 at 09:11:54AM -0800, Kees Cook wrote:
> On Mon, Mar 03, 2025 at 10:24:59AM +0100, Peter Zijlstra wrote:
> > > >> vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60
> Just for my own curiosity, how did you track this down? (The
> relationship between cfi_bhi and do_jit is not immediately obvious to
> me. Or rather, what was needing DCE?)
If you build dfebe7362f6f461d771cdb9ac2c5172a4721f064 (tip/x86/core^2 so
as to not have the fix) and build a FINEIBT=y kernel with clang-19 (so
as not to have support for kcfi-ariry) then:
$ ./scripts/objdump-func tmp-build/vmlinux.o do_jit
...
0267 6a2a7: 48 c1 e9 20 shr $0x20,%rcx
026b 6a2ab: 0f 85 16 39 00 00 jne 6dbc7 <do_jit+0x3b87>
0271 6a2b1: 48 8b 44 24 20 mov 0x20(%rsp),%rax
0276 6a2b6: 48 c7 c1 00 00 00 00 mov $0x0,%rcx 6a2b9: R_X86_64_32S __bhi_args+0x20
027d 6a2bd: c6 43 0b e8 movb $0xe8,0xb(%rbx)
0281 6a2c1: 48 83 c0 10 add $0x10,%rax
0285 6a2c5: 29 c1 sub %eax,%ecx
0287 6a2c7: 89 4b 0c mov %ecx,0xc(%rbx)
...
So the reference is to __bhi_args[1], this is the result of
emit_fineibt(.arity=1).
Anyway, the point is that for FINEIBT_BHI=n the __bhi_args[]
array is 'empty' and the +0x20 thing points into random.
What needs DCE is the whole if (cfi_bhi) branch in emit_fineibt(),
making that whole __bhi_args[] reference go away.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [tip:x86/core 16/17] vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60
2025-03-03 18:57 ` Peter Zijlstra
@ 2025-03-03 19:09 ` Kees Cook
0 siblings, 0 replies; 8+ messages in thread
From: Kees Cook @ 2025-03-03 19:09 UTC (permalink / raw)
To: Peter Zijlstra
Cc: kernel test robot, llvm, oe-kbuild-all, linux-kernel, x86,
Ingo Molnar
On Mon, Mar 03, 2025 at 07:57:48PM +0100, Peter Zijlstra wrote:
> On Mon, Mar 03, 2025 at 09:11:54AM -0800, Kees Cook wrote:
> > On Mon, Mar 03, 2025 at 10:24:59AM +0100, Peter Zijlstra wrote:
>
> > > > >> vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60
>
> > Just for my own curiosity, how did you track this down? (The
> > relationship between cfi_bhi and do_jit is not immediately obvious to
> > me. Or rather, what was needing DCE?)
>
> If you build dfebe7362f6f461d771cdb9ac2c5172a4721f064 (tip/x86/core^2 so
> as to not have the fix) and build a FINEIBT=y kernel with clang-19 (so
> as not to have support for kcfi-ariry) then:
>
> $ ./scripts/objdump-func tmp-build/vmlinux.o do_jit
> ...
> 0267 6a2a7: 48 c1 e9 20 shr $0x20,%rcx
> 026b 6a2ab: 0f 85 16 39 00 00 jne 6dbc7 <do_jit+0x3b87>
> 0271 6a2b1: 48 8b 44 24 20 mov 0x20(%rsp),%rax
> 0276 6a2b6: 48 c7 c1 00 00 00 00 mov $0x0,%rcx 6a2b9: R_X86_64_32S __bhi_args+0x20
> 027d 6a2bd: c6 43 0b e8 movb $0xe8,0xb(%rbx)
> 0281 6a2c1: 48 83 c0 10 add $0x10,%rax
> 0285 6a2c5: 29 c1 sub %eax,%ecx
> 0287 6a2c7: 89 4b 0c mov %ecx,0xc(%rbx)
> ...
>
>
> So the reference is to __bhi_args[1], this is the result of
> emit_fineibt(.arity=1).
>
> Anyway, the point is that for FINEIBT_BHI=n the __bhi_args[]
> array is 'empty' and the +0x20 thing points into random.
>
> What needs DCE is the whole if (cfi_bhi) branch in emit_fineibt(),
> making that whole __bhi_args[] reference go away.
AH! Yes, that does stand out. :) Thanks!
--
Kees Cook
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-03-03 19:09 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-02 23:47 [tip:x86/core 16/17] vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60 kernel test robot
2025-03-03 9:24 ` Peter Zijlstra
2025-03-03 9:43 ` Peter Zijlstra
2025-03-03 9:49 ` Peter Zijlstra
2025-03-03 10:02 ` [tip: x86/core] x86/ibt: Make cfi_bhi a constant for FINEIBT_BHI=n tip-bot2 for Peter Zijlstra
2025-03-03 17:11 ` [tip:x86/core 16/17] vmlinux.o: warning: objtool: do_jit+0x276: relocation to !ENDBR: .noinstr.text+0x6a60 Kees Cook
2025-03-03 18:57 ` Peter Zijlstra
2025-03-03 19:09 ` Kees Cook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox