6.14.7-rc1: undefined reference to `__x86_indirect_its_thunk_array' when CONFIG_CPU_MITIGATIONS is off
Subsystems (4)
While trying to build 6.14.7-rc1 with CONFIG_CPU_MITIGATIONS unset:
LD .tmp_vmlinux1
ld: arch/x86/net/bpf_jit_comp.o: in function `emit_indirect_jump':
/tmp/linux-6.14.7/arch/x86/net/bpf_jit_comp.c:660:(.text+0x97e): undefined reference to `__x86_indirect_its_thunk_array' make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 1
make[1]: *** [/tmp/linux-6.14.7/Makefile:1234: vmlinux] Error 2
make: *** [Makefile:251: __sub-make] Error 2
- applying 9f35e33144ae aka "x86/its: Fix build errors when CONFIG_MODULES=n" did not help
- mainline at 9f35e33144ae does not have this problem (same config)
Are we missing a commit in stable?
I temporarily threw "if (IS_ENABLED(CONFIG_MITIGATION_ITS))" around the problematic feature check and that made it work, but I get the feeling that cpu_feature_enabled(X86_FEATURE_INDIRECT_THUNK_ITS) is implemented differently than the other feature checks and/or is missing something.
thanks
Holger
Quoted 9 lines · Holger Hoffstätte
While trying to build 6.14.7-rc1 with
CONFIG_CPU_MITIGATIONSunset:LD .tmp_vmlinux1
ld:arch/x86/net/bpf_jit_comp.o: in function `emit_indirect_jump':
/tmp/linux-6.14.7/arch/x86/net/bpf_jit_comp.c:660:(.text+0x97e): undefined reference to `__x86_indirect_its_thunk_array' make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 1
make[1]: *** [/tmp/linux-6.14.7/Makefile:1234: vmlinux] Error 2
make: *** [Makefile:251: __sub-make] Error 2
Quoted 6 lines
- applying
9f35e33144aeaka "x86/its: Fix build errors whenCONFIG_MODULES=n" did not help- mainline at
9f35e33144aedoes not have this problem (same config)Are we missing a commit in stable?
It seems commit e52c1dc7455d ("x86/its: FineIBT-paranoid vs ITS") [1] is missing in the stable queue. It replaces the direct array reference in bpf_jit_comp.c:emit_indirect_jump() with a mostly-empty function stub when !CONFIG_MITIGATION_ITS, which is why mainline built and -stable does not.
Unfortunately it does not seem to apply on top of 6.14.7-rc1 at all. Any good suggestions?
thanks
Holger
Quoted 25 lines · Holger Hoffstätte
cc peterzQuoted 9 lines · Holger Hoffstätte
While trying to build 6.14.7-rc1 with
CONFIG_CPU_MITIGATIONSunset:LD .tmp_vmlinux1
ld:arch/x86/net/bpf_jit_comp.o: in function `emit_indirect_jump':
/tmp/linux-6.14.7/arch/x86/net/bpf_jit_comp.c:660:(.text+0x97e): undefined reference to `__x86_indirect_its_thunk_array' make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 1
make[1]: *** [/tmp/linux-6.14.7/Makefile:1234: vmlinux] Error 2
make: *** [Makefile:251: __sub-make] Error 2Quoted 6 lines
- applying
9f35e33144aeaka "x86/its: Fix build errors whenCONFIG_MODULES=n" did not help- mainline at
9f35e33144aedoes not have this problem (same config)Are we missing a commit in stable?
It seems commit
e52c1dc7455d("x86/its: FineIBT-paranoid vs ITS") [1] is missing in the stable queue. It replaces the direct array reference in bpf_jit_comp.c:emit_indirect_jump() with a mostly-empty function stub when !CONFIG_MITIGATION_ITS, which is why mainline built and -stable does not.
Quoted 7 lines
Unfortunately it does not seem to apply on top of 6.14.7-rc1 at all. Any good suggestions?
thanks
Holger
Right, this is forever the problem with these embargoed things that side-step the normal development cycle and need to be backported to hell :/
Let me go update this stable.git thing.
/me twiddles thumbs for a bit, this is one fat tree it is..
Argh, I needed stable-rc.git
more thumb twiddling ...
simply picking the few hunks from that fineibt commit should do the trick I think.
/me stomps on it some ... voila! Not the prettiest thing, but definilty good enough I suppose. Builds now, must be perfect etc.. :-)
---
arch/x86/include/asm/alternative.h +8 -0
@@ -6,6 +6,7 @@#include <linux/stringify.h> #include <linux/objtool.h> #include <asm/asm.h> +#include <asm/bug.h> #define ALT_FLAGS_SHIFT 16
@@ -128,10 +129,17 @@ static __always_inline int x86_call_depth_emit_accounting(u8 **pprog,extern void its_init_mod (struct module *mod);extern void its_fini_mod (struct module *mod);extern void its_free_mod (struct module *mod); +extern u8 *its_static_thunk (int reg);#else /* CONFIG_MITIGATION_ITS */ static inline void its_init_mod (struct module *mod) { }static inline void its_fini_mod (struct module *mod) { }static inline void its_free_mod (struct module *mod) { } +static inline u8 *its_static_thunk (int reg) +{ +WARN_ONCE (1 ,"ITS not compiled in" ); + +return NULL ; +}#endif #if defined(CONFIG_MITIGATION_RETHUNK ) && defined(CONFIG_OBJTOOL )
arch/x86/kernel/alternative.c +7 -0
@@ -240,6 +272,13 @@ static void *its_allocate_thunk(int reg) return its_init_thunk(thunk, reg); } +u8 *its_static_thunk (int reg) +{ +u8 *thunk = __x86_indirect_its_thunk_array[reg]; + +return thunk; +} +#endif /*
arch/x86/net/bpf_jit_comp.c +1 -1
@@ -663,7 +663,7 @@ static void emit_indirect_jump(u8 **pprog, int reg, u8 *ip)if (cpu_feature_enabled (X86_FEATURE_INDIRECT_THUNK_ITS )) {OPTIMIZER_HIDE_VAR (reg); -emit_jump (&prog, &__x86_indirect_its_thunk_array[reg], ip); +emit_jump (&prog,its_static_thunk (reg), ip); }else if (cpu_feature_enabled (X86_FEATURE_RETPOLINE_LFENCE )) {EMIT_LFENCE ();EMIT2 (0xFF ,0xE0 + reg);
Holger Hoffstätte
Tested-byQuoted 108 lines · Peter Zijlstra
Quoted 25 lines · Holger Hoffstätte
cc peterzQuoted 9 lines · Holger Hoffstätte
While trying to build 6.14.7-rc1 with
CONFIG_CPU_MITIGATIONSunset:LD .tmp_vmlinux1
ld:arch/x86/net/bpf_jit_comp.o: in function `emit_indirect_jump':
/tmp/linux-6.14.7/arch/x86/net/bpf_jit_comp.c:660:(.text+0x97e): undefined reference to `__x86_indirect_its_thunk_array' make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 1
make[1]: *** [/tmp/linux-6.14.7/Makefile:1234: vmlinux] Error 2
make: *** [Makefile:251: __sub-make] Error 2Quoted 6 lines
- applying
9f35e33144aeaka "x86/its: Fix build errors whenCONFIG_MODULES=n" did not help- mainline at
9f35e33144aedoes not have this problem (same config)Are we missing a commit in stable?
It seems commit
e52c1dc7455d("x86/its: FineIBT-paranoid vs ITS") [1] is missing in the stable queue. It replaces the direct array reference in bpf_jit_comp.c:emit_indirect_jump() with a mostly-empty function stub when !CONFIG_MITIGATION_ITS, which is why mainline built and -stable does not.Quoted 7 lines
Unfortunately it does not seem to apply on top of 6.14.7-rc1 at all. Any good suggestions?
thanks
HolgerRight, this is forever the problem with these embargoed things that side-step the normal development cycle and need to be backported to hell :/
Let me go update this stable.git thing.
/me twiddles thumbs for a bit, this is one fat tree it is..
Argh, I needed stable-rc.git
more thumb twiddling ...
simply picking the few hunks from that fineibt commit should do the trick I think.
/me stomps on it some ... voila! Not the prettiest thing, but definilty good enough I suppose. Builds now, must be perfect etc.. :-)
---
arch/x86/include/asm/alternative.h +8
-0@@ -6,6 +6,7 @@#include <linux/stringify.h> #include <linux/objtool.h> #include <asm/asm.h> +#include <asm/bug.h> #define ALT_FLAGS_SHIFT 16@@ -128,10 +129,17 @@ static __always_inline int x86_call_depth_emit_accounting(u8 **pprog,extern void its_init_mod (struct module *mod);extern void its_fini_mod (struct module *mod);extern void its_free_mod (struct module *mod); +extern u8 *its_static_thunk (int reg);#else /* CONFIG_MITIGATION_ITS */ static inline void its_init_mod (struct module *mod) { }static inline void its_fini_mod (struct module *mod) { }static inline void its_free_mod (struct module *mod) { } +static inline u8 *its_static_thunk (int reg) +{ +WARN_ONCE (1 ,"ITS not compiled in" ); + +return NULL ; +}#endif #if defined(CONFIG_MITIGATION_RETHUNK ) && defined(CONFIG_OBJTOOL )arch/x86/kernel/alternative.c +7
-0@@ -240,6 +272,13 @@ static void *its_allocate_thunk(int reg) return its_init_thunk(thunk, reg); } +u8 *its_static_thunk (int reg) +{ +u8 *thunk = __x86_indirect_its_thunk_array[reg]; + +return thunk; +} +#endif /* arch/x86/net/bpf_jit_comp.c +0
-0
arch/x86/net/bpf_jit_comp.c static void emit_indirect_jump(u8 **pprog, int reg, u8 *ip) · line 669
Quoted 8 lines
arch/x86/net/bpf_jit_comp.c +1
-1@@ -663,7 +663,7 @@ static void emit_indirect_jump(u8 **pprog, int reg, u8 *ip)if (cpu_feature_enabled (X86_FEATURE_INDIRECT_THUNK_ITS )) {OPTIMIZER_HIDE_VAR (reg); -emit_jump (&prog, &__x86_indirect_its_thunk_array[reg], ip); +emit_jump (&prog,its_static_thunk (reg), ip); }else if (cpu_feature_enabled (X86_FEATURE_RETPOLINE_LFENCE )) {EMIT_LFENCE ();EMIT2 (0xFF ,0xE0 + reg);
Can confirm that it now links, as expected. Just in case:
Thank you!
cheers
Holger
Greg KH
maintainerQuoted 108 lines · Peter Zijlstra
Quoted 25 lines · Holger Hoffstätte
cc peterzQuoted 9 lines · Holger Hoffstätte
While trying to build 6.14.7-rc1 with
CONFIG_CPU_MITIGATIONSunset:LD .tmp_vmlinux1
ld:arch/x86/net/bpf_jit_comp.o: in function `emit_indirect_jump':
/tmp/linux-6.14.7/arch/x86/net/bpf_jit_comp.c:660:(.text+0x97e): undefined reference to `__x86_indirect_its_thunk_array' make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 1
make[1]: *** [/tmp/linux-6.14.7/Makefile:1234: vmlinux] Error 2
make: *** [Makefile:251: __sub-make] Error 2Quoted 6 lines
- applying
9f35e33144aeaka "x86/its: Fix build errors whenCONFIG_MODULES=n" did not help- mainline at
9f35e33144aedoes not have this problem (same config)Are we missing a commit in stable?
It seems commit
e52c1dc7455d("x86/its: FineIBT-paranoid vs ITS") [1] is missing in the stable queue. It replaces the direct array reference in bpf_jit_comp.c:emit_indirect_jump() with a mostly-empty function stub when !CONFIG_MITIGATION_ITS, which is why mainline built and -stable does not.Quoted 7 lines
Unfortunately it does not seem to apply on top of 6.14.7-rc1 at all. Any good suggestions?
thanks
HolgerRight, this is forever the problem with these embargoed things that side-step the normal development cycle and need to be backported to hell :/
Let me go update this stable.git thing.
/me twiddles thumbs for a bit, this is one fat tree it is..
Argh, I needed stable-rc.git
more thumb twiddling ...
simply picking the few hunks from that fineibt commit should do the trick I think.
/me stomps on it some ... voila! Not the prettiest thing, but definilty good enough I suppose. Builds now, must be perfect etc.. :-)
---
arch/x86/include/asm/alternative.h +8
-0@@ -6,6 +6,7 @@#include <linux/stringify.h> #include <linux/objtool.h> #include <asm/asm.h> +#include <asm/bug.h> #define ALT_FLAGS_SHIFT 16@@ -128,10 +129,17 @@ static __always_inline int x86_call_depth_emit_accounting(u8 **pprog,extern void its_init_mod (struct module *mod);extern void its_fini_mod (struct module *mod);extern void its_free_mod (struct module *mod); +extern u8 *its_static_thunk (int reg);#else /* CONFIG_MITIGATION_ITS */ static inline void its_init_mod (struct module *mod) { }static inline void its_fini_mod (struct module *mod) { }static inline void its_free_mod (struct module *mod) { } +static inline u8 *its_static_thunk (int reg) +{ +WARN_ONCE (1 ,"ITS not compiled in" ); + +return NULL ; +}#endif #if defined(CONFIG_MITIGATION_RETHUNK ) && defined(CONFIG_OBJTOOL )arch/x86/kernel/alternative.c +7
-0@@ -240,6 +272,13 @@ static void *its_allocate_thunk(int reg) return its_init_thunk(thunk, reg); } +u8 *its_static_thunk (int reg) +{ +u8 *thunk = __x86_indirect_its_thunk_array[reg]; + +return thunk; +} +#endif /* arch/x86/net/bpf_jit_comp.c +0
-0
arch/x86/net/bpf_jit_comp.c static void emit_indirect_jump(u8 **pprog, int reg, u8 *ip) · line 669
Quoted 8 lines
arch/x86/net/bpf_jit_comp.c +1
-1@@ -663,7 +663,7 @@ static void emit_indirect_jump(u8 **pprog, int reg, u8 *ip)if (cpu_feature_enabled (X86_FEATURE_INDIRECT_THUNK_ITS )) {OPTIMIZER_HIDE_VAR (reg); -emit_jump (&prog, &__x86_indirect_its_thunk_array[reg], ip); +emit_jump (&prog,its_static_thunk (reg), ip); }else if (cpu_feature_enabled (X86_FEATURE_RETPOLINE_LFENCE )) {EMIT_LFENCE ();EMIT2 (0xFF ,0xE0 + reg);
Thanks, I've taken this version now. I'm at a conference now and can't do build testing, so I'll push out a -rc2 and see how that goes...
greg k-h
Quoted 114 lines · Holger Hoffstätte
Quoted 102 lines · Peter Zijlstra
Quoted 25 lines · Holger Hoffstätte
cc peterzQuoted 9 lines · Holger Hoffstätte
While trying to build 6.14.7-rc1 with
CONFIG_CPU_MITIGATIONSunset:LD .tmp_vmlinux1
ld:arch/x86/net/bpf_jit_comp.o: in function `emit_indirect_jump':
/tmp/linux-6.14.7/arch/x86/net/bpf_jit_comp.c:660:(.text+0x97e): undefined reference to `__x86_indirect_its_thunk_array' make[2]: *** [scripts/Makefile.vmlinux:77: vmlinux] Error 1
make[1]: *** [/tmp/linux-6.14.7/Makefile:1234: vmlinux] Error 2
make: *** [Makefile:251: __sub-make] Error 2Quoted 6 lines
- applying
9f35e33144aeaka "x86/its: Fix build errors whenCONFIG_MODULES=n" did not help- mainline at
9f35e33144aedoes not have this problem (same config)Are we missing a commit in stable?
It seems commit
e52c1dc7455d("x86/its: FineIBT-paranoid vs ITS") [1] is missing in the stable queue. It replaces the direct array reference in bpf_jit_comp.c:emit_indirect_jump() with a mostly-empty function stub when !CONFIG_MITIGATION_ITS, which is why mainline built and -stable does not.Quoted 7 lines
Unfortunately it does not seem to apply on top of 6.14.7-rc1 at all. Any good suggestions?
thanks
HolgerRight, this is forever the problem with these embargoed things that side-step the normal development cycle and need to be backported to hell :/
Let me go update this stable.git thing.
/me twiddles thumbs for a bit, this is one fat tree it is..
Argh, I needed stable-rc.git
more thumb twiddling ...
simply picking the few hunks from that fineibt commit should do the trick I think.
/me stomps on it some ... voila! Not the prettiest thing, but definilty good enough I suppose. Builds now, must be perfect etc.. :-)
---
arch/x86/include/asm/alternative.h +8
-0@@ -6,6 +6,7 @@#include <linux/stringify.h> #include <linux/objtool.h> #include <asm/asm.h> +#include <asm/bug.h> #define ALT_FLAGS_SHIFT 16@@ -128,10 +129,17 @@ static __always_inline int x86_call_depth_emit_accounting(u8 **pprog,extern void its_init_mod (struct module *mod);extern void its_fini_mod (struct module *mod);extern void its_free_mod (struct module *mod); +extern u8 *its_static_thunk (int reg);#else /* CONFIG_MITIGATION_ITS */ static inline void its_init_mod (struct module *mod) { }static inline void its_fini_mod (struct module *mod) { }static inline void its_free_mod (struct module *mod) { } +static inline u8 *its_static_thunk (int reg) +{ +WARN_ONCE (1 ,"ITS not compiled in" ); + +return NULL ; +}#endif #if defined(CONFIG_MITIGATION_RETHUNK ) && defined(CONFIG_OBJTOOL )arch/x86/kernel/alternative.c +7
-0@@ -240,6 +272,13 @@ static void *its_allocate_thunk(int reg) return its_init_thunk(thunk, reg); } +u8 *its_static_thunk (int reg) +{ +u8 *thunk = __x86_indirect_its_thunk_array[reg]; + +return thunk; +} +#endif /* arch/x86/net/bpf_jit_comp.c +0
-0arch/x86/net/bpf_jit_comp.c static void emit_indirect_jump(u8 **pprog, int reg, u8 *ip) · line 669
Quoted 8 lines
arch/x86/net/bpf_jit_comp.c +1
-1@@ -663,7 +663,7 @@ static void emit_indirect_jump(u8 **pprog, int reg, u8 *ip)if (cpu_feature_enabled (X86_FEATURE_INDIRECT_THUNK_ITS )) {OPTIMIZER_HIDE_VAR (reg); -emit_jump (&prog, &__x86_indirect_its_thunk_array[reg], ip); +emit_jump (&prog,its_static_thunk (reg), ip); }else if (cpu_feature_enabled (X86_FEATURE_RETPOLINE_LFENCE )) {EMIT_LFENCE ();EMIT2 (0xFF ,0xE0 + reg);Can confirm that it now links, as expected. Just in case:
Quoted 1 line
Tested-by Holger Hoffstätte <[email protected]>
Wonderful, thanks for testing!
greg k-h