Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp5113919pxb; Mon, 28 Mar 2022 08:08:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHoD6FFTxBqnFSzozGdIczJopmYqvOgs5DurOo5dh47twwQ4gj5XnizkXF55oKlfH73cSH X-Received: by 2002:a17:907:97cc:b0:6da:a8fb:d1db with SMTP id js12-20020a17090797cc00b006daa8fbd1dbmr28266337ejc.267.1648480080658; Mon, 28 Mar 2022 08:08:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648480080; cv=none; d=google.com; s=arc-20160816; b=qLrlPTbcnc6F7+0Zhsb6tYcuyX2QEM6BYtdypf7DWSGxWK01JV9D+K0XI8/wKGbxdi jMgNYKCTq7ROpZlSIK6U3LK5aSzNdC48p9Nl1o3Qyj0yoAU2q5z6u4lpztiqp97obrwr 0MLjBK4MajupS3WzVxdFjxG9+Kda0hJbMtpxXum7/yQGUbIEO6v8ftIEQGYPqyWzRQvt rrTwGJcqqv0Fz0sHAsTPDQJsdEWmM5md89dideTwXmDyVZZAdPV7NcbWq7f+xjz6dde6 HFIRhnxVKujjcDbGxBp2ekYZ7w+ByR8mC/ws7syQO2XOeznmtV93n5Q8I3aV055DkgH1 7vXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=aK3RP6El5AN0oRj3i5WhPsnmLdOPM6ZQ8iQAfKWks7I=; b=M3bG7aeHdmxRPe1oanSy/MT4vRep2dX0BD3lud0EDqMjSmkyqDXhp99OV0X7Own44m H1ODvlFO3DFTdIx0iJ1QLlpQ+ohcErRwl3VzLanDGGT4AJoAUziA/Uco6wZ38Sw+BKUg t+dm3G16t119g5P861lDqquePPnMeo8a6R/cblx/gdPN8ox5SyC4lr+TEv542l1Zoyyb AjymyA0fC9SL87JhWJL/YM1B/k+IlmF/DPRJJZ5vRbLe9zE0FdwbH+4juUKJNDvnYuux 6bLmzRuFPd1ErfayZEbN6Z1CzrWqd9bOqaZHmacLSIbltEefFotiwWNkTeAdXLP9T8Tb 6tkA== 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 g4-20020a1709061c8400b006dfe0324ce2si13527928ejh.327.2022.03.28.08.07.33; Mon, 28 Mar 2022 08:08:00 -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 S233746AbiC1Bfk (ORCPT + 99 others); Sun, 27 Mar 2022 21:35:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229867AbiC1Bfj (ORCPT ); Sun, 27 Mar 2022 21:35:39 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2850220D1 for ; Sun, 27 Mar 2022 18:33:59 -0700 (PDT) Received: from kwepemi500021.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KRZwQ1lDZzcZyg; Mon, 28 Mar 2022 09:33:42 +0800 (CST) Received: from kwepemm600017.china.huawei.com (7.193.23.234) by kwepemi500021.china.huawei.com (7.221.188.245) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 28 Mar 2022 09:33:56 +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.2308.21; Mon, 28 Mar 2022 09:33:55 +0800 From: Tong Tiangen To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , , "H. Peter Anvin" , Pasha Tatashin , Andrew Morton , Catalin Marinas , Will Deacon , Paul Walmsley , Palmer Dabbelt , Albert Ou CC: , , , , Tong Tiangen Subject: [PATCH -next v3 0/4]mm: page_table_check: add support on arm64 and riscv Date: Mon, 28 Mar 2022 01:52:38 +0000 Message-ID: <20220328015242.1136836-1-tongtiangen@huawei.com> X-Mailer: git-send-email 2.18.0.huawei.25 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600017.china.huawei.com (7.193.23.234) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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/ v2 -> v3: 2. 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 (2): 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, 178 insertions(+), 46 deletions(-) -- 2.18.0.huawei.25