Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1183876ybf; Thu, 27 Feb 2020 06:28:18 -0800 (PST) X-Google-Smtp-Source: APXvYqw0ZeBDE7aakkKfcvz4WB9oA6c2LpKtD/tmpqXVN3LrqJSFDNCDgCDxPYK0nmZn+qnvHaFY X-Received: by 2002:a05:6808:10b:: with SMTP id b11mr3594834oie.110.1582813698094; Thu, 27 Feb 2020 06:28:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582813698; cv=none; d=google.com; s=arc-20160816; b=C0jXQZQL6KZC+3INHWa9zVLkVtyEcB6whc6kH7Qt85xJh+PKnQhwnJXHA6BUVnCrzU OlIwkimnCcG6rvzD8fUJ8o/PzovoFNCTgeVLWKq3aTRSjswUcn8QWQ1bjsqMCk5kbmz+ 51/rY84Y3v2qVl+fqjpC/xUIVLkxTf1lqH5ccDFlylFZFHA8TG0W8cpc4HbmMDD0YIRC RUJF6GeGqshprYvBMoFW+Lk5gazR5x0Elq8h/5s+z7qwJm/r1YbEahrCqOmFglHKWg/s ERtct2rlv/waFLotuCwAOcKEuBhIBNKued3IYXK8Tw0LFGxR4tv6Ev+H8UqrMucIZ43S wFTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=y2qgeM5AxKz0RoKsEFZLs5RC5qCjwG95mz8Ok8zd2e4=; b=YJO1xbRBD6ebv2nLyx3HrbzxUv0XnLhPph/Tw2EKKm/7/p9Nteunp72Ie8P8GO57Zp wBpoiRsPaR+K6C9Nvmm+CkrX6kBUYWoM2zVspGARUc8z2NNKbuAalEW6C7pBmoC8ZY3Y mrNw9DA8FA22xHxe2A/OASh2zjKvTSIDhnOdlyHGb3kDK6yAhlQK18xKAcn5MSEtxSzt 8AwZ0Si7ZUgn13ul1z+klROY64wyFZSnkpDeFV56xlR47295t3G5BXfja1wmVZxtILHa R8ORb3VCs5YOQD2v1ZKoSQIBEJDn2wQMoy8Drt1mMDcbptri+62Lq0zR3MTztERb0vDP QeIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FsNmGl7n; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u12si1396886oiv.13.2020.02.27.06.28.06; Thu, 27 Feb 2020 06:28:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FsNmGl7n; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388270AbgB0O1z (ORCPT + 99 others); Thu, 27 Feb 2020 09:27:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:46240 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733157AbgB0OIZ (ORCPT ); Thu, 27 Feb 2020 09:08:25 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C86C620801; Thu, 27 Feb 2020 14:08:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582812505; bh=M8nOWdSwyIN9dVnGbyJzR9EvWHZSSK8dqPkYJyjx+JA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FsNmGl7nvkWd/Wzs/U9Sv5tFyX5NEF7Oez+U4fEPwyuwIAQgqf7YPeENxW4tdy+uE RA6RvF2/SiI+U/FgFjjul+/vUkFBm0vWDm3MkVSxIGIXjMOCyevFj9JD2E90/dOGtW sRt2xWrqTJeE0RfPsQY+2HpxoV3PhTHeIugzjUYI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Leonardo Bras , Michael Ellerman Subject: [PATCH 5.4 043/135] powerpc/8xx: Fix clearing of bits 20-23 in ITLB miss Date: Thu, 27 Feb 2020 14:36:23 +0100 Message-Id: <20200227132235.424099721@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200227132228.710492098@linuxfoundation.org> References: <20200227132228.710492098@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe Leroy commit a4031afb9d10d97f4d0285844abbc0ab04245304 upstream. In ITLB miss handled the line supposed to clear bits 20-23 on the L2 ITLB entry is buggy and does indeed nothing, leading to undefined value which could allow execution when it shouldn't. Properly do the clearing with the relevant instruction. Fixes: 74fabcadfd43 ("powerpc/8xx: don't use r12/SPRN_SPRG_SCRATCH2 in TLB Miss handlers") Cc: stable@vger.kernel.org # v5.0+ Signed-off-by: Christophe Leroy Reviewed-by: Leonardo Bras Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/4f70c2778163affce8508a210f65d140e84524b4.1581272050.git.christophe.leroy@c-s.fr Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/head_8xx.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/powerpc/kernel/head_8xx.S +++ b/arch/powerpc/kernel/head_8xx.S @@ -289,7 +289,7 @@ InstructionTLBMiss: * set. All other Linux PTE bits control the behavior * of the MMU. */ - rlwimi r10, r10, 0, 0x0f00 /* Clear bits 20-23 */ + rlwinm r10, r10, 0, ~0x0f00 /* Clear bits 20-23 */ rlwimi r10, r10, 4, 0x0400 /* Copy _PAGE_EXEC into bit 21 */ ori r10, r10, RPN_PATTERN | 0x200 /* Set 22 and 24-27 */ mtspr SPRN_MI_RPN, r10 /* Update TLB entry */