From: Alexander Gordeev <agordeev@linux.ibm.com>
To: Ard Biesheuvel <ardb@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Jason Baron <jbaron@akamai.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] jump_label: explicitly annotate inittext labels as init
Date: Fri, 9 Dec 2022 07:07:40 +0100 [thread overview]
Message-ID: <20221209060740.2785164-1-agordeev@linux.ibm.com> (raw)
inittext code may be out of [__init_begin, __init_end]
range on some architectures. Yet, the jump_label_init()
only calls init_section_contains() function to check if
a label needs to be annotated as init and inittext code
is left behind.
Fixes: 19483677684b ("jump_label: Annotate entries that operate on __init code earlier")
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
---
kernel/jump_label.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/kernel/jump_label.c b/kernel/jump_label.c
index 714ac4c3b556..77680665d374 100644
--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -481,13 +481,16 @@ void __init jump_label_init(void)
for (iter = iter_start; iter < iter_stop; iter++) {
struct static_key *iterk;
+ unsigned long addr;
bool in_init;
/* rewrite NOPs */
if (jump_label_type(iter) == JUMP_LABEL_NOP)
arch_jump_label_transform_static(iter, JUMP_LABEL_NOP);
- in_init = init_section_contains((void *)jump_entry_code(iter), 1);
+ addr = jump_entry_code(iter);
+ in_init = init_section_contains((void *)addr, 1) ||
+ is_kernel_inittext(addr);
jump_entry_set_init(iter, in_init);
iterk = jump_entry_key(iter);
--
2.34.1
next reply other threads:[~2022-12-09 6:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-09 6:07 Alexander Gordeev [this message]
2022-12-09 9:41 ` Ard Biesheuvel
2022-12-09 12:48 ` Alexander Gordeev
2022-12-09 13:48 ` Ard Biesheuvel
2022-12-09 14:48 ` Alexander Gordeev
2022-12-09 14:49 ` Ard Biesheuvel
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=20221209060740.2785164-1-agordeev@linux.ibm.com \
--to=agordeev@linux.ibm.com \
--cc=ardb@kernel.org \
--cc=jbaron@akamai.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.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
all inboxes | Powered by JetHome®