Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5751546rwb; Tue, 22 Nov 2022 04:35:48 -0800 (PST) X-Google-Smtp-Source: AA0mqf58MZduZJh6GoKbzhhY1dN4/ySdaRfr5SMhW+ANw15HJ+rVyD7F06KX3sIcExcDRpmHI5xT X-Received: by 2002:a17:902:e84d:b0:183:8006:3338 with SMTP id t13-20020a170902e84d00b0018380063338mr8099910plg.125.1669120547974; Tue, 22 Nov 2022 04:35:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669120547; cv=none; d=google.com; s=arc-20160816; b=lZ+5D+NycHagPwf9nYWwFWvMBeHloWWi+fdV5c0cpnX5z/Zulus06f/eIC/tUc2N7Q n7+2Bd70XjpsFkm3LqfToKubFsj7F+xq6uZk88HX039u3jpeq7wzXA+q8PuGdDZtpko0 iBxjYPN24H28ZvVRvk/yWx53ER+oAGyhjMZ+TcEtbRNUMhhU59YbsQL7ny2LUAZCKwRt iMo2jmXpcyRqTp320SJHFZeZi+kNEqJqlMjrq8OnsARUcAYZ2Ndy01iooJApb9QfqnAA CTBtmqy6zY+H3xKe2N4Q42iiDzbSb8xWwypez+bxil5ADlgLUthuylP5qSzOJl+Qj9dL ryhw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h3-20020a170902748300b001890edb98bfsi8537677pll.1.2022.11.22.04.35.34; Tue, 22 Nov 2022 04:35:47 -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 + 90 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 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII 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 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 -- 2.25.1