From: tip-bot for Josh Poimboeuf <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
tglx@linutronix.de, jbaron@akamai.com, rostedt@goodmis.org,
mingo@kernel.org, peterz@infradead.org, hpa@zytor.com,
bp@suse.de, jpoimboe@redhat.com
Subject: [tip:x86/pti] jump_label: Warn on failed jump_label patching attempt
Date: Wed, 21 Feb 2018 02:49:00 -0800 [thread overview]
Message-ID: <tip-5400c00440061515c5bda299c19b6e86b81be798@git.kernel.org> (raw)
In-Reply-To: <de3a271c93807adb7ed48f4e946b4f9156617680.1519051220.git.jpoimboe@redhat.com>
Commit-ID: 5400c00440061515c5bda299c19b6e86b81be798
Gitweb: https://git.kernel.org/tip/5400c00440061515c5bda299c19b6e86b81be798
Author: Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Tue, 20 Feb 2018 11:37:52 -0600
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 21 Feb 2018 10:11:39 +0100
jump_label: Warn on failed jump_label patching attempt
Currently 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.
This won't warn about attempted writes to tracepoints in __init code
after initmem has been freed, as those are already guarded by the
entry->code check.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Borislav Petkov <bp@suse.de>
Cc: Jason Baron <jbaron@akamai.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/de3a271c93807adb7ed48f4e946b4f9156617680.1519051220.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/jump_label.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/kernel/jump_label.c b/kernel/jump_label.c
index b717765..b2f0b47 100644
--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -367,12 +367,15 @@ static void __jump_label_update(struct static_key *key,
{
for (; (entry < stop) && (jump_entry_key(entry) == key); entry++) {
/*
- * entry->code set to 0 invalidates module init text sections
- * kernel_text_address() verifies we are not in core kernel
- * init code, see jump_label_invalidate_module_init().
+ * An entry->code of 0 indicates an entry which has been
+ * disabled because it was in an init text area.
*/
- 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);
+ }
}
}
next prev parent reply other threads:[~2018-02-21 10:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-20 17:37 [PATCH v4 0/3] jump_label: Robustify jump label patching Josh Poimboeuf
2018-02-20 17:37 ` [PATCH v4 1/3] jump_label: Explicitly disable jump labels in __init code Josh Poimboeuf
2018-02-21 10:48 ` [tip:x86/pti] " tip-bot for Josh Poimboeuf
2018-02-21 17:01 ` tip-bot for Josh Poimboeuf
2018-02-20 17:37 ` [PATCH v4 2/3] jump_label: Warn on failed jump_label patch Josh Poimboeuf
2018-02-21 10:49 ` tip-bot for Josh Poimboeuf [this message]
2018-02-21 17:02 ` [tip:x86/pti] jump_label: Warn on failed jump_label patching attempt tip-bot for Josh Poimboeuf
2018-02-20 17:37 ` [PATCH v4 3/3] extable: Make init_kernel_text() global Josh Poimboeuf
2018-02-21 10:49 ` [tip:x86/pti] " tip-bot for Josh Poimboeuf
2018-02-21 17:02 ` tip-bot for 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=tip-5400c00440061515c5bda299c19b6e86b81be798@git.kernel.org \
--to=tipbot@zytor.com \
--cc=bp@suse.de \
--cc=hpa@zytor.com \
--cc=jbaron@akamai.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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.