Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp972061pxb; Thu, 21 Apr 2022 14:57:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySrmVknr8mp5iCIB/Gl1WtR39zIFZ7MjcgV5EnnR604lN2DXHBMwx5dNYpFFBH0wMuDnId X-Received: by 2002:a17:902:d50b:b0:158:fd26:1bac with SMTP id b11-20020a170902d50b00b00158fd261bacmr1488194plg.68.1650578277675; Thu, 21 Apr 2022 14:57:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650578277; cv=none; d=google.com; s=arc-20160816; b=S52oCOT45zeVNDqGsrsXQeKC5h1T3IV8CDkMpaT0jBvuSMovMaEMNXUgK9KX5q6DtN smLbxS85LIWooU1F/kG5LzkQlwi7n5UFgYed7QAKScps1f+lJ2H/aozol59LEzY9N+lZ oY+aRADhS/6uyJAdQMfkeI/pav293XhGnjIvJGxL7/V4STop8czjVVEHzmnkvSrk4ZP/ 4I1NvcT3KkCmheszMM6CCNZzTw3UBXV9DM+g+qh+wDU/wKCONwKaq5rvWRUWy70PXr0b a6i0Z+ywkTC6EQj33YFDCtOA9rByw56c6i7xvWNdRHQ4SxWN8bLTWCQKEnVOlcAZMkak mn9Q== 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=dtXbpjo+vO3o2BJmKYXCih2Ou4st+AOZEP6qNudOYjM=; b=CPu+Jav0VF4EnT4PwpFq/2x3qYcxdCTAx2p+qzS7+4iO2gP4HuXu2R+ZX3l7nSfEMp 8QSWKvh8hPiO4wcQ9/UtKi1s3Etkt+TyCxRYjn+GioOX3v3UyCfKVqvpppiHTCl//BV6 Oc8pvNV1/R8PSs4DNs/G/5dau9rkLIO3aB9Evhqpzi1le45PsduozPgPCDl1fBHqJMOn E+sJv5IbB4HVhzxrONa+fKI5GJUKMPfV7RSbuM2/4X24wVg6SkGk8fB74YeMvRzWErnL LPNHCj+H/xzfADlOx+0Uf2vf2fWPnA83OZQsCb9ghSm32WeBFW11TpeZHK1opt88ueH6 Uhog== 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 p27-20020a631e5b000000b00386123c9f67si6497920pgm.148.2022.04.21.14.57.42; Thu, 21 Apr 2022 14:57:57 -0700 (PDT) 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 S1386356AbiDUIE7 (ORCPT + 99 others); Thu, 21 Apr 2022 04:04:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236251AbiDUIE4 (ORCPT ); Thu, 21 Apr 2022 04:04:56 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E292326F5 for ; Thu, 21 Apr 2022 01:02:06 -0700 (PDT) Received: from kwepemi100006.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KkVPG3y7HzhY36; Thu, 21 Apr 2022 16:01:54 +0800 (CST) Received: from kwepemm600017.china.huawei.com (7.193.23.234) by kwepemi100006.china.huawei.com (7.221.188.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 21 Apr 2022 16:02:03 +0800 Received: from localhost.localdomain (10.175.112.125) by kwepemm600017.china.huawei.com (7.193.23.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 21 Apr 2022 16:02:02 +0800 From: Tong Tiangen To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , , "H. Peter Anvin" , Pasha Tatashin , Anshuman Khandual , Andrew Morton , Catalin Marinas , Will Deacon , Paul Walmsley , Palmer Dabbelt , Albert Ou CC: , , , , Tong Tiangen , Kefeng Wang , Guohanjun Subject: [PATCH -next v5 0/5]mm: page_table_check: add support on arm64 and riscv Date: Thu, 21 Apr 2022 08:20:37 +0000 Message-ID: <20220421082042.1167967-1-tongtiangen@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.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600017.china.huawei.com (7.193.23.234) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,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 Page table check performs extra verifications at the time when new pages become accessible from the userspace by getting their page table entries (PTEs PMDs etc.) added into the table. It is supported on X86[1]. This patchset made some simple changes and make it easier to support new architecture, then we support this feature on ARM64 and RISCV. [1]https://lore.kernel.org/lkml/20211123214814.3756047-1-pasha.tatashin@soleen.com/ v4 -> v5: According to Anshuman's suggestion, using PxD_SIZE instead of PxD_PAGE_SIZE in mm/page_table_check.c and it is checked by Pasha. v3 -> v4: Adapt to next-20220414 v2 -> v3: Modify ptep_clear() in include/linux/pgtable.h, using IS_ENABLED according to the suggestions of Pasha. v1 -> v2: 1. Fix arm64's pte/pmd/pud_user_accessible_page() according to the suggestions of Catalin. 2. Also fix riscv's pte_pmd_pud_user_accessible_page(). Kefeng Wang (2): mm: page_table_check: move pxx_user_accessible_page into x86 arm64: mm: add support for page table check Tong Tiangen (3): mm: page_table_check: using PxD_SIZE instead of PxD_PAGE_SIZE mm: page_table_check: add hooks to public helpers riscv: mm: add support for page table check arch/arm64/Kconfig | 1 + arch/arm64/include/asm/pgtable.h | 65 ++++++++++++++++++++++++--- arch/riscv/Kconfig | 1 + arch/riscv/include/asm/pgtable.h | 77 +++++++++++++++++++++++++++++--- arch/x86/include/asm/pgtable.h | 29 +++++++----- include/linux/pgtable.h | 26 +++++++---- mm/page_table_check.c | 25 ++--------- 7 files changed, 174 insertions(+), 50 deletions(-) -- 2.25.1