From: Andrew Murray Date: Wed, 28 Aug 2019 17:50:05 +0000 (+0100) Subject: jump_label: Don't warn on __exit jump entries X-Git-Tag: Ubuntu-5.3.0-20.21~606 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=160ad5474de5f677bf240cdc1553d1b0d6bc19a8;p=mirror_ubuntu-eoan-kernel.git jump_label: Don't warn on __exit jump entries BugLink: https://bugs.launchpad.net/bugs/1848046 [ Upstream commit 8f35eaa5f2de020073a48ad51112237c5932cfcc ] On architectures that discard .exit.* sections at runtime, a warning is printed for each jump label that is used within an in-kernel __exit annotated function: can't patch jump_label at ehci_hcd_cleanup+0x8/0x3c WARNING: CPU: 0 PID: 1 at kernel/jump_label.c:410 __jump_label_update+0x12c/0x138 As these functions will never get executed (they are free'd along with the rest of initmem) - we do not need to patch them and should not display any warnings. The warning is displayed because the test required to satisfy jump_entry_is_init is based on init_section_contains (__init_begin to __init_end) whereas the test in __jump_label_update is based on init_kernel_text (_sinittext to _einittext) via kernel_text_address). Fixes: 19483677684b ("jump_label: Annotate entries that operate on __init code earlier") Signed-off-by: Andrew Murray Acked-by: Peter Zijlstra (Intel) Acked-by: Mark Rutland Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Signed-off-by: Paolo Pisati Signed-off-by: Kleber Sacilotto de Souza --- diff --git a/kernel/jump_label.c b/kernel/jump_label.c index df3008419a1d..cdb3ffab128b 100644 --- a/kernel/jump_label.c +++ b/kernel/jump_label.c @@ -407,7 +407,9 @@ static bool jump_label_can_update(struct jump_entry *entry, bool init) return false; if (!kernel_text_address(jump_entry_code(entry))) { - WARN_ONCE(1, "can't patch jump_label at %pS", (void *)jump_entry_code(entry)); + WARN_ONCE(!jump_entry_is_init(entry), + "can't patch jump_label at %pS", + (void *)jump_entry_code(entry)); return false; }