From: Josh Poimboeuf Adding static keys to entry text needs to be done with care, as they may be executed before a context serialization operation has been run. Add DEFINE_STATIC_KEY_*_ENTRY() variants for those. They don't do anything special yet; that will come later. Signed-off-by: Josh Poimboeuf [Reduced from .noinstr to .entry.text] Signed-off-by: Valentin Schneider --- include/linux/jump_label.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h index c95350a109876..36634f08d30a7 100644 --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h @@ -374,6 +374,20 @@ struct static_key_false { #define DEFINE_STATIC_KEY_FALSE_RO(name) \ struct static_key_false name __ro_after_init = STATIC_KEY_FALSE_INIT +/* + * Objtool will warn about static keys used in early entry code, as they may + * be unsafe if executed before any serializing operation. + * + * The _ENTRY variants are used to tell objtool the static key is safe to be + * used. If using one of these _ENTRY variants, please add a comment above the + * definition with the rationale. + */ +#define DEFINE_STATIC_KEY_TRUE_ENTRY(name) \ + DEFINE_STATIC_KEY_TRUE(name) + +#define DEFINE_STATIC_KEY_FALSE_ENTRY(name) \ + DEFINE_STATIC_KEY_FALSE(name) + #define DECLARE_STATIC_KEY_FALSE(name) \ extern struct static_key_false name -- 2.56.1