[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180214170133.GA19502@pd.tnic>
Date: Wed, 14 Feb 2018 18:01:33 +0100
From: Borislav Petkov <bp@...e.de>
To: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
Jason Baron <jbaron@...mai.com>
Subject: Re: [PATCH 1/3] jump_label: Warn on failed jump_label patch
On Wed, Feb 14, 2018 at 10:40:41AM -0600, Josh Poimboeuf wrote:
> When the jump label code encounters an address which isn't recognized by
> kernel_text_address(), it just silently fails.
>
> This can be dangerous because jump labels are used in a variety of
> places, and are generally expected to work. Convert the silent failure
> to a warning.
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@...hat.com>
> ---
> kernel/jump_label.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/jump_label.c b/kernel/jump_label.c
> index b4517095db6a..c71fb7cdfc41 100644
> --- a/kernel/jump_label.c
> +++ b/kernel/jump_label.c
> @@ -370,8 +370,12 @@ static void __jump_label_update(struct static_key *key,
> * kernel_text_address() verifies we are not in core kernel
> * init code, see jump_label_invalidate_module_init().
> */
> - if (entry->code && kernel_text_address(entry->code))
> - arch_jump_label_transform(entry, jump_label_type(entry));
> + if (entry->code) {
> + if (kernel_text_address(entry->code))
> + arch_jump_label_transform(entry, jump_label_type(entry));
> + else
> + WARN_ONCE(1, "can't patch jump_label at %pS", (void *)entry->code);
> + }
> }
> }
>
> --
> 2.14.3
Good idea.
Reviewed-by: Borislav Petkov <bp@...e.de>
--
Regards/Gruss,
Boris.
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
--
Powered by blists - more mailing lists