Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3603984pxb; Mon, 24 Jan 2022 13:18:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJygmJMjo4njNAoInw/Dl9Rm3Wep114Io5CF47k+O8MrOduZL20zRWZtVzhrTQrwt27Z9gra X-Received: by 2002:a17:902:9a4b:b0:14a:b17e:b2a5 with SMTP id x11-20020a1709029a4b00b0014ab17eb2a5mr16001070plv.105.1643059107116; Mon, 24 Jan 2022 13:18:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643059107; cv=none; d=google.com; s=arc-20160816; b=Hohljcx9ox8fUKfPVUqQQQrmZaE/tFmxvcpEzHLPMIWdMrJD2QKUc4qCuKwulv+7zG lwLohiSYBZqhaYc85pIs+vSmpNwxPeGXQldxG8KVa0YmOlyrEX07uWoq1GDnm6h3uxmL ZRRq5AoL69CoKxYgsm2Ah1dX1+gJ9lRZNZAtM8FsiBUS+/JI0JLjni30+opi3sjH+And I8acAkYysF+KWCG/4JUrMfr5Rb0178ypP2h/GbRqs/RyGpwHO4wgjlVfnt4h7Mq5TTz7 38XVST5S4xsD6cfvTmqWX9DRrDMXvxreHPCqWAks/gzO/AWyBIi5Hltt8H+VKSsYkci+ eyng== 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=X78HQEflpfEUJn8aiQV/zHXW+b4SAV2PMME0n2xf8FU=; b=B4k9tElBwtd2+N5GDVVnujvCcFmcheie1HDk3R1xqCYFNyn5eDm48rOjJoQo9ePXLT co3LF0ZFIbS7OC//xPulRPR2/azM7QD/0YNhg/XLbZf5jABGtgEfkbfbwrj4EEPGQq6N TYj8y2N4Fp/DaAODHZqHj8/Dr+Xhm36wPR+i59KCyiQSgZXPUH3e+H9QMXV9PM3R6UmH 8lziqqBuFyKWujKVZFqLy8DpdraqeRjYG2ISrP7tVdnOilBIMbufhv5k1PVmg61OlVZ5 tuFJgwlGwgoKiL9HYWWS2b2yMREEkbu+6MkgXlsgeb92Smnaf8D9OKlhMsdchBPvxPTl DKzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0iUzWyDN; 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 y62si11200875pgd.801.2022.01.24.13.18.15; Mon, 24 Jan 2022 13:18:27 -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=0iUzWyDN; 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 S1442552AbiAXUys (ORCPT + 99 others); Mon, 24 Jan 2022 15:54:48 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37054 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356404AbiAXUbq (ORCPT ); Mon, 24 Jan 2022 15:31:46 -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 93C13B8122A; Mon, 24 Jan 2022 20:31:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C436BC340E7; Mon, 24 Jan 2022 20:31:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643056303; bh=crMXqvSs9XeCYRWN5QFY6tsNKDUACgMNtu1LADo50Es=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0iUzWyDNlv+Ccik4JL7HB6MoK+EO08jzz8GWwra6A88wwkLtEqdB9Rls2cH4INqQx /lHvHGLLQ9aJVg47z/2YtfSnn9c9Jm2inLEF1zNe+1iQF8D02tal/B1OcNYm8VF9Ke nqvYTF7TqcmfihX8gq39LxTYLqiLuha+YgzF4ZfE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sachin Sant , Michael Ellerman , Sasha Levin Subject: [PATCH 5.15 432/846] powerpc/64s: Mask NIP before checking against SRR0 Date: Mon, 24 Jan 2022 19:39:09 +0100 Message-Id: <20220124184115.892084443@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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 314f6c23dd8d417281eb9e8a516dd98036f2e7b3 ] When CONFIG_PPC_RFI_SRR_DEBUG=y we check that NIP and SRR0 match when returning from interrupts. This can trigger falsely if NIP has either of its two low bits set via sigreturn or ptrace, while SRR0 has its low two bits masked in hardware. As a quick fix make sure to mask the low bits before doing the check. Fixes: 59dc5bfca0cb ("powerpc/64s: avoid reloading (H)SRR registers if they are still valid") Reported-by: Sachin Sant Signed-off-by: Michael Ellerman Tested-by: Sachin Sant Link: https://lore.kernel.org/r/20211221135101.2085547-1-mpe@ellerman.id.au Signed-off-by: Sasha Levin --- arch/powerpc/kernel/interrupt_64.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kernel/interrupt_64.S b/arch/powerpc/kernel/interrupt_64.S index ec950b08a8dcc..894588b2381e5 100644 --- a/arch/powerpc/kernel/interrupt_64.S +++ b/arch/powerpc/kernel/interrupt_64.S @@ -30,6 +30,7 @@ COMPAT_SYS_CALL_TABLE: .ifc \srr,srr mfspr r11,SPRN_SRR0 ld r12,_NIP(r1) + clrrdi r12,r12,2 100: tdne r11,r12 EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) mfspr r11,SPRN_SRR1 @@ -39,6 +40,7 @@ COMPAT_SYS_CALL_TABLE: .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) mfspr r11,SPRN_HSRR1 -- 2.34.1