From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384941; b=xRMAHhFIMEhs6HcZuWp4VIyEBoFvFNRfLkMlw5KgmBVNpO+eWIgmtpwLDQvgHvCfQObJ HPMJeNgfoLbiEsqKeAK9X7NGBpo0A+ah83UVdo9UEXDC6SU+3vT5z2TRe5QMrIazenbL6 N7egF/yDpzZrdpEiCiHRbSvZ1E+jlmoBbgxmVzyZ+MDhExmKODm27NNKQiP34m0buSzQh /dOnhEY090+SCDguI62UF3hActIQDcuk5ZZUkjuOttrfH/Xpy8/VR+99p1OWWBubWqfes z+4vQQnwg8/jOL6aHkPtq175XVH5YFINFccVCTj1BPqe4HEhnA1RkdNBqA23PnUnVTA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384941; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=enOmLv7nOw0FbfBOmETIIPfo2juLN3nv6Jb+hZOXBhs=; b=qy5gAFhp8lgFrizC7hY8VpGe29/W7ciqB1DdsdM+n3qw0AvdVnnNfguGTInkAV1c8GGk kSSFz55fpLB1ZM16jCWMsUlkkyOYhKY9ahr5L4Ze/yXhjqaPICsLtgjNfoXSgAMy+MtDN yJ1DSJFukwlPKsKbce8S3j8+Mi58ULLM2z9/XwfWwWyV+LE08pH+Z1S7VhJ0oALXZvfE4 Nb4phrN425uABHekz5G3b/nsOBZ3UTSShwiEsHPqLrdC7tQTuBYEVuBxrhXw4opMzMnkM vWcY2FdmX8b8iaaLu3JH3+g9EkBQYYhBIOBo5cTWimpCKM8SDq3V0TeQbgHSgRhA0iQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=kzFEa+hz; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E7975606A33C; Fri, 4 Dec 2026 11:49:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=kzFEa+hz Received: by smtp.kernel.org (Postfix) with ESMTPSA id 302AB1F00935; Fri, 4 Dec 2026 11:49:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384940; bh=enOmLv7nOw0FbfBOmETIIPfo2juLN3nv6Jb+hZOXBhs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kzFEa+hzNhM2J8/jt3mKFdRulHl+1XqhbWNWHXUED/L7/nDpggnpYKEbP3R8gzmpl f4zzQrJIlHzkKlL1/H3NK0VYrbRQb6U2yF3F3xDIcytD4l1kEgKsbhBDcQynG2Azva cK4Dbiu8LLvCqU0rSyoMOnURV8bJQiHNSpVwr3qs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Venkat Rao Bagalkote , Mukesh Kumar Chaurasiya , Shrikanth Hegde , Madhavan Srinivasan , Sasha Levin Subject: [PATCH 6.6 0355/1167] powerpc/interrupt: Use early_radix_enabled() in NMI real-mode guard Date: Fri, 4 Dec 2026 18:56:22 +0900 Message-ID: <20261204100711.235701776@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Venkat Rao Bagalkote [ Upstream commit 644ffb02746690c0ebfe143e066f81c9bde2975e ] radix_enabled() uses a jump label which is only valid after setup_feature_keys() is called. Before that point, on a pSeries hash guest, early_check_vec5() clears MMU_FTR_TYPE_RADIX in cur_cpu_spec->mmu_features, but the jump label has not yet been patched, so radix_enabled() incorrectly returns true. The dangerous usage window where it goes wrong in early_setup(): early_setup: configure_exceptions(); setup_feature_keys(); If an NMI occurs in this window, !radix_enabled() evaluates to false in DEFINE_INTERRUPT_HANDLER_NMI. The handler fails to skip NMI entry in real mode and attempts to access memory outside the Real Mode Area (RMA), hanging the boot. Since common interrupt wrappers do not have the context of early or late, using early_radix_enabled() is the safer option. It does a plain bitmask check against cur_cpu_spec->mmu_features and is correct at all times. Console logs from a pSeries HASH guest showing values across boot stages: [ 0.000000] DEBUG: after early_init_devtree: early_radix_enabled=0 radix_enabled=1 (mismatch means NMI real-mode check is unsafe!) [ 0.000000] DEBUG: after configure_exceptions (DANGEROUS WINDOW): early_radix_enabled=0 radix_enabled=1 [ 0.000000] DEBUG: after setup_feature_keys (jump labels initialized): early_radix_enabled=0 radix_enabled=0 (should now match!) [ 0.057124] DEBUG: post secondary CPU bringup: early_radix_enabled=0 radix_enabled=0 (should match!) Console logs from a RADIX guest showing values across boot stages: [ 0.000000] DEBUG: after early_init_devtree: early_radix_enabled=1 radix_enabled=1 (mismatch means NMI real-mode check is unsafe!) [ 0.000000] DEBUG: after configure_exceptions (DANGEROUS WINDOW): early_radix_enabled=1 radix_enabled=1 [ 0.000000] DEBUG: after setup_feature_keys (jump labels initialized): early_radix_enabled=1 radix_enabled=1 (should now match!) [ 0.057016] DEBUG: post secondary CPU bringup: early_radix_enabled=1 radix_enabled=1 (should match!) Add the missing #include in alphabetical order since early_radix_enabled() is declared there. Fixes: 8d0e21012743 ("powerpc/mce: Avoid nmi_enter/exit in real mode on pseries hash") Signed-off-by: Venkat Rao Bagalkote Reviewed-by: Mukesh Kumar Chaurasiya Reviewed-by: Shrikanth Hegde Signed-off-by: Madhavan Srinivasan Link: https://patch.msgid.link/20260909123240.58786-1-venkat88@linux.ibm.com [ sashal: Replaced radix_enabled() with early_radix_enabled() in the two inline functions interrupt_nmi_enter_prepare() and interrupt_nmi_exit_prepare(), since there is no DEFINE_INTERRUPT_HANDLER_NMI macro guard here, and adjusted the include context. ] Signed-off-by: Sasha Levin --- arch/powerpc/include/asm/interrupt.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/interrupt.h b/arch/powerpc/include/asm/interrupt.h index 5f9d61b2159cc..4e2b1ca5253e2 100644 --- a/arch/powerpc/include/asm/interrupt.h +++ b/arch/powerpc/include/asm/interrupt.h @@ -72,6 +72,7 @@ #include #include #include +#include #include #ifdef CONFIG_PPC_IRQ_SOFT_MASK_DEBUG @@ -326,7 +327,7 @@ static inline void interrupt_nmi_enter_prepare(struct pt_regs *regs, struct inte */ if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) && firmware_has_feature(FW_FEATURE_LPAR) && - !radix_enabled()) + !early_radix_enabled()) return; /* @@ -355,7 +356,7 @@ static inline void interrupt_nmi_exit_prepare(struct pt_regs *regs, struct inter nmi_exit(); } else if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) && firmware_has_feature(FW_FEATURE_LPAR) && - !radix_enabled()) { + !early_radix_enabled()) { // no nmi_exit for a pseries hash guest taking a real mode exception } else if (IS_ENABLED(CONFIG_KASAN)) { // no nmi_exit for KASAN in real mode -- 2.53.0