From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Dan Williams <dan.j.williams@intel.com>,
Guenter Roeck <groeck@google.com>,
Kees Cook <keescook@chromium.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Thomas Gleixner <tglx@linutronix.de>,
Mike Rapoport <rppt@linux.ibm.com>,
Russell King <rmk@armlinux.org.uk>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH AUTOSEL 4.9 15/25] init: initialize jump labels before command line option parsing
Date: Tue, 7 May 2019 01:41:12 -0400 [thread overview]
Message-ID: <20190507054123.32514-15-sashal@kernel.org> (raw)
In-Reply-To: <20190507054123.32514-1-sashal@kernel.org>
From: Dan Williams <dan.j.williams@intel.com>
[ Upstream commit 6041186a32585fc7a1d0f6cfe2f138b05fdc3c82 ]
When a module option, or core kernel argument, toggles a static-key it
requires jump labels to be initialized early. While x86, PowerPC, and
ARM64 arrange for jump_label_init() to be called before parse_args(),
ARM does not.
Kernel command line: rdinit=/sbin/init page_alloc.shuffle=1 panic=-1 console=ttyAMA0,115200 page_alloc.shuffle=1
------------[ cut here ]------------
WARNING: CPU: 0 PID: 0 at ./include/linux/jump_label.h:303
page_alloc_shuffle+0x12c/0x1ac
static_key_enable(): static key 'page_alloc_shuffle_key+0x0/0x4' used
before call to jump_label_init()
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted
5.1.0-rc4-next-20190410-00003-g3367c36ce744 #1
Hardware name: ARM Integrator/CP (Device Tree)
[<c0011c68>] (unwind_backtrace) from [<c000ec48>] (show_stack+0x10/0x18)
[<c000ec48>] (show_stack) from [<c07e9710>] (dump_stack+0x18/0x24)
[<c07e9710>] (dump_stack) from [<c001bb1c>] (__warn+0xe0/0x108)
[<c001bb1c>] (__warn) from [<c001bb88>] (warn_slowpath_fmt+0x44/0x6c)
[<c001bb88>] (warn_slowpath_fmt) from [<c0b0c4a8>]
(page_alloc_shuffle+0x12c/0x1ac)
[<c0b0c4a8>] (page_alloc_shuffle) from [<c0b0c550>] (shuffle_store+0x28/0x48)
[<c0b0c550>] (shuffle_store) from [<c003e6a0>] (parse_args+0x1f4/0x350)
[<c003e6a0>] (parse_args) from [<c0ac3c00>] (start_kernel+0x1c0/0x488)
Move the fallback call to jump_label_init() to occur before
parse_args().
The redundant calls to jump_label_init() in other archs are left intact
in case they have static key toggling use cases that are even earlier
than option parsing.
Link: http://lkml.kernel.org/r/155544804466.1032396.13418949511615676665.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Reported-by: Guenter Roeck <groeck@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Mike Rapoport <rppt@linux.ibm.com>
Cc: Russell King <rmk@armlinux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
init/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/init/main.c b/init/main.c
index 3c7f71d8e704..148843e627a0 100644
--- a/init/main.c
+++ b/init/main.c
@@ -516,6 +516,8 @@ asmlinkage __visible void __init start_kernel(void)
page_alloc_init();
pr_notice("Kernel command line: %s\n", boot_command_line);
+ /* parameters may set static keys */
+ jump_label_init();
parse_early_param();
after_dashes = parse_args("Booting kernel",
static_command_line, __start___param,
@@ -525,8 +527,6 @@ asmlinkage __visible void __init start_kernel(void)
parse_args("Setting init args", after_dashes, NULL, 0, -1, -1,
NULL, set_init_arg);
- jump_label_init();
-
/*
* These use large bootmem allocations and must precede
* kmem_cache_init()
--
2.20.1
next prev parent reply other threads:[~2019-05-07 5:42 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-07 5:40 [PATCH AUTOSEL 4.9 01/25] iio: adc: xilinx: fix potential use-after-free on remove Sasha Levin
2019-05-07 5:40 ` [PATCH AUTOSEL 4.9 02/25] libnvdimm/namespace: Fix a potential NULL pointer dereference Sasha Levin
2019-05-07 5:41 ` [PATCH AUTOSEL 4.9 03/25] HID: input: add mapping for Expose/Overview key Sasha Levin
2019-05-07 5:41 ` [PATCH AUTOSEL 4.9 04/25] HID: input: add mapping for keyboard Brightness Up/Down/Toggle keys Sasha Levin
2019-05-07 5:41 ` [PATCH AUTOSEL 4.9 05/25] HID: input: add mapping for "Toggle Display" key Sasha Levin
2019-05-07 5:41 ` [PATCH AUTOSEL 4.9 06/25] libnvdimm/btt: Fix a kmemdup failure check Sasha Levin
2019-05-07 5:41 ` [PATCH AUTOSEL 4.9 07/25] s390/dasd: Fix capacity calculation for large volumes Sasha Levin
2019-05-07 5:41 ` [PATCH AUTOSEL 4.9 08/25] mac80211: fix unaligned access in mesh table hash function Sasha Levin
2019-05-07 5:41 ` [PATCH AUTOSEL 4.9 09/25] Input: snvs_pwrkey - initialize necessary driver data before enabling IRQ Sasha Levin
2019-05-07 5:41 ` [PATCH AUTOSEL 4.9 10/25] s390/3270: fix lockdep false positive on view->lock Sasha Levin
2019-05-07 5:41 ` [PATCH AUTOSEL 4.9 11/25] mISDN: Check address length before reading address family Sasha Levin
2019-05-07 5:41 ` [PATCH AUTOSEL 4.9 12/25] x86/reboot, efi: Use EFI reboot for Acer TravelMate X514-51T Sasha Levin
2019-05-07 5:41 ` [PATCH AUTOSEL 4.9 13/25] KVM: x86: avoid misreporting level-triggered irqs as edge-triggered in tracing Sasha Levin
2019-05-07 5:41 ` [PATCH AUTOSEL 4.9 14/25] tools lib traceevent: Fix missing equality check for strcmp Sasha Levin
2019-05-07 5:41 ` Sasha Levin [this message]
2019-05-07 5:41 ` [PATCH AUTOSEL 4.9 16/25] selftests: netfilter: check icmp pkttoobig errors are set as related Sasha Levin
2019-05-07 5:41 ` [PATCH AUTOSEL 4.9 17/25] ipvs: do not schedule icmp errors from tunnels Sasha Levin
2019-05-07 5:41 ` [PATCH AUTOSEL 4.9 18/25] MIPS: perf: ath79: Fix perfcount IRQ assignment Sasha Levin
2019-06-06 21:28 ` Petr Štetiar
2019-06-09 10:05 ` Greg KH
2019-05-07 5:41 ` [PATCH AUTOSEL 4.9 19/25] s390: ctcm: fix ctcm_new_device error return code Sasha Levin
2019-05-07 5:41 ` [PATCH AUTOSEL 4.9 20/25] drm/sun4i: Set device driver data at bind time for use in unbind Sasha Levin
2019-05-07 5:41 ` [PATCH AUTOSEL 4.9 21/25] selftests/net: correct the return value for run_netsocktests Sasha Levin
2019-05-07 5:41 ` [PATCH AUTOSEL 4.9 22/25] gpu: ipu-v3: dp: fix CSC handling Sasha Levin
2019-05-07 5:41 ` [PATCH AUTOSEL 4.9 23/25] spi: Micrel eth switch: declare missing of table Sasha Levin
2019-05-07 5:41 ` [PATCH AUTOSEL 4.9 24/25] spi: ST ST95HF NFC: " Sasha Levin
2019-05-07 5:41 ` [PATCH AUTOSEL 4.9 25/25] Input: synaptics-rmi4 - fix possible double free Sasha Levin
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=20190507054123.32514-15-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=groeck@google.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=rmk@armlinux.org.uk \
--cc=rppt@linux.ibm.com \
--cc=stable@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox