Re: [RFC PATCH v3 06/15] jump_label: Add forceful jump label type

From: Josh Poimboeuf
Date: Tue Nov 19 2024 - 18:39:21 EST


On Tue, Nov 19, 2024 at 04:34:53PM +0100, Valentin Schneider wrote:
> Later commits will cause objtool to warn about non __ro_after_init static
> keys being used in .noinstr sections in order to safely defer instruction
> patching IPIs targeted at NOHZ_FULL CPUs.

Don't we need similar checking for static calls?

> Two such keys currently exist: mds_idle_clear and __sched_clock_stable,
> which can both be modified at runtime.

Not sure if feasible, but it sure would be a lot simpler to just make
"no noinstr patching" a hard rule and then convert the above keys (or at
least their noinstr-specific usage) to regular branches.

Then "no noinstr patching" could be unilaterally enforced in
text_poke_bp().

> diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
> index f5a2727ca4a9a..93e729545b941 100644
> --- a/include/linux/jump_label.h
> +++ b/include/linux/jump_label.h
> @@ -200,7 +200,8 @@ struct module;
> #define JUMP_TYPE_FALSE 0UL
> #define JUMP_TYPE_TRUE 1UL
> #define JUMP_TYPE_LINKED 2UL
> -#define JUMP_TYPE_MASK 3UL
> +#define JUMP_TYPE_FORCEFUL 4UL

JUMP_TYPE_NOINSTR_ALLOWED ?

--
Josh