Re: [RFC PATCH v3 09/15] objtool: Warn about non __ro_after_init static key usage in .noinstr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <jpoimboe@xxxxxxxxxx>
> Signed-off-by: Valentin Schneider <vschneid@xxxxxxxxxx>
> ---
> 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




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux