From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev,
Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>,
"Borislav Petkov (AMD)" <bp@alien8.de>,
Kishon Vijay Abraham I <kvijayab@amd.com>,
Vasant Hegde <vasant.hegde@amd.com>,
Cyrill Gorcunov <gorcunov@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.14 25/26] x86/apic: Fix kernel panic when booting with intremap=off and x2apic_phys
Date: Mon, 26 Jun 2023 20:11:27 +0200 [thread overview]
Message-ID: <20230626180734.690915285@linuxfoundation.org> (raw)
In-Reply-To: <20230626180733.699092073@linuxfoundation.org>
From: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>
[ Upstream commit 85d38d5810e285d5aec7fb5283107d1da70c12a9 ]
When booting with "intremap=off" and "x2apic_phys" on the kernel command
line, the physical x2APIC driver ends up being used even when x2APIC
mode is disabled ("intremap=off" disables x2APIC mode). This happens
because the first compound condition check in x2apic_phys_probe() is
false due to x2apic_mode == 0 and so the following one returns true
after default_acpi_madt_oem_check() having already selected the physical
x2APIC driver.
This results in the following panic:
kernel BUG at arch/x86/kernel/apic/io_apic.c:2409!
invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.4.0-rc2-ver4.1rc2 #2
Hardware name: Dell Inc. PowerEdge R6515/07PXPY, BIOS 2.3.6 07/06/2021
RIP: 0010:setup_IO_APIC+0x9c/0xaf0
Call Trace:
<TASK>
? native_read_msr
apic_intr_mode_init
x86_late_time_init
start_kernel
x86_64_start_reservations
x86_64_start_kernel
secondary_startup_64_no_verify
</TASK>
which is:
setup_IO_APIC:
apic_printk(APIC_VERBOSE, "ENABLING IO-APIC IRQs\n");
for_each_ioapic(ioapic)
BUG_ON(mp_irqdomain_create(ioapic));
Return 0 to denote that x2APIC has not been enabled when probing the
physical x2APIC driver.
[ bp: Massage commit message heavily. ]
Fixes: 9ebd680bd029 ("x86, apic: Use probe routines to simplify apic selection")
Signed-off-by: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Kishon Vijay Abraham I <kvijayab@amd.com>
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20230616212236.1389-1-dheerajkumar.srivastava@amd.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/x86/kernel/apic/x2apic_phys.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c
index 98716a4be0a7c..fb9abdfc364d1 100644
--- a/arch/x86/kernel/apic/x2apic_phys.c
+++ b/arch/x86/kernel/apic/x2apic_phys.c
@@ -95,7 +95,10 @@ static void init_x2apic_ldr(void)
static int x2apic_phys_probe(void)
{
- if (x2apic_mode && (x2apic_phys || x2apic_fadt_phys()))
+ if (!x2apic_mode)
+ return 0;
+
+ if (x2apic_phys || x2apic_fadt_phys())
return 1;
return apic == &apic_x2apic_phys;
--
2.39.2
next prev parent reply other threads:[~2023-06-26 18:14 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-26 18:11 [PATCH 4.14 00/26] 4.14.320-rc1 review Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 01/26] serial: lantiq: add missing interrupt ack Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 02/26] nilfs2: reject devices with insufficient block count Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 03/26] nilfs2: fix buffer corruption due to concurrent device reads Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 04/26] Drivers: hv: vmbus: Fix vmbus_wait_for_unload() to scan present CPUs Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 05/26] cgroup: Do not corrupt task iteration when rebinding subsystem Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 06/26] nilfs2: prevent general protection fault in nilfs_clear_dirty_page() Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 07/26] xfrm: Linearize the skb after offloading if needed Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 08/26] net: qca_spi: Avoid high load if QCA7000 is not available Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 09/26] mmc: mtk-sd: fix deferred probing Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 10/26] mmc: omap: " Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 11/26] mmc: omap_hsmmc: " Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 12/26] mmc: usdhi60rol0: " Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 13/26] be2net: Extend xmit workaround to BE3 chip Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 14/26] netfilter: nf_tables: disallow element updates of bound anonymous sets Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 15/26] scsi: target: iscsi: Prevent login threads from racing between each other Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 16/26] HID: wacom: Add error check to wacom_parse_and_register() Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 17/26] arm64: Add missing Set/Way CMO encodings Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 18/26] nfcsim.c: Fix error checking for debugfs_create_dir Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 19/26] fbdev: imsttfb: Release framebuffer and dealloc cmap on error path Greg Kroah-Hartman
2023-06-28 21:41 ` Helge Deller
2023-06-29 7:06 ` Greg Kroah-Hartman
2023-06-29 9:39 ` Helge Deller
2023-06-26 18:11 ` [PATCH 4.14 20/26] usb: gadget: udc: fix NULL dereference in remove() Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 21/26] s390/cio: unregister device when the only path is gone Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 22/26] drm/exynos: vidi: fix a wrong error return Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 23/26] drm/exynos: fix race condition UAF in exynos_g2d_exec_ioctl Greg Kroah-Hartman
2023-06-26 18:11 ` [PATCH 4.14 24/26] drm/radeon: fix race condition UAF in radeon_gem_set_domain_ioctl Greg Kroah-Hartman
2023-06-26 18:11 ` Greg Kroah-Hartman [this message]
2023-06-26 18:11 ` [PATCH 4.14 26/26] i2c: imx-lpi2c: fix type char overflow issue when calculating the clock cycle Greg Kroah-Hartman
2023-06-27 9:04 ` [PATCH 4.14 00/26] 4.14.320-rc1 review Jon Hunter
2023-06-27 20:05 ` Chris Paterson
2023-06-27 21:31 ` Harshit Mogalapalli
2023-06-27 21:33 ` Guenter Roeck
2023-06-28 7:17 ` Naresh Kamboju
2023-06-28 13:34 ` Known bad patches from AUTOSEL was " Pavel Machek
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=20230626180734.690915285@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=bp@alien8.de \
--cc=dheerajkumar.srivastava@amd.com \
--cc=gorcunov@gmail.com \
--cc=kvijayab@amd.com \
--cc=patches@lists.linux.dev \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=vasant.hegde@amd.com \
/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).