From patchwork Fri Sep 27 12:51:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13814268 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3053CDD1A0 for ; Fri, 27 Sep 2024 12:52:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1BF886B00DF; Fri, 27 Sep 2024 08:52:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1738F6B00E2; Fri, 27 Sep 2024 08:52:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DFB496B00E1; Fri, 27 Sep 2024 08:52:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id AA7BA6B00DF for ; Fri, 27 Sep 2024 08:52:14 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 15176160D2A for ; Fri, 27 Sep 2024 12:52:13 +0000 (UTC) X-FDA: 82610506146.02.337E6EB Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf10.hostedemail.com (Postfix) with ESMTP id D592CC0009 for ; Fri, 27 Sep 2024 12:52:08 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=VBh2TWJF; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=OJcKLFOp; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf10.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1727441438; a=rsa-sha256; cv=pass; b=v8fra4rGBqYQE4cNWjnu5nTcHgXM41vTBPLFgARHpACDg44V89FwDTtJzZmA0guxIoidPa y/8tgJevkR+0WABZ3W2BOasIc86h8v1Ln1ihhaX+VxeOUV802VlLXcprJi248LD2lJ8e0c buTBEq8run/CSV+o2xdSlMtcX/R9WTo= ARC-Authentication-Results: i=2; imf10.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=VBh2TWJF; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=OJcKLFOp; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf10.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727441438; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=brc/iiONqZTjOhM8gVgkUDdVfGeGuXK+1Gg2KXtZB1c=; b=PM0usjXow6IuWpgzg1g6dQat/bLzlOC0ILH4Pwrv/BxBvnlRZ82WBPaX0MQSPV6+3bu+mW 2fqAyQMUFe4kxKBH2X+sc325wIBsEd1vZddPPmHKYVQ50Jml1AD60IAestKvsNTlZ/iJf8 wUihPSIhLWlll/moRZ26Bt1OKdvEE14= Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48R5hJZC027287; Fri, 27 Sep 2024 12:51:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:content-transfer-encoding :content-type:mime-version; s=corp-2023-11-20; bh=brc/iiONqZTjOh M8gVgkUDdVfGeGuXK+1Gg2KXtZB1c=; b=VBh2TWJFEEDFjv3YBPxYtyKvYN7LLC RXHrgb1+LuY+2TfmvGMvmgJQMTFnNkay6LvrrJwNUrDGgystbcT9m52yfOjsdtDq URVnD6OVTzfxGRo9cZ5z5RPwHyns46udqk9WXxXhzfjzRHfG/6j7ToSs/rw2qzz2 pKGI2CfzTOJPwsn9eT2H2a0ogUN6e0yaTsMu8sWABP/P1dgG494II692BtQlIpf5 5n8gWX4p4uexlMqLOKV8FTreupIF7LQPwnFHCAFyPTGDIe6dV/BqbWtdcd7FyYGn Lp6dLjYGNADLh9Eix/Df2Ls091ge9nAVhuBXcJ0edWh/8bHev40Y62SA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 41smx3d4gu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 27 Sep 2024 12:51:31 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 48RC1vvi026092; Fri, 27 Sep 2024 12:51:30 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2170.outbound.protection.outlook.com [104.47.57.170]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 41smkdeq08-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 27 Sep 2024 12:51:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Wbsq8seUyiqH4FNayr25r5P3Bht0bJCJXHrzBjgsr8U71bT5Ww5cWXLFwMcClww3NU/3RtMCccXD+S4VmeWO8RmJ/vpMXqm2FCAHB2Jargltwt7gACjekaQM1YziFSwurzavUR/xRTP1KTqHgOg4qYAW4tFAGmq14nz9yPtnm9BJt3qadELvGeTd+JOV2lMRpBaZIzZAtB/a8oPJAuJOsnnUKG9ezq1mMQ0A9z9yS82HKBOJKlnnsLL1qF72mEhqvNj3N8IM3vt+fDKjZBq3yp6LRwb/wOwGPImbbXtBOa4CVhGJafeHD4L8JnhsFF0viYJAzvYtMsI76AtWlt2eIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=brc/iiONqZTjOhM8gVgkUDdVfGeGuXK+1Gg2KXtZB1c=; b=HavmYuZDkAll7SVPbapwHw0YXiTVLbVx26M2D2vZeViQ8foCJ63J0zc3+MgVkoNTGDustGNeVpjjJmdrsiaNG/SiwkO1M4HCZ2sbOSxeCdF3Ti09z8BN493wsdAyJ7HnVv/CIXxge6qHLy1utBT515PwaEE3h9+PW1EFl7JmZO6uk87n3kv6mEmQb/ibJE4JNBKPSWo5q8YHAIt50sCzOl/V0ThRqlQ2KfHChKyYVMNs9RXB860ob6GWjtNMRjJWBzCG/8Yd7/Zh7m5+QGaXg7BxwH11bdlCnXNCNz4OV7U3dklq4uJJ3KcqXK7WyDYLhwx97Vt0Bb50x2L3gajAbg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=brc/iiONqZTjOhM8gVgkUDdVfGeGuXK+1Gg2KXtZB1c=; b=OJcKLFOpInmLjjwYVAJeQYFmet0ThGXWqEU1jA6qgHgbuzqXU0iJ7fHqTUfr+8SALSCwn0QpsRADWZDnrs7peg0pDyRXWSIOUj+RdIY+XbAqBUE/d+uqR4EwMu4cBMY2NPhfpK2Cmw81Qgfl2sYPHrBiAWW5xJPsw2kpWVZGtVc= Received: from SJ0PR10MB5613.namprd10.prod.outlook.com (2603:10b6:a03:3d0::5) by IA0PR10MB6820.namprd10.prod.outlook.com (2603:10b6:208:437::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.10; Fri, 27 Sep 2024 12:51:26 +0000 Received: from SJ0PR10MB5613.namprd10.prod.outlook.com ([fe80::4239:cf6f:9caa:940e]) by SJ0PR10MB5613.namprd10.prod.outlook.com ([fe80::4239:cf6f:9caa:940e%5]) with mapi id 15.20.8026.009; Fri, 27 Sep 2024 12:51:26 +0000 From: Lorenzo Stoakes To: Andrew Morton Cc: Suren Baghdasaryan , "Liam R . Howlett" , Matthew Wilcox , Vlastimil Babka , "Paul E . McKenney" , Jann Horn , David Hildenbrand , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Muchun Song , Richard Henderson , Ivan Kokshaysky , Matt Turner , Thomas Bogendoerfer , "James E . J . Bottomley" , Helge Deller , Chris Zankel , Max Filippov , Arnd Bergmann , linux-alpha@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-arch@vger.kernel.org, Shuah Khan , Christian Brauner , linux-kselftest@vger.kernel.org, Sidhartha Kumar , Vlastimil Babka Subject: [RFC PATCH 0/4] implement lightweight guard pages Date: Fri, 27 Sep 2024 13:51:10 +0100 Message-ID: X-Mailer: git-send-email 2.46.2 X-ClientProxiedBy: LO2P265CA0362.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a3::14) To SJ0PR10MB5613.namprd10.prod.outlook.com (2603:10b6:a03:3d0::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR10MB5613:EE_|IA0PR10MB6820:EE_ X-MS-Office365-Filtering-Correlation-Id: 9a45d72c-12bf-46aa-fee9-08dcdef3191b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: eDDE2nio0Ed4AeBK4kYVmickYhvOFsaNbVy2g/WdEOsH9bLSpgryVZNyUZJDyaBQjMw+7BzAhadmSYvSE90tan1JGhgBgVJ2Y9+jnmY5uLIH+FciVJYA/4qxnzebckAAqNB1wAA4XtTaTwxbChe/RUhJPqGphSIZH6p3S4cfcEw+js27tPlO/L9YHAfKwHnT/tqQEJWki6PeA9ylcs6R6Zzav9WVTYjD+bdSRqo3rd1Ti73wIKg1++N5esOp5tRfyXw0uBCI3k9fUS9HkXgHJQ7MKi+HrqIfYqWOnTi5zDU7F+Cxyocu3MvZs9NSMgzM9rI2zoUe0OT2BxUjaFuJGdkHNMzKfoNMyC/z9AsWjAUG2y7N6zK7wXRfoOwtYQ6A6/TNbqqErLB3fQwg4LW6xmqON3ldC818/r/M1959gZNrAOjrsPk+nk55FyrfhziGO6jTGMr+KZGao/KJtEz2bGEzqfAjYmUpA+CH53nM+DsSjf6DGiZbAoD8YT5sPEFE/VjCALyKqJDMpvGQW5cJB1f5/WWmjAKAG9KiWAO20VtUHp85AZ0EMH/xy2HkasOUqslGMk/HKNrAFId/eCRrK3x3u9XN/2DBpxnMkIeRHR338EWfEavlS0tHIV5UvSgGjmv15c9lrOxm1tPq/E3AHHGBhnYNyPTGyQ9V6wnPbFf3Sn+9YTR37yw4GR9cVo7pvxMe8F7yp71F7Gw0gqAWQS3sdJbWPh7OurcmCpmIpYPJn5C93jNWF7ZZbpA3mDVhnbJ+hGquN5NC9iDh2tgjdH+fNcBt5nkiHMS/ximbR2JhDlX47NL9J1KVKawJGC5rJ2ZQDLM+37umWYx+Oc0xehi35RS2+zdJtFFTrY5xQ/b6dJwucYhCAPqWjVSNbJ6eHU5RJzfIxZWQMgCayCKW3lbHWzDwJ0ncbNdVDUY6atnQHqcokZWho4bbqzO50f8ea5cYtN110957Q29TE2vjNVvAs+hscErqzzYHbVpid3vI2j9KdJKTAQtHsZdrT+DPKrJIR3N7HrHNAfU6ZawRwzF8b+YEekaJYOiFMjLG4cz8wgJHaJclCqB2rspgdrvXnzDexJ60SZf2raziwbNaBQX4dQ5vfVRfiCqvz1KMK6bdmcYaGlyZhlg7mLq1TX9i5YyG2SlMSQEj2tu0Wn/+V7301UwWImNE3QeANIlcjdFz2gg3hdARU3k4obvPnLi/2Sy75SrvqccldZh+faNEU9QQX58H+uWh6RF1N0BqgS+DJqDGjSP3iDeX08ShUtF6fIvEUvnyC1DucE203w92XJQIJOBZ3ZwablBF/dBldgHu06jtJSt17xZ38yUx0LtXyygYbUaUjP8OFviqI+oLbQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR10MB5613.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(376014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oppQ4deq6qcHDJ413K52oHbMUKrD/71D3r7hsJvvcTiD1ilBE6iHJtxpwMhytXW5jApKuV3/DTIPoI+yEGZY97QRef8+Wyx5GZt/CizTs4TKGng/7wY71OCIjYuKiQ8QOLF9ceg5S+QzhnJiJDWEN5j8o2dbuRiT48+/I2qFD9CtLNn0d/7M9DkwHMfPLfusP/zYu9fG3+ppC56UQS4M+51XbWn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Network-Message-Id: 9a45d72c-12bf-46aa-fee9-08dcdef3191b X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5613.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2024 12:51:26.1000 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wDoJKOv6eAE/l+o9vnEj1Xo+aK7EBfYdhgIsL/LSeC0RqtiZXUC7OREadJO0w4ln3SFlt7AWJLvZIyguZiLr+xvHJXvzhUroM23U4gpQkLc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB6820 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-27_06,2024-09-27_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=466 phishscore=0 mlxscore=0 bulkscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2408220000 definitions=main-2409270092 X-Proofpoint-ORIG-GUID: _CX02jqr3iHHD-HTitgiqJqAAYEv9HW4 X-Proofpoint-GUID: _CX02jqr3iHHD-HTitgiqJqAAYEv9HW4 X-Rspamd-Queue-Id: D592CC0009 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: kk7agkhndnpba3pet56cydja5kn3bqju X-HE-Tag: 1727441528-399495 X-HE-Meta: U2FsdGVkX19UBLodZEpEpJoc0sB0sOgcwWBJIUOnAUii1KoknZox/W/kf5mXCBGuFy8iZXfapRKbwW1nlS0vtN8pHgx63W111ZvMmswA2mOxCWKcl+TF7I+TFM1Z7BXJ/b1G5zNvI4hfXdc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PZ0nF8vA90J6i6jcdVLFEJEEhJiTS98+zlhsjx0CcCH9+2/fVetheVqlctgXNcDaxPID4JjFQALBWx+0T3ALRoCHD30vXCGQ5+P882vL0aAcdomKC/FI291Uuvv0NaewIrt2tWIXkczJX5+l+QaxOR7N9mfT6kzcawYFdTIp3HSH5BodT+6VzIReP1u0nbuQ+bCuW17RDPOEr4pewM4Df+2an7wqZ/NS+RXzJ3eQw+RIgNUnRRxF9+6oHB/rInDG0ca0Nk4ESfWjwTBM945UwWJIFIUqOoiFtBd29FfEatlc0BaSVQ9a8CxHSCdoBMfG X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Userland library functions such as allocators and threading implementations often require regions of memory to act as 'guard pages' - mappings which, when accessed, result in a fatal signal being sent to the accessing process. The current means by which these are implemented is via a PROT_NONE mmap() mapping, which provides the required semantics however incur an overhead of a VMA for each such region. With a great many processes and threads, this can rapidly add up and incur a significant memory penalty. It also has the added problem of preventing merges that might otherwise be permitted. This series takes a different approach - an idea suggested by Vlasimil Babka (and before him David Hildenbrand and Jann Horn - perhaps more - the provenance becomes a little tricky to ascertain after this - please forgive any omissions!) - rather than locating the guard pages at the VMA layer, instead placing them in page tables mapping the required ranges. Early testing of the prototype version of this code suggests a 5 times speed up in memory mapping invocations (in conjunction with use of process_madvise()) and a 13% reduction in VMAs on an entirely idle android system and unoptimised code. We expect with optimisation and a loaded system with a larger number of guard pages this could significantly increase, but in any case these numbers are encouraging. This way, rather than having separate VMAs specifying which parts of a range are guard pages, instead we have a VMA spanning the entire range of memory a user is permitted to access and including ranges which are to be 'guarded'. After mapping this, a user can specify which parts of the range should result in a fatal signal when accessed. By restricting the ability to specify guard pages to memory mapped by existing VMAs, we can rely on the mappings being torn down when the mappings are ultimately unmapped and everything works simply as if the memory were not faulted in, from the point of view of the containing VMAs. This mechanism in effect poisons memory ranges similar to hardware memory poisoning, only it is an entirely software-controlled form of poisoning. Any poisoned region of memory is also able to 'unpoisoned', that is, to have its poison markers removed. The mechanism is implemented via madvise() behaviour - MADV_GUARD_POISON which simply poisons ranges - and MADV_GUARD_UNPOISON - which clears this poisoning. Poisoning can be performed across multiple VMAs and any existing mappings will be cleared, that is zapped, before installing the poisoned page table mappings. There is no concept of 'nested' poisoning, multiple attempts to poison a range will, after the first poisoning, have no effect. Importantly, unpoisoning of poisoned ranges has no effect on non-poisoned memory, so a user can safely unpoison a range of memory and clear only poison page table mappings leaving the rest intact. The actual mechanism by which the page table entries are specified makes use of existing logic - PTE markers, which are used for the userfaultfd UFFDIO_POISON mechanism. Unfortunately PTE_MARKER_POISONED is not suited for the guard page mechanism as it results in VM_FAULT_HWPOISON semantics in the fault handler, so we add our own specific PTE_MARKER_GUARD and adapt existing logic to handle it. We also extend the generic page walk mechanism to allow for installation of PTEs (carefully restricted to memory management logic only to prevent unwanted abuse). We ensure that zapping performed by, for instance, MADV_DONTNEED, does not remove guard poison markers, nor does forking (except when VM_WIPEONFORK is specified for a VMA which implies a total removal of memory characteristics). It's important to note that the guard page implementation is emphatically NOT a security feature, so a user can remove the poisoning if they wish. We simply implement it in such a way as to provide the least surprising behaviour. An extensive set of self-tests are provided which ensure behaviour is as expected and additionally self-documents expected behaviour of poisoned ranges. Suggested-by: Vlastimil Babka Suggested-by: Jann Horn Suggested-by: David Hildenbrand Lorenzo Stoakes (4): mm: pagewalk: add the ability to install PTEs mm: add PTE_MARKER_GUARD PTE marker mm: madvise: implement lightweight guard page mechanism selftests/mm: add self tests for guard page feature arch/alpha/include/uapi/asm/mman.h | 3 + arch/mips/include/uapi/asm/mman.h | 3 + arch/parisc/include/uapi/asm/mman.h | 3 + arch/xtensa/include/uapi/asm/mman.h | 3 + include/linux/mm_inline.h | 2 +- include/linux/pagewalk.h | 18 +- include/linux/swapops.h | 26 +- include/uapi/asm-generic/mman-common.h | 3 + mm/hugetlb.c | 3 + mm/internal.h | 6 + mm/madvise.c | 158 +++ mm/memory.c | 18 +- mm/mprotect.c | 3 +- mm/mseal.c | 1 + mm/pagewalk.c | 174 ++-- tools/testing/selftests/mm/.gitignore | 1 + tools/testing/selftests/mm/Makefile | 1 + tools/testing/selftests/mm/guard-pages.c | 1168 ++++++++++++++++++++++ 18 files changed, 1525 insertions(+), 69 deletions(-) create mode 100644 tools/testing/selftests/mm/guard-pages.c --- 2.46.2