From: Peter Zijlstra <peterz@infradead.org>
To: x86@kernel.org, jpoimboe@redhat.com, jbaron@akamai.com,
rostedt@goodmis.org, ardb@kernel.org
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
sumit.garg@linaro.org, oliver.sang@intel.com, jarkko@kernel.org
Subject: [PATCH 3/3] static_call: Fix static_call_update() sanity check
Date: Thu, 18 Mar 2021 12:31:59 +0100 [thread overview]
Message-ID: <20210318113610.739542434@infradead.org> (raw)
In-Reply-To: 20210318113156.407406787@infradead.org
Sites that match init_section_contains() get marked as INIT. For
built-in code init_sections contains both __init and __exit text. OTOH
kernel_text_address() only explicitly includes __init text (and there
are no __exit text markers).
Match what jump_label already does and ignore the warning for INIT
sites. Also see the excellent changelog for commit: 8f35eaa5f2de
("jump_label: Don't warn on __exit jump entries")
Fixes: 9183c3f9ed710 ("static_call: Add inline static call infrastructure")
Reported-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
kernel/jump_label.c | 8 ++++++++
kernel/static_call.c | 11 ++++++++++-
2 files changed, 18 insertions(+), 1 deletion(-)
--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -407,6 +407,14 @@ static bool jump_label_can_update(struct
return false;
if (!kernel_text_address(jump_entry_code(entry))) {
+ /*
+ * This skips patching __exit, which is part of
+ * init_section_contains() but is not part of
+ * kernel_text_address().
+ *
+ * Skipping __exit is fine since it will never
+ * be executed.
+ */
WARN_ONCE(!jump_entry_is_init(entry),
"can't patch jump_label at %pS",
(void *)jump_entry_code(entry));
--- a/kernel/static_call.c
+++ b/kernel/static_call.c
@@ -181,7 +181,16 @@ void __static_call_update(struct static_
continue;
if (!kernel_text_address((unsigned long)site_addr)) {
- WARN_ONCE(1, "can't patch static call site at %pS",
+ /*
+ * This skips patching __exit, which is part of
+ * init_section_contains() but is not part of
+ * kernel_text_address().
+ *
+ * Skipping __exit is fine since it will never
+ * be executed.
+ */
+ WARN_ONCE(!static_call_is_init(site),
+ "can't patch static call site at %pS",
site_addr);
continue;
}
next prev parent reply other threads:[~2021-03-18 11:39 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-18 11:31 [PATCH 0/3] static_call() vs __exit fixes Peter Zijlstra
2021-03-18 11:31 ` [PATCH 1/3] static_call: Fix static_call_set_init() Peter Zijlstra
2021-03-19 12:25 ` [tip: locking/urgent] " tip-bot2 for Peter Zijlstra
2021-03-18 11:31 ` [PATCH 2/3] static_call: Align static_call_is_init() patching condition Peter Zijlstra
2021-03-19 12:25 ` [tip: locking/urgent] " tip-bot2 for Peter Zijlstra
2021-03-19 13:31 ` [PATCH 2/3] " Rasmus Villemoes
2021-03-19 14:13 ` Peter Zijlstra
2021-03-19 14:40 ` Rasmus Villemoes
2021-03-19 15:44 ` Rasmus Villemoes
2021-03-22 16:59 ` Peter Zijlstra
2021-03-18 11:31 ` Peter Zijlstra [this message]
2021-03-18 11:42 ` [PATCH 3/3] static_call: Fix static_call_update() sanity check Peter Zijlstra
2021-03-18 16:13 ` Josh Poimboeuf
2021-03-18 16:58 ` Peter Zijlstra
2021-03-19 12:57 ` Peter Zijlstra
2021-03-19 18:00 ` Steven Rostedt
2021-03-19 19:34 ` Peter Zijlstra
2021-03-19 20:57 ` Steven Rostedt
2021-03-22 14:50 ` Jessica Yu
2021-03-22 16:54 ` Peter Zijlstra
2021-03-22 17:36 ` Jessica Yu
2021-03-22 13:07 ` Jessica Yu
2021-03-22 14:06 ` Peter Zijlstra
2021-03-19 12:25 ` [tip: locking/urgent] " tip-bot2 for Peter Zijlstra
2021-03-18 12:15 ` [PATCH 0/3] static_call() vs __exit fixes Sumit Garg
2021-03-18 19:38 ` Jarkko Sakkinen
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=20210318113610.739542434@infradead.org \
--to=peterz@infradead.org \
--cc=ardb@kernel.org \
--cc=jarkko@kernel.org \
--cc=jbaron@akamai.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oliver.sang@intel.com \
--cc=rostedt@goodmis.org \
--cc=sumit.garg@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).