From patchwork Tue Nov 22 12:31:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Shixin X-Patchwork-Id: 24317 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2155628wrr; Tue, 22 Nov 2022 03:59:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf7bON8Oam1+3eHW2a1Ul5RDbL/JEgLGN1m/yicUyA50asllLVoa/WuVuAMGMXcGhw6T6UDq X-Received: by 2002:aa7:982f:0:b0:562:4b3b:4e75 with SMTP id q15-20020aa7982f000000b005624b3b4e75mr8739539pfl.2.1669118396252; Tue, 22 Nov 2022 03:59:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669118396; cv=none; d=google.com; s=arc-20160816; b=0++63JbP4+IDeZBl+7LbkSGEWWyuEGDPq6fUC96BYdsPGlYOHeLuf6v6uWKmdhLcir 19tJUFJohFgjtpFcLPk99IxxKgmGLAZzsAUzEmYmiK4Gyqicq/2zycGBkDtXFS/Aoeu4 3XMN4NrXgqLfm7s4NbOrFSpaFgCvrMHrrP6mkWU4tS6Tx4sQyBgq7xKOW54/tDl9nB3X dIsxXuOXTm2L5HzJXsWgx1EwI7usz4yq/ul/FTyyb9RFI7jDN4C0jwksj/xGY085b1wy UBgOlu8fSXKEV4hNXwJhFJ2L3a+Yd8HbKWJtD9U9a5ZChbEuIs7wyIga1fbi7NbCI+sv RJ4w== 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 :message-id:date:subject:cc:to:from; bh=CQqId5hHvtswLoQCBngDRZuJ1VaL24B+0YcKXMV+8Pg=; b=fVCojfUp+OHoOOzwW3X7LopXWRFXxfOKbxKrwhx63UWx6A3Cabjl6eWP+/lZ/rRuJ9 FeoB0Zps0qG5hqWsS/dbeBBcTf/2M9e6KCGc7I+HaidQfrxsS6f+3dngJ57mZOTSs1D+ Jb+QwYjTTEUesRG9/r4tK3PEAb6+0hFqTb4IDSE2ElWI2LUbfrOPUWYMzM6gGfwI/7q+ gpMnfGTnjskstWEviHMxlcbJiueY4LnrAs29tHUBwJzAMEmOBDKnnNSyw8mkHcSYchHZ 9+w9d+6cS7sqSNClETGuAeFzpuKn9g3f/9wIdaZwe7jefwmuLZhV5Mejw3FOO86BYZLo +tSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j3-20020a17090276c300b00186be05c702si2896772plt.530.2022.11.22.03.59.38; Tue, 22 Nov 2022 03:59:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232887AbiKVLpb (ORCPT + 99 others); Tue, 22 Nov 2022 06:45:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232836AbiKVLpD (ORCPT ); Tue, 22 Nov 2022 06:45:03 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14CF75916C for ; Tue, 22 Nov 2022 03:44:10 -0800 (PST) Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4NGj4j2yVzzJnm9; Tue, 22 Nov 2022 19:40:53 +0800 (CST) Received: from dggpemm100009.china.huawei.com (7.185.36.113) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 22 Nov 2022 19:44:08 +0800 Received: from huawei.com (10.175.113.32) by dggpemm100009.china.huawei.com (7.185.36.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 22 Nov 2022 19:44:07 +0800 From: Liu Shixin To: Catalin Marinas , Will Deacon , Kefeng Wang CC: , , Liu Shixin Subject: [PATCH] arm64/mm: add pud_user_exec() check in pud_user_accessible_page() Date: Tue, 22 Nov 2022 20:31:37 +0800 Message-ID: <20221122123137.429686-1-liushixin2@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm100009.china.huawei.com (7.185.36.113) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750197491307454306?= X-GMAIL-MSGID: =?utf-8?q?1750197491307454306?= Add check for the executable case in pud_user_accessible_page() too like what we did for pte and pmd. Fixes: 42b2547137f5 ("arm64/mm: enable ARCH_SUPPORTS_PAGE_TABLE_CHECK") Suggested-by: Will Deacon Signed-off-by: Liu Shixin --- arch/arm64/include/asm/pgtable.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 17afb09f386f..f1cfc44ef52f 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -682,7 +682,7 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd) #define pud_leaf(pud) (pud_present(pud) && !pud_table(pud)) #define pud_valid(pud) pte_valid(pud_pte(pud)) #define pud_user(pud) pte_user(pud_pte(pud)) - +#define pud_user_exec(pud) pte_user_exec(pud_pte(pud)) static inline void set_pud(pud_t *pudp, pud_t pud) { @@ -868,7 +868,7 @@ static inline bool pmd_user_accessible_page(pmd_t pmd) static inline bool pud_user_accessible_page(pud_t pud) { - return pud_leaf(pud) && pud_user(pud); + return pud_leaf(pud) && (pud_user(pud) || pud_user_exec(pud)); } #endif