From patchwork Mon Nov 4 21:45:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 178474 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp2084836ilf; Mon, 4 Nov 2019 14:13:28 -0800 (PST) X-Google-Smtp-Source: APXvYqxjbU6M8d8ShrrrnSgIxQBQMdcZd/bpK0CZ5bcpP8JKlygf3PTQsfir2SeN8rlrNQRrfM7i X-Received: by 2002:a05:6402:1299:: with SMTP id w25mr23851049edv.10.1572905608768; Mon, 04 Nov 2019 14:13:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572905608; cv=none; d=google.com; s=arc-20160816; b=pxTKRZe6yHRmsPsC9MOZrtcWtMWwkA8QIA6cQgI54A9KlSGyhPFovDVk6zXGESnDdw ZPqarddMyD+XpjBGOC8JOaj+Npw1KOlaZpZjmvmsRDQ8RE06iaSdUsId/gdNWkvt95Dw yI+tkDUEr0oVssgaxmCe9hg/M60LahODCp+jcxeR+XcZ9MjSQtPj87gB97GAVRd9RQ9W 2KWvADy5lceJU3AOSDUdYOfAErv8Zlt2QFmAlb6A5EC35VY7zV1rzrg39CEqLPc9mDT3 /krEgqbTXIqurwdRAShy9WVbJPYCse6y1bYWL59cZrJgpHpkjeIhdaO47/IB+Uy1020I foDA== 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=qmCCKBeq+Sf9s010Fw3rHkLzuoNCrvwRy+71gg6U98I=; b=gVIuI1RtuDe1ppDTFl/Vd+sJn7Oz1lnzXp/Jcy9M7KoBN1ewU6vWP8DrSFY1jypooC TBaWBhRSjxXM8QC1pp/L8T5nz9BQjImJYgDLBWg5hBEFdK5VYvQnMYCAva9hrs5Z3+Ne sdkzDq7b9EoiginucUfImQ32JjnRt/VO2FMlOz6UU9F2BumIAe5/glyEePT76xhlFUn6 KArvo1QT3PLaPY4MZ/SD5u3dpS+WmE/KDRWx0WfRQJlYzSWFRTl5FgeqnPGPK88M/iWt bdF68PnqZgOPJrW+3HqjYlq591E8uan7A3yGh41qt79ZqpFoGUAhWILZGAJWZk10bsAF M0ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=T3Xs3v+k; 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 r29si10132393edb.156.2019.11.04.14.13.28; Mon, 04 Nov 2019 14:13:28 -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=T3Xs3v+k; 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 S2389630AbfKDWJu (ORCPT + 26 others); Mon, 4 Nov 2019 17:09:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:42948 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390464AbfKDWJr (ORCPT ); Mon, 4 Nov 2019 17:09:47 -0500 Received: from localhost (6.204-14-84.ripe.coltfrance.com [84.14.204.6]) (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 26105205C9; Mon, 4 Nov 2019 22:09:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572905386; bh=lQJCxjQE5u8YIzXEATjD4sjbt1UHBwao+yZ85ZGUxlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T3Xs3v+kGv6FcJ/1GsmD01MRkXq4TvPHa+5Famp0ckNv6p9WMzhgdtql6n3NyjI3b mgfp1av97IfRIyrpU6WvcpG4NPHptjDbz0q9iHt6/I1YUIzI3LOdTUNSPwOGSHkocg /3aZstF/ygcMaN7yXhs2geQ1BZvmP9FrZZcvcTo8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Will Deacon , Catalin Marinas Subject: [PATCH 5.3 127/163] arm64: Ensure VM_WRITE|VM_SHARED ptes are clean by default Date: Mon, 4 Nov 2019 22:45:17 +0100 Message-Id: <20191104212149.465507089@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191104212140.046021995@linuxfoundation.org> References: <20191104212140.046021995@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Catalin Marinas commit aa57157be69fb599bd4c38a4b75c5aad74a60ec0 upstream. Shared and writable mappings (__S.1.) should be clean (!dirty) initially and made dirty on a subsequent write either through the hardware DBM (dirty bit management) mechanism or through a write page fault. A clean pte for the arm64 kernel is one that has PTE_RDONLY set and PTE_DIRTY clear. The PAGE_SHARED{,_EXEC} attributes have PTE_WRITE set (PTE_DBM) and PTE_DIRTY clear. Prior to commit 73e86cb03cf2 ("arm64: Move PTE_RDONLY bit handling out of set_pte_at()"), it was the responsibility of set_pte_at() to set the PTE_RDONLY bit and mark the pte clean if the software PTE_DIRTY bit was not set. However, the above commit removed the pte_sw_dirty() check and the subsequent setting of PTE_RDONLY in set_pte_at() while leaving the PAGE_SHARED{,_EXEC} definitions unchanged. The result is that shared+writable mappings are now dirty by default Fix the above by explicitly setting PTE_RDONLY in PAGE_SHARED{,_EXEC}. In addition, remove the superfluous PTE_DIRTY bit from the kernel PROT_* attributes. Fixes: 73e86cb03cf2 ("arm64: Move PTE_RDONLY bit handling out of set_pte_at()") Cc: # 4.14.x- Cc: Will Deacon Signed-off-by: Catalin Marinas Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman --- arch/arm64/include/asm/pgtable-prot.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) --- a/arch/arm64/include/asm/pgtable-prot.h +++ b/arch/arm64/include/asm/pgtable-prot.h @@ -32,11 +32,11 @@ #define PROT_DEFAULT (_PROT_DEFAULT | PTE_MAYBE_NG) #define PROT_SECT_DEFAULT (_PROT_SECT_DEFAULT | PMD_MAYBE_NG) -#define PROT_DEVICE_nGnRnE (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_ATTRINDX(MT_DEVICE_nGnRnE)) -#define PROT_DEVICE_nGnRE (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_ATTRINDX(MT_DEVICE_nGnRE)) -#define PROT_NORMAL_NC (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL_NC)) -#define PROT_NORMAL_WT (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL_WT)) -#define PROT_NORMAL (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL)) +#define PROT_DEVICE_nGnRnE (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_WRITE | PTE_ATTRINDX(MT_DEVICE_nGnRnE)) +#define PROT_DEVICE_nGnRE (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_WRITE | PTE_ATTRINDX(MT_DEVICE_nGnRE)) +#define PROT_NORMAL_NC (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL_NC)) +#define PROT_NORMAL_WT (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL_WT)) +#define PROT_NORMAL (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL)) #define PROT_SECT_DEVICE_nGnRE (PROT_SECT_DEFAULT | PMD_SECT_PXN | PMD_SECT_UXN | PMD_ATTRINDX(MT_DEVICE_nGnRE)) #define PROT_SECT_NORMAL (PROT_SECT_DEFAULT | PMD_SECT_PXN | PMD_SECT_UXN | PMD_ATTRINDX(MT_NORMAL)) @@ -80,8 +80,9 @@ #define PAGE_S2_DEVICE __pgprot(_PROT_DEFAULT | PAGE_S2_MEMATTR(DEVICE_nGnRE) | PTE_S2_RDONLY | PAGE_S2_XN) #define PAGE_NONE __pgprot(((_PAGE_DEFAULT) & ~PTE_VALID) | PTE_PROT_NONE | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_UXN) -#define PAGE_SHARED __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_WRITE) -#define PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_WRITE) +/* shared+writable pages are clean by default, hence PTE_RDONLY|PTE_WRITE */ +#define PAGE_SHARED __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_UXN | PTE_WRITE) +#define PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_WRITE) #define PAGE_READONLY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_UXN) #define PAGE_READONLY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN) #define PAGE_EXECONLY __pgprot(_PAGE_DEFAULT | PTE_RDONLY | PTE_NG | PTE_PXN) From patchwork Mon Nov 4 21:45:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 178472 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp2080612ilf; Mon, 4 Nov 2019 14:09:55 -0800 (PST) X-Google-Smtp-Source: APXvYqwxLhvIzefJ/r8lIgZDktWaE5YJK8rjXpl0i4ytT0MkAP11UPsQQiP8uf8XLoBNPBZ0igvK X-Received: by 2002:a17:906:9248:: with SMTP id c8mr9735899ejx.47.1572905395029; Mon, 04 Nov 2019 14:09:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572905395; cv=none; d=google.com; s=arc-20160816; b=uob9qPMaKXa8oacL8M+hjPdZNBgv5IcwFB2ocDlwWuxiPbolWa6ax9+PuGeqvxlogI vrkIpHOXd9y18BN4hz8EhasI2BsblRGcewapVWYd82YuQqdYmobH9Iu1q8TyPLy7g4kH O0pLCJrEc+sKOLVkrimcH9dD1rGNExxYmQeP/bst/4ot8gSVeATcNScoWH7YXICBSEKz bQCNjzRmm3fEEbizdk222WaXviPiy7NyEl50RO9GkdqXvqgCxVveXUcykCyG6C9ygBO0 4JwBnTkjk/Ojo2uHwOz3SA+J2oF8iFCTNhR7AtNQ7R5cFhkHpAEtor7HmEyfeJrvitAh +RlA== 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=+NDf4MbDw7052NzCLs6zf5t5gBbfhIeZ6kw6bNXNZVM=; b=X0WmPRpZOBpvCq8CZzXpTaAngm6AnQDoP/7ctYO4nsptIlys1wWP4bHMzEVQ173vxW 2knV1cBQpaQ7DcD+2p/cTlNLCscp7iH1BJr3l42EA9J/Lyc9d+ESKK2OeAcdOJoWJO5p SwD6yrIpwEuTbMUQxEiSbQyv6J247RKoY+rwCLjxW2ANJQFcOyfG+I+4F/hjzSEUPms/ zsStyqHXlbEIp01lqXHFY9C7DQga8rh732Z9sUspy6C+DWeO7Zh8plK2wRkKsiILfXKG XjjiZxs5wYwYidTbU33+7DZUIRLIw85+idF+cZhdhvUZ+V7llxR/NA+CPpwAWaa3uGlI l+mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Qv+GaBUa; 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 31si8560407edq.208.2019.11.04.14.09.54; Mon, 04 Nov 2019 14:09:55 -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=Qv+GaBUa; 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 S2390473AbfKDWJw (ORCPT + 26 others); Mon, 4 Nov 2019 17:09:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:43002 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390101AbfKDWJu (ORCPT ); Mon, 4 Nov 2019 17:09:50 -0500 Received: from localhost (6.204-14-84.ripe.coltfrance.com [84.14.204.6]) (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 1E0E6214E0; Mon, 4 Nov 2019 22:09:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572905389; bh=VNfeyMzplEuxQPRW8tw5bkZPMbiA4pSi0LQH7t0iQ2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qv+GaBUa4yesYKfIOyh8X++HSdw252n6v86firMPfR9xckb53It981sKXqvJjNf/A vSNAyjg2DOan1uH2Z8ocbQfJQnzNQk70T8h8qWCA3cVYVbiAMglLctEe2wc9TEQu3w VshYHvis5UAKwokr+HSxstcN04tL3edhLQrS8VDQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , Will Deacon , Bjorn Andersson Subject: [PATCH 5.3 128/163] arm64: cpufeature: Enable Qualcomm Falkor/Kryo errata 1003 Date: Mon, 4 Nov 2019 22:45:18 +0100 Message-Id: <20191104212149.553069085@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191104212140.046021995@linuxfoundation.org> References: <20191104212140.046021995@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bjorn Andersson commit d4af3c4b81f4cd5662baa6f1492f998d89783318 upstream. With the introduction of 'cce360b54ce6 ("arm64: capabilities: Filter the entries based on a given mask")' the Qualcomm Falkor/Kryo errata 1003 is no long applied. The result of not applying errata 1003 is that MSM8996 runs into various RCU stalls and fails to boot most of the times. Give 1003 a "type" to ensure they are not filtered out in update_cpu_capabilities(). Fixes: cce360b54ce6 ("arm64: capabilities: Filter the entries based on a given mask") Cc: stable@vger.kernel.org Reported-by: Mark Brown Suggested-by: Will Deacon Signed-off-by: Bjorn Andersson Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/cpu_errata.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -816,6 +816,7 @@ const struct arm64_cpu_capabilities arm6 { .desc = "Qualcomm Technologies Falkor/Kryo erratum 1003", .capability = ARM64_WORKAROUND_QCOM_FALKOR_E1003, + .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, .matches = cpucap_multi_entry_cap_matches, .match_list = qcom_erratum_1003_list, },