Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3637310pxb; Mon, 24 Jan 2022 14:06:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJyoMZb1TTuR0n3/di237lHwQMvmew9m8QlA3IL139VOL9gt49L6fIw64pO+x6h+Jt1bB11V X-Received: by 2002:a63:6b44:: with SMTP id g65mr13166873pgc.175.1643061999039; Mon, 24 Jan 2022 14:06:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643061999; cv=none; d=google.com; s=arc-20160816; b=cYs/XRw6elKj5X0RbESpRZJJ8UFyxFcSUIndcNFoj+Nm3aGdcuIDpexim+Nkxbsdi5 naQENzUYJEXY36CheYWS2xG45vpB6o9k42gsg3BxJiQvB12TtITHM+4/Hk4lSP8YiSf4 sknuPoJR6ZebJ19GIGraR9kUkUHr0H6zqIKNoW28FviQ9tHlCx9fq0RP7UsZd/tdZb8c IxkkScXZMOU/xlnClzBCJNKnR2OY1QCW+7A6GXKFCkktnGCVv0FA2Z1edM6pJYVYpP3u yPv5YMo5Cya8xdt1X/8ZXAv7HStT31pA+tJj1xC1WJVRfDFm7HJnrSzdo3F4B1IBpd1B +zaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LKbu5csMYJq50VQqJmEHyJV8ugZKbVfv4PqH+PW4qPg=; b=rk/kalrFOUT9eecEQJ/tQfTAvtYHMVLcaUTyk0TeFtDvX5DKmEadYKAoZ7wlB/loPl PtdffJDcOoJF5YhJk4TWJfDMKgww3c0b+784jjztmCHYnwEyLpiz8lBBtruHd/1in5/+ kmd3DTnE9TfhzfngCYkzvAPbwPTOh9jA2vZiIJSOhZhdyyqw1xci9kYfAfg2w9Ty9rbs jWSKL4qFKcFc5lsScHTTuTNiqHXxP7HYWBneGmr3SeVUakGyzovelsq1xz8SKk8o61v0 sFri0tC6V51OfuxgY/6t0OK9rJPr8k72JnthNVv0hr/XVPQGkgQi2dTqmSo+ZhgIBBmG t0cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sIunj2+s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u15si13713439pfi.368.2022.01.24.14.06.26; Mon, 24 Jan 2022 14:06:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sIunj2+s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1575551AbiAXVv4 (ORCPT + 99 others); Mon, 24 Jan 2022 16:51:56 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37814 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377371AbiAXVSj (ORCPT ); Mon, 24 Jan 2022 16:18:39 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 32C92B812A7; Mon, 24 Jan 2022 21:18:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57A72C340E5; Mon, 24 Jan 2022 21:18:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059115; bh=zW8E6nDHYA+IOGgYE859eoZ7bTAfChWLdJJ/+NaK2gA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sIunj2+sdZxA66iYdpBgZ3Tz5WmqwY5TRk0Ka5d38w34UvrVKSHkOm6EQvf2T21HR v3FzIEEhYsDdi9tgmHrlPhZf78gTnFcQ95HdGEgrjkBkBDEWa6vyNCn8/Pdeh7W4T0 7GQvHAii1+jziBMKTRhsnmjxI/KqwHKsBI+ue3o8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 0508/1039] powerpc/64s: Use EMIT_WARN_ENTRY for SRR debug warnings Date: Mon, 24 Jan 2022 19:38:17 +0100 Message-Id: <20220124184142.359193641@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Ellerman [ Upstream commit fd1eaaaaa6864b5fb8f99880fcefb49760b8fe4e ] When CONFIG_PPC_RFI_SRR_DEBUG=y we check the SRR values before returning from interrupts. This is done in asm using EMIT_BUG_ENTRY, and passing BUGFLAG_WARNING. However that fails to create an exception table entry for the warning, and so do_program_check() fails the exception table search and proceeds to call _exception(), resulting in an oops like: Oops: Exception in kernel mode, sig: 5 [#1] LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries Modules linked in: CPU: 2 PID: 1204 Comm: sigreturn_unali Tainted: P 5.16.0-rc2-00194-g91ca3d4f77c5 #12 NIP: c00000000000c5b0 LR: 0000000000000000 CTR: 0000000000000000 ... NIP [c00000000000c5b0] system_call_common+0x150/0x268 LR [0000000000000000] 0x0 Call Trace: [c00000000db73e10] [c00000000000c558] system_call_common+0xf8/0x268 (unreliable) ... Instruction dump: 7cc803a6 888d0931 2c240000 4082001c 38800000 988d0931 e8810170 e8a10178 7c9a03a6 7cbb03a6 7d7a02a6 e9810170 <7f0b6088> 7d7b02a6 e9810178 7f0b6088 We should instead use EMIT_WARN_ENTRY, which creates an exception table entry for the warning, allowing the warning to be correctly recognised, and the code to resume after printing the warning. Note however that because this warning is buried deep in the interrupt return path, we are not able to recover from it (due to MSR_RI being clear), so we still end up in die() with an unrecoverable exception. Fixes: 59dc5bfca0cb ("powerpc/64s: avoid reloading (H)SRR registers if they are still valid") Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20211221135101.2085547-2-mpe@ellerman.id.au Signed-off-by: Sasha Levin --- arch/powerpc/kernel/interrupt_64.S | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/interrupt_64.S b/arch/powerpc/kernel/interrupt_64.S index 894588b2381e5..4b1ff94e67eb4 100644 --- a/arch/powerpc/kernel/interrupt_64.S +++ b/arch/powerpc/kernel/interrupt_64.S @@ -32,21 +32,21 @@ COMPAT_SYS_CALL_TABLE: ld r12,_NIP(r1) clrrdi r12,r12,2 100: tdne r11,r12 - EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) + EMIT_WARN_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) mfspr r11,SPRN_SRR1 ld r12,_MSR(r1) 100: tdne r11,r12 - EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) + EMIT_WARN_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) .else mfspr r11,SPRN_HSRR0 ld r12,_NIP(r1) clrrdi r12,r12,2 100: tdne r11,r12 - EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) + EMIT_WARN_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) mfspr r11,SPRN_HSRR1 ld r12,_MSR(r1) 100: tdne r11,r12 - EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) + EMIT_WARN_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) .endif #endif .endm -- 2.34.1