objtool: noinstr validation for static branches/calls
Subsystems (2)
Josh Poimboeuf
maintainercover objtool: noinstr validation for static branches/calls
Valentin, feel free to include in your next version.
Josh Poimboeuf (3):
jump_label: Add annotations for validating noinstr usage
static_call: Add read-only-after-init static calls
objtool: Add noinstr validation for static branches/calls
include/linux/jump_label.h | 29 ++++++-- include/linux/objtool.h | 6 ++ include/linux/static_call.h | 18 +++++ tools/objtool/Documentation/objtool.txt | 34 +++++++++ tools/objtool/check.c | 92 ++++++++++++++++++++++--- tools/objtool/include/objtool/check.h | 1 + tools/objtool/include/objtool/elf.h | 1 + tools/objtool/include/objtool/special.h | 1 + tools/objtool/special.c | 20 +++++- 9 files changed, 186 insertions(+), 16 deletions(-)
Signature · 1 line
2.47.0
Josh Poimboeuf
maintainerPATCH 1/3 jump_label: Add annotations for validating noinstr usage
Deferring a code patching IPI is unsafe if the patched code is in a noinstr region. In that case the text poke code must trigger an immediate IPI to all CPUs, which can rudely interrupt an isolated NO_HZ CPU running in userspace.
Some noinstr static branches may really need to be patched at runtime, despite the resulting disruption. Add DEFINE_STATIC_KEY_*_NOINSTR() variants for those. They don't do anything special yet; that will come later.
--- include/linux/jump_label.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
include/linux/jump_label.h +17 -0
@@ -385,6 +385,23 @@ struct static_key_false {#define DEFINE_STATIC_KEY_FALSE_RO (name) \ struct static_key_false name __ro_after_init = STATIC_KEY_FALSE_INIT +/* +* The _NOINSTR variants are used to tell objtool the static key is allowed to +* be used in noinstr code. +* +* They should almost never be used, as they prevent code patching IPIs from +* being deferred, which can be problematic for isolated NOHZ_FULL CPUs running +* in pure userspace. +* +* If using one of these _NOINSTR variants, please add a comment above the +* definition with the rationale. +*/ +#define DEFINE_STATIC_KEY_TRUE_NOINSTR (name) \ + DEFINE_STATIC_KEY_TRUE(name) + +#define DEFINE_STATIC_KEY_FALSE_NOINSTR (name) \ + DEFINE_STATIC_KEY_FALSE(name) +#define DECLARE_STATIC_KEY_FALSE (name) \ extern struct static_key_false name
Signature · 1 line
2.47.0
Josh Poimboeuf
maintainerRe: [PATCH 1/3] jump_label: Add annotations for validating noinstr usage
Quoted 11 lines · Josh Poimboeuf
Deferring a code patching IPI is unsafe if the patched code is in a noinstr region. In that case the text poke code must trigger an immediate IPI to all CPUs, which can rudely interrupt an isolated
NO_HZCPU running in userspace.Some noinstr static branches may really need to be patched at runtime, despite the resulting disruption. Add DEFINE_STATIC_KEY_*_NOINSTR() variants for those. They don't do anything special yet; that will come later.
Signed-off-by Josh Poimboeuf <[email protected]>
Oops, $SUBJECT should probably be changed to something like:
jump_label: Add DEFINE_STATIC_KEY_*_NOINSTR()
Signature · 1 line
Josh
Josh Poimboeuf
maintainerPATCH 2/3 static_call: Add read-only-after-init static calls
In reply to Josh PoimboeufDeferring a code patching IPI is unsafe if the patched code is in a noinstr region. In that case the text poke code must trigger an immediate IPI to all CPUs, which can rudely interrupt an isolated NO_HZ CPU running in userspace.
If a noinstr static call only needs to be patched during boot, its key can be made ro-after-init to ensure it will never be patched at runtime.
--- include/linux/static_call.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
include/linux/static_call.h +16 -0
@@ -190,6 +190,14 @@ extern long __static_call_return0(void); }; \ ARCH_DEFINE_STATIC_CALL_TRAMP(name, _func) +#define DEFINE_STATIC_CALL_RO (name, _func) \ + DECLARE_STATIC_CALL(name, _func); \ + struct static_call_key __ro_after_init STATIC_CALL_KEY(name) = {\ + .func = _func, \ + .type = 1, \ + }; \ + ARCH_DEFINE_STATIC_CALL_TRAMP(name, _func) +#define DEFINE_STATIC_CALL_NULL (name, _func) \ DECLARE_STATIC_CALL(name, _func); \ struct static_call_key STATIC_CALL_KEY(name) = { \
@@ -198,6 +206,14 @@ extern long __static_call_return0(void); }; \ ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name) +#define DEFINE_STATIC_CALL_NULL_RO (name, _func) \ + DECLARE_STATIC_CALL(name, _func); \ + struct static_call_key __ro_after_init STATIC_CALL_KEY(name) = {\ + .func = NULL, \ + .type = 1, \ + }; \ + ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name) +#define DEFINE_STATIC_CALL_RET0 (name, _func) \ DECLARE_STATIC_CALL(name, _func); \ struct static_call_key STATIC_CALL_KEY(name) = { \
Signature · 1 line
2.47.0
Josh Poimboeuf
maintainerPATCH 3/3 objtool: Add noinstr validation for static branches/calls
In reply to Josh PoimboeufWarn about static branches/calls in noinstr regions, unless the corresponding key is RO-after-init or has been manually whitelisted with DEFINE_STATIC_KEY_*_NOINSTR(().
--- include/linux/jump_label.h | 16 +++-- include/linux/objtool.h | 6 ++ include/linux/static_call.h | 2 + tools/objtool/Documentation/objtool.txt | 34 +++++++++ tools/objtool/check.c | 92 ++++++++++++++++++++++--- tools/objtool/include/objtool/check.h | 1 + tools/objtool/include/objtool/elf.h | 1 + tools/objtool/include/objtool/special.h | 1 + tools/objtool/special.c | 20 +++++- 9 files changed, 155 insertions(+), 18 deletions(-)
include/linux/jump_label.h +10 -6
@@ -373,8 +373,9 @@ struct static_key_false {#define DEFINE_STATIC_KEY_TRUE (name) \ struct static_key_true name = STATIC_KEY_TRUE_INIT -#define DEFINE_STATIC_KEY_TRUE_RO (name) \ - struct static_key_true name __ro_after_init = STATIC_KEY_TRUE_INIT +#define DEFINE_STATIC_KEY_TRUE_RO (name) \ + struct static_key_true name __ro_after_init = STATIC_KEY_TRUE_INIT; \ + ANNOTATE_NOINSTR_ALLOWED(name)#define DECLARE_STATIC_KEY_TRUE (name) \ extern struct static_key_true name
@@ -382,8 +383,9 @@ struct static_key_false {#define DEFINE_STATIC_KEY_FALSE (name) \ struct static_key_false name = STATIC_KEY_FALSE_INIT -#define DEFINE_STATIC_KEY_FALSE_RO (name) \ - struct static_key_false name __ro_after_init = STATIC_KEY_FALSE_INIT +#define DEFINE_STATIC_KEY_FALSE_RO (name) \ + struct static_key_false name __ro_after_init = STATIC_KEY_FALSE_INIT; \ + ANNOTATE_NOINSTR_ALLOWED(name)/* * The _NOINSTR variants are used to tell objtool the static key is allowed to
@@ -397,10 +399,12 @@ struct static_key_false {* definition with the rationale. */ #define DEFINE_STATIC_KEY_TRUE_NOINSTR (name) \ - DEFINE_STATIC_KEY_TRUE(name) + DEFINE_STATIC_KEY_TRUE(name); \ + ANNOTATE_NOINSTR_ALLOWED(name)#define DEFINE_STATIC_KEY_FALSE_NOINSTR (name) \ - DEFINE_STATIC_KEY_FALSE(name) + DEFINE_STATIC_KEY_FALSE(name); \ + ANNOTATE_NOINSTR_ALLOWED(name)#define DECLARE_STATIC_KEY_FALSE (name) \ extern struct static_key_false name
include/linux/objtool.h +6 -0
@@ -34,6 +34,12 @@ static void __used __section(".discard.func_stack_frame_non_standard") \ *__func_stack_frame_non_standard_##func = func +#define __ANNOTATE_NOINSTR_ALLOWED (key) \ + static void __used __section(".discard.noinstr_allowed") \ + *__annotate_noinstr_allowed_##key = &key + +#define ANNOTATE_NOINSTR_ALLOWED (key) __ANNOTATE_NOINSTR_ALLOWED(key) +/* * STACK_FRAME_NON_STANDARD_FP() is a frame-pointer-specific function ignore * for the case where a function is intentionally missing frame pointer setup,
include/linux/static_call.h +2 -0
@@ -196,6 +196,7 @@ extern long __static_call_return0(void); .func = _func, \ .type = 1, \ }; \ +ANNOTATE_NOINSTR_ALLOWED (STATIC_CALL_TRAMP (name)); \ ARCH_DEFINE_STATIC_CALL_TRAMP(name, _func)#define DEFINE_STATIC_CALL_NULL (name, _func) \
@@ -212,6 +213,7 @@ extern long __static_call_return0(void); .func = NULL, \ .type = 1, \ }; \ +ANNOTATE_NOINSTR_ALLOWED (STATIC_CALL_TRAMP (name)); \ARCH_DEFINE_STATIC_CALL_NULL_TRAMP (name) #define DEFINE_STATIC_CALL_RET0(name, _func) \
tools/objtool/Documentation/objtool.txt +34 -0
@@ -447,6 +447,40 @@ the objtool maintainers. names and does not use module_init() / module_exit() macros to create them. +13. file.o: warning: func()+0x2a: key: non-RO static key usage in noinstr code + file.o: warning: func()+0x2a: key: non-RO static call usage in noinstr code + + This means that noinstr function func() uses a static key or + static call named 'key' which can be modified at runtime. This is + discouraged because it prevents code patching IPIs from being + deferred. + + You have the following options: + + 1) Check whether the static key/call in question is only modified + during init. If so, define it as read-only-after-init with + DEFINE_STATIC_KEY_*_RO() or DEFINE_STATIC_CALL_RO(). + + 2) Avoid the runtime patching. For static keys this can be done by + using static_key_enabled() or by getting rid of the static key + altogether if performance is not a concern. + + For static calls, something like the following could be done: + + target = static_call_query(foo); + if (target == func1) + func1(); + else if (target == func2) + func2(); + ... + + 3) Silence the warning by defining the static key/call with + DEFINE_STATIC_*_NOINSTR(). This decision should not + be taken lightly as it may result in code patching IPIs getting + sent to isolated NOHZ_FULL CPUs running in pure userspace. A + comment should be added above the definition explaining the + rationale for the decision. + If the error doesn't seem to make sense, it could be a bug in objtool. Feel free to ask the objtool maintainer for help.
tools/objtool/check.c +83 -9
146 lines not on this page · raw message
tools/objtool/include/objtool/check.h +1 -0
@@ -77,6 +77,7 @@ struct instruction {struct symbol *sym;struct stack_op *stack_ops;struct cfi_state *cfi; +struct symbol *key; };static inline struct symbol *insn_func (struct instruction *insn)
tools/objtool/include/objtool/elf.h +1 -0
@@ -69,6 +69,7 @@ struct symbol { u8 embedded_insn : 1; u8 local_label : 1; u8 frame_pointer : 1; + u8 noinstr_allowed : 1;struct list_head pv_target;struct reloc *relocs; };
tools/objtool/include/objtool/special.h +1 -0
@@ -20,6 +20,7 @@ struct special_alt {bool skip_alt;bool jump_or_nop;u8 key_addend; +struct symbol *key;struct section *orig_sec;unsigned long orig_off;
tools/objtool/special.c +17 -3
@@ -119,14 +119,28 @@ static int get_alt_entry(struct elf *elf, const struct special_entry *entry,if (entry->key) {struct reloc *key_reloc; +struct symbol *key; +s64 key_addend; key_reloc =find_reloc_by_dest (elf, sec, offset + entry->key);if (!key_reloc) { -WARN_FUNC ("can't find key reloc" , - sec, offset + entry->key); +WARN_FUNC ("can't find key reloc" , sec, offset + entry->key);return -1 ; } - alt->key_addend =reloc_addend (key_reloc); + + key = key_reloc->sym; + key_addend =reloc_addend (key_reloc); + +if (key->type ==STT_SECTION ) + key =find_symbol_by_offset (key->sec, key_addend & ~3 ); + +if (!key) { +WARN_FUNC ("can't find key sym" , sec, offset + entry->key); +return -1 ; + } + + alt->key = key; + alt->key_addend = key_addend; }return 0 ;
Signature · 1 line
2.47.0
kernel test robot
build botRe: [PATCH 3/3] objtool: Add noinstr validation for static branches/calls
kernel test robot noticed the following build errors:
Hi Josh,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.12 next-20241122]
[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/Josh-Poimboeuf/jump_label-Add-annotations-for-validating-noinstr-usage/20241125-105905 base: linus/master patch link: https://lore.kernel.org/r/b5746646456eb030673cdb62c23d69ed83c2702a.1732326588.git.jpoimboe%40kernel.org patch subject: [PATCH 3/3] objtool: Add noinstr validation for static branches/calls config: powerpc-motionpro_defconfig (https://download.01.org/0day-ci/archive/20241125/[email protected]/config) compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241125/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> init/main.c:821:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
821 | DEFINE_STATIC_KEY_MAYBE_RO(CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT,
| ^
include/linux/jump_label.h:430:2: note: expanded from macro 'DEFINE_STATIC_KEY_MAYBE_RO'
430 | __PASTE(_DEFINE_STATIC_KEY_RO_, IS_ENABLED(cfg))(name)
| ^
include/linux/compiler_types.h:84:22: note: expanded from macro '__PASTE'
84 | #define __PASTE(a,b) ___PASTE(a,b)
| ^
include/linux/compiler_types.h:83:23: note: expanded from macro '___PASTE'
83 | #define ___PASTE(a,b) a##b
| ^
<scratch space>:51:1: note: expanded from here
51 | _DEFINE_STATIC_KEY_RO_0
| ^
include/linux/jump_label.h:428:39: note: expanded from macro '_DEFINE_STATIC_KEY_RO_0'
428 | #define _DEFINE_STATIC_KEY_RO_0(name) DEFINE_STATIC_KEY_FALSE_RO(name)
| ^
include/linux/jump_label.h:388:2: note: expanded from macro 'DEFINE_STATIC_KEY_FALSE_RO'
388 | ANNOTATE_NOINSTR_ALLOWED(name)
| ^
>> init/main.c:822:7: error: a parameter list without types is only allowed in a function definition
822 | randomize_kstack_offset);
| ^2 errors generated.
vim +/int +821 init/main.c
4e37958d1288ce Steven Rostedt (VMware 2018-03-26 819) 8cb37a5974a485 Marco Elver 2022-01-31 820 #ifdef CONFIG_RANDOMIZE_KSTACK_OFFSET 39218ff4c625db Kees Cook 2021-04-01 @821 DEFINE_STATIC_KEY_MAYBE_RO(CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT, 39218ff4c625db Kees Cook 2021-04-01 @822 randomize_kstack_offset); 39218ff4c625db Kees Cook 2021-04-01 823 DEFINE_PER_CPU(u32, kstack_offset); 39218ff4c625db Kees Cook 2021-04-01 824
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH 3/3] objtool: Add noinstr validation for static branches/calls
In reply to Josh Poimboeufkernel test robot noticed the following build errors:
Hi Josh,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.12 next-20241125]
[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/Josh-Poimboeuf/jump_label-Add-annotations-for-validating-noinstr-usage/20241125-105905 base: linus/master patch link: https://lore.kernel.org/r/b5746646456eb030673cdb62c23d69ed83c2702a.1732326588.git.jpoimboe%40kernel.org patch subject: [PATCH 3/3] objtool: Add noinstr validation for static branches/calls config: m68k-bvme6000_defconfig (https://download.01.org/0day-ci/archive/20241125/[email protected]/config) compiler: m68k-linux-gcc (GCC) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241125/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All error/warnings (new ones prefixed by >>):
In file included from include/linux/static_key.h:1,
from include/linux/alloc_tag.h:15,
from include/linux/percpu.h:5,
from include/linux/percpu_counter.h:14,
from include/linux/mm_types.h:21,
from include/linux/mmzone.h:22,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from mm/usercopy.c:13:
>> include/linux/jump_label.h:388:9: warning: data definition has no type or storage class
388 | ANNOTATE_NOINSTR_ALLOWED(name)
| ^~~~~~~~~~~~~~~~~~~~~~~~
mm/usercopy.c:204:8: note: in expansion of macro 'DEFINE_STATIC_KEY_FALSE_RO'
204 | static DEFINE_STATIC_KEY_FALSE_RO(bypass_usercopy_checks);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/jump_label.h:388:9: error: type defaults to 'int' in declaration of 'ANNOTATE_NOINSTR_ALLOWED' [-Wimplicit-int]
388 | ANNOTATE_NOINSTR_ALLOWED(name)
| ^~~~~~~~~~~~~~~~~~~~~~~~
mm/usercopy.c:204:8: note: in expansion of macro 'DEFINE_STATIC_KEY_FALSE_RO'
204 | static DEFINE_STATIC_KEY_FALSE_RO(bypass_usercopy_checks);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/jump_label.h:371:39: error: parameter names (without types) in function declaration [-Wdeclaration-missing-parameter-type]
371 | #define STATIC_KEY_FALSE_INIT (struct static_key_false){ .key = STATIC_KEY_INIT_FALSE, }
| ^~~~~~~~~~~~~~~~
include/linux/jump_label.h:387:56: note: in expansion of macro 'STATIC_KEY_FALSE_INIT'
387 | struct static_key_false name __ro_after_init = STATIC_KEY_FALSE_INIT; \
| ^~~~~~~~~~~~~~~~~~~~~
mm/usercopy.c:204:8: note: in expansion of macro 'DEFINE_STATIC_KEY_FALSE_RO'
204 | static DEFINE_STATIC_KEY_FALSE_RO(bypass_usercopy_checks);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~vim +388 include/linux/jump_label.h
369
370 #define STATIC_KEY_TRUE_INIT (struct static_key_true) { .key = STATIC_KEY_INIT_TRUE, }
> 371 #define STATIC_KEY_FALSE_INIT (struct static_key_false){ .key = STATIC_KEY_INIT_FALSE, }
372
373 #define DEFINE_STATIC_KEY_TRUE(name) \
374 struct static_key_true name = STATIC_KEY_TRUE_INIT
375
376 #define DEFINE_STATIC_KEY_TRUE_RO(name) \
377 struct static_key_true name __ro_after_init = STATIC_KEY_TRUE_INIT; \
378 ANNOTATE_NOINSTR_ALLOWED(name)
379
380 #define DECLARE_STATIC_KEY_TRUE(name) \
381 extern struct static_key_true name
382
383 #define DEFINE_STATIC_KEY_FALSE(name) \
384 struct static_key_false name = STATIC_KEY_FALSE_INIT
385
386 #define DEFINE_STATIC_KEY_FALSE_RO(name) \
387 struct static_key_false name __ro_after_init = STATIC_KEY_FALSE_INIT; \
> 388 ANNOTATE_NOINSTR_ALLOWED(name)389
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH 3/3] objtool: Add noinstr validation for static branches/calls
In reply to Josh Poimboeufkernel test robot noticed the following build warnings:
Hi Josh,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.12 next-20241125]
[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/Josh-Poimboeuf/jump_label-Add-annotations-for-validating-noinstr-usage/20241125-105905 base: linus/master patch link: https://lore.kernel.org/r/b5746646456eb030673cdb62c23d69ed83c2702a.1732326588.git.jpoimboe%40kernel.org patch subject: [PATCH 3/3] objtool: Add noinstr validation for static branches/calls config: i386-buildonly-randconfig-001-20241125 (https://download.01.org/0day-ci/archive/20241125/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241125/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
In file included from include/linux/static_key.h:1,
from arch/x86/include/asm/nospec-branch.h:6,
from arch/x86/include/asm/paravirt_types.h:12,
from arch/x86/include/asm/ptrace.h:175,
from arch/x86/include/asm/math_emu.h:5,
from arch/x86/include/asm/processor.h:13,
from include/linux/sched.h:13,
from include/linux/context_tracking.h:5,
from arch/x86/kernel/kvm.c:12:
include/linux/jump_label.h:388:9: warning: data definition has no type or storage class
388 | ANNOTATE_NOINSTR_ALLOWED(name)
| ^~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/kernel/kvm.c:48:1: note: in expansion of macro 'DEFINE_STATIC_KEY_FALSE_RO'
48 | DEFINE_STATIC_KEY_FALSE_RO(kvm_async_pf_enabled);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/jump_label.h:388:9: error: type defaults to 'int' in declaration of 'ANNOTATE_NOINSTR_ALLOWED' [-Werror=implicit-int]
388 | ANNOTATE_NOINSTR_ALLOWED(name)
| ^~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/kernel/kvm.c:48:1: note: in expansion of macro 'DEFINE_STATIC_KEY_FALSE_RO'
48 | DEFINE_STATIC_KEY_FALSE_RO(kvm_async_pf_enabled);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/jump_label.h:371:39: warning: parameter names (without types) in function declaration
371 | #define STATIC_KEY_FALSE_INIT (struct static_key_false){ .key = STATIC_KEY_INIT_FALSE, }
| ^~~~~~~~~~~~~~~~
include/linux/jump_label.h:387:56: note: in expansion of macro 'STATIC_KEY_FALSE_INIT'
387 | struct static_key_false name __ro_after_init = STATIC_KEY_FALSE_INIT; \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kernel/kvm.c:48:1: note: in expansion of macro 'DEFINE_STATIC_KEY_FALSE_RO'
48 | DEFINE_STATIC_KEY_FALSE_RO(kvm_async_pf_enabled);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from include/linux/static_key.h:1,
from arch/x86/include/asm/nospec-branch.h:6,
from arch/x86/include/asm/paravirt_types.h:12,
from arch/x86/include/asm/ptrace.h:175,
from arch/x86/include/asm/math_emu.h:5,
from arch/x86/include/asm/processor.h:13,
from include/linux/sched.h:13,
from arch/x86/kernel/tsc.c:5:
include/linux/jump_label.h:388:9: warning: data definition has no type or storage class
388 | ANNOTATE_NOINSTR_ALLOWED(name)
| ^~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/kernel/tsc.c:48:8: note: in expansion of macro 'DEFINE_STATIC_KEY_FALSE_RO'
48 | static DEFINE_STATIC_KEY_FALSE_RO(__use_tsc);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/jump_label.h:388:9: error: type defaults to 'int' in declaration of 'ANNOTATE_NOINSTR_ALLOWED' [-Werror=implicit-int]
388 | ANNOTATE_NOINSTR_ALLOWED(name)
| ^~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/kernel/tsc.c:48:8: note: in expansion of macro 'DEFINE_STATIC_KEY_FALSE_RO'
48 | static DEFINE_STATIC_KEY_FALSE_RO(__use_tsc);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/jump_label.h:371:39: warning: parameter names (without types) in function declaration
371 | #define STATIC_KEY_FALSE_INIT (struct static_key_false){ .key = STATIC_KEY_INIT_FALSE, }
| ^~~~~~~~~~~~~~~~
include/linux/jump_label.h:387:56: note: in expansion of macro 'STATIC_KEY_FALSE_INIT'
387 | struct static_key_false name __ro_after_init = STATIC_KEY_FALSE_INIT; \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kernel/tsc.c:48:8: note: in expansion of macro 'DEFINE_STATIC_KEY_FALSE_RO'
48 | static DEFINE_STATIC_KEY_FALSE_RO(__use_tsc);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from include/linux/static_key.h:1,
from arch/x86/include/asm/nospec-branch.h:6,
from arch/x86/include/asm/irqflags.h:9,
from include/linux/irqflags.h:18,
from include/linux/spinlock.h:59,
from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/mm.h:7,
from include/linux/memblock.h:12,
from arch/x86/kernel/cpu/common.c:5:
include/linux/jump_label.h:388:9: warning: data definition has no type or storage class
388 | ANNOTATE_NOINSTR_ALLOWED(name)
| ^~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/kernel/cpu/common.c:404:8: note: in expansion of macro 'DEFINE_STATIC_KEY_FALSE_RO'
404 | static DEFINE_STATIC_KEY_FALSE_RO(cr_pinning);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/jump_label.h:388:9: error: type defaults to 'int' in declaration of 'ANNOTATE_NOINSTR_ALLOWED' [-Werror=implicit-int]
388 | ANNOTATE_NOINSTR_ALLOWED(name)
| ^~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/kernel/cpu/common.c:404:8: note: in expansion of macro 'DEFINE_STATIC_KEY_FALSE_RO'
404 | static DEFINE_STATIC_KEY_FALSE_RO(cr_pinning);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/jump_label.h:371:39: warning: parameter names (without types) in function declaration
371 | #define STATIC_KEY_FALSE_INIT (struct static_key_false){ .key = STATIC_KEY_INIT_FALSE, }
| ^~~~~~~~~~~~~~~~
include/linux/jump_label.h:387:56: note: in expansion of macro 'STATIC_KEY_FALSE_INIT'
387 | struct static_key_false name __ro_after_init = STATIC_KEY_FALSE_INIT; \
| ^~~~~~~~~~~~~~~~~~~~~
arch/x86/kernel/cpu/common.c:404:8: note: in expansion of macro 'DEFINE_STATIC_KEY_FALSE_RO'
404 | static DEFINE_STATIC_KEY_FALSE_RO(cr_pinning);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~cc1: some warnings being treated as errors
vim +371 include/linux/jump_label.h
11276d5306b8e5 Peter Zijlstra 2015-07-24 36911276d5306b8e5 Peter Zijlstra 2015-07-24 370 #define STATIC_KEY_TRUE_INIT (struct static_key_true) { .key = STATIC_KEY_INIT_TRUE, } 11276d5306b8e5 Peter Zijlstra 2015-07-24 @371 #define STATIC_KEY_FALSE_INIT (struct static_key_false){ .key = STATIC_KEY_INIT_FALSE, } 11276d5306b8e5 Peter Zijlstra 2015-07-24 372
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki