Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp912154pxj; Fri, 28 May 2021 20:34:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjSHJ/qDdZ+2fEgAKCz84P3g45RZFa2si9RtjWpEq5s8dgHU1WgbitlWjIo2gvn8Jjdn9F X-Received: by 2002:a05:6e02:1be8:: with SMTP id y8mr9574900ilv.52.1622259290453; Fri, 28 May 2021 20:34:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622259290; cv=none; d=google.com; s=arc-20160816; b=NHzpSBhKb6LuirXcrXT2R2s1DlB+I8plXkGju9O/nu6Nedw5pE3j0nsX8P8LQbWE8B e2AAQaDq0WV7aVduQVzQQ/uNQ47LZ45kMLvcU4p/G/GXfkPi/fATXG0j6i/yu1q3gM4l Kvmbate31xqawc5WyU0fyM8rWr37v6FoaTa8ZkfB54Ckh7T80+QWZbQGTlFTJDWtGZHg Sy+JYMrkIqDXw67UJ3moytEcqtpTQT2O3r7D3nF+nkbnS8UwA3JIf4KWOwYURFheVNdF faj6VGwYfC5n7sK60gyJvWG8SEWCWpPMkaQrBd0EoWiuo1myVMnp13LEZv5fyGjO50NJ Y7CA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=MG3QcT0nYt3kqVoqRK2nUz+dIqibubI7HWl3jJQf0a4=; b=IT53M/SHdLmowuCLEeY9tUJu9al5QRK8sPHZLkh8OO+Z2Xnk1PZC2sf0FDkqcjsNel JhO/2LzeYgAAac7zO1n6lmMfXnfExekncTvfeFgvgSxKgTcxHTItASRZNNrN5K2ULGPT H+W872QVeKpWP8qSo1jlDpABZwrCn+CtSzr1PDl41nGLvqFQvOqXgnnELw7R4n4ltZKG sqfEZs4umH3xHu84QkwS+dtVEbFwat8ZxHelQD2nIQxCqYNxLMyLTe6LM4se1QTDf9sm Qy0Sdz/UsfmRRharTeGt7DjpCbKlKiKoHtNTXn1R5hVaXPLd3cBQK7tICOklg6M9/ocl fhNA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b26si7809279jap.85.2021.05.28.20.34.36; Fri, 28 May 2021 20:34:50 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229636AbhE2DeA (ORCPT + 99 others); Fri, 28 May 2021 23:34:00 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:2458 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229549AbhE2Dd6 (ORCPT ); Fri, 28 May 2021 23:33:58 -0400 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4FsRqq04cNz67PB; Sat, 29 May 2021 11:29:27 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Sat, 29 May 2021 11:32:21 +0800 Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Sat, 29 May 2021 11:32:20 +0800 From: Kefeng Wang To: Russell King , CC: Catalin Marinas , , Andrew Morton , Jungseung Lee , Kefeng Wang Subject: [PATCH 2/2] ARM: mm: Fix PXN process when ARM_LPAE enabled Date: Sat, 29 May 2021 11:41:38 +0800 Message-ID: <20210529034138.83384-3-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210529034138.83384-1-wangkefeng.wang@huawei.com> References: <20210529034138.83384-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If we support PXN feature, should panic when user code execution with privilege mode, but it is not true when LAPE enabled, let's fix it by adding the check in do_page_fault(). Fixes: 1d4d37159d01 ("ARM: 8235/1: Support for the PXN CPU feature on ARMv7") Signed-off-by: Kefeng Wang --- arch/arm/mm/fault.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index 81cf3e6e2a3d..a6ada914cdf5 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c @@ -241,8 +241,13 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) vm_flags = VM_WRITE; } - if (fsr & FSR_LNX_PF) + if (fsr & FSR_LNX_PF) { vm_flags = VM_EXEC; +#ifdef CONFIG_ARM_LPAE + if (addr < TASK_SIZE && !user_mode(regs)) + __do_kernel_fault(mm, addr, fsr, regs); +#endif + } perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr); -- 2.26.2