On Tue, Nov 19, 2024 at 04:34:56PM +0100, Valentin Schneider wrote:
> Later commits will disallow runtime-mutable text in .noinstr sections in
> order to safely defer instruction patching IPIs.
> 
> All static keys used in .noinstr sections have now been checked as being
> either flagged as __ro_after_init, or as forceful static keys. Any
> occurrence of this new warning would be the result of a code change that
> will need looking at.
> 
> Suggested-by: Josh Poimboeuf <jpoim...@redhat.com>
> Signed-off-by: Valentin Schneider <vschn...@redhat.com>
> ---
> offset_of(static_key.type) and JUMP_TYPE_FORCEFUL would need to be shoved
> into a somewhat standalone header file that could be included by objtool
> itself.

static_key and JUMP_TYPE_* can be moved to jump_label_types.h which can
be included by jump_label.h and also synced to tools/include/linux for
objtool to access.  I guess objtool would have to "#define
CONFIG_JUMP_LABEL" before including it to get the full definition.

> @@ -3605,6 +3608,41 @@ static int validate_return(struct symbol *func, struct 
> instruction *insn, struct
>       return 0;
>  }
>  
> +static bool static_key_is_forceful(struct symbol *key)
> +{
> +     if (!strcmp(key->sec->name, ".data")) {

There are some configs (and more coming in the future) which compile
with the kernel with -fdata-sections.  So this may need to be something
like
        if (strstarts(key->sec->name, ".data"))

-- 
Josh

Reply via email to