All of lore.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@suse.de>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Jason Baron <jbaron@akamai.com>
Subject: Re: [PATCH 1/3] jump_label: Warn on failed jump_label patch
Date: Wed, 14 Feb 2018 18:01:33 +0100	[thread overview]
Message-ID: <20180214170133.GA19502@pd.tnic> (raw)
In-Reply-To: <b8f1b55f17c346fba39d3f59a01251185e09e151.1518626149.git.jpoimboe@redhat.com>

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@redhat.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@suse.de>

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

  parent reply	other threads:[~2018-02-14 17:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-14 16:40 [PATCH 0/3] jump_label: Robustify jump label patching Josh Poimboeuf
2018-02-14 16:40 ` [PATCH 1/3] jump_label: Warn on failed jump_label patch Josh Poimboeuf
2018-02-14 17:01   ` Steven Rostedt
2018-02-14 17:18     ` Jason Baron
2018-02-14 17:34       ` Josh Poimboeuf
2018-02-14 17:40         ` Steven Rostedt
2018-02-14 21:17           ` Josh Poimboeuf
2018-02-15 22:35             ` Josh Poimboeuf
2018-02-16 17:31               ` Steven Rostedt
2018-02-14 17:01   ` Borislav Petkov [this message]
2018-02-14 16:40 ` [PATCH 2/3] x86/xen: Remove inert tracepoint in __init code Josh Poimboeuf
2018-02-14 16:49   ` Juergen Gross
2018-02-14 16:40 ` [PATCH 3/3] percpu: " Josh Poimboeuf
2018-02-15 15:22   ` Tejun Heo
2018-02-15 15:33     ` Josh Poimboeuf
2018-02-16  9:02       ` Ingo Molnar
2018-02-16 12:52         ` Josh Poimboeuf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180214170133.GA19502@pd.tnic \
    --to=bp@suse.de \
    --cc=jbaron@akamai.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.