From patchwork Sun Oct 20 16:20:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13843142 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 4B190D3C92D for ; Sun, 20 Oct 2024 16:20:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B4A76B007B; Sun, 20 Oct 2024 12:20:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9643E6B0082; Sun, 20 Oct 2024 12:20:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 78FC76B0083; Sun, 20 Oct 2024 12:20:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 544836B007B for ; Sun, 20 Oct 2024 12:20:52 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id C0BA51211E7 for ; Sun, 20 Oct 2024 16:20:38 +0000 (UTC) X-FDA: 82694493924.22.4DA40B8 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf26.hostedemail.com (Postfix) with ESMTP id 1378A140013 for ; Sun, 20 Oct 2024 16:20:37 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=Qbl1skzW; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=b70TdbEY; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf26.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1729441212; a=rsa-sha256; cv=pass; b=lRA0e5RSt4dcgc7GfCsR50RbqwP73n/UI2C0XMnwDRfyUpKAitTjYqNvhJvvjljofh4NL9 icmgR9DIKIczHH6JT7/eybyYh2L428xF4kCLfjnHuIAQwgfhADtEK8+T7/8vmf/T3F5nqD +qjv1AP4965cd9q5ITdFwQNuBpL6kPQ= ARC-Authentication-Results: i=2; imf26.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=Qbl1skzW; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=b70TdbEY; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf26.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.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=1729441212; 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:in-reply-to:references:references:dkim-signature; bh=H8+OeiOA7LbXlMb4dJ93wFyuZQtE9inPfUq4/oA3sfE=; b=Iz2pKeWijQ9oCoQ8311UCVgAW/vV/QAfo6yihZfL/7h0lppIPBX2nYOib91HLbgrdwbS31 72fP1gJwfpC0nTzp127rAEmlUUeL3rWj1GvOfBJI3bguLCdOviiu2h5y0zLJMaCQpiC1Wm uypSkCPUGwxv/xSAAFDbi0Oo5q0Dsbw= Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49KEeO3W002389; Sun, 20 Oct 2024 16:20:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=H8+OeiOA7LbXlMb4dJ93wFyuZQtE9inPfUq4/oA3sfE=; b= Qbl1skzWIjCs2U2rqn+M/SaB6YfE8SV0vY7REqEyWh5EhLXmAFr84Wxjo8hZPbVp ND7kDFe6Qk8OTWZ8p4hQSR/X0zOUga7Zm6SAj6N+kc3pcR/Vtp74bh3nrk+FxTJy +PvO6l6wg/FbUEdhx5DMpNVnbhbdNDAFCdFcf0YWyk7G7izNw/Ryw+NS0XaNymvw yhIp4/OY4u23e5/mHaC5d0sddjGo5dW+WQdZrecjr0uXE7KUNdX8DXmcFyzsWCcq RqnvL6rc8B3OyGuM/IG+tMzLaJNmMmB8mQjn6MHM2pfzjBTE6AhxBHEsbHUdA4vQ McXU6iq8guBxRd0PGlwGWw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42c55ustxg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Oct 2024 16:20:28 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49KE3Tpg035552; Sun, 20 Oct 2024 16:20:27 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2171.outbound.protection.outlook.com [104.47.56.171]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42c3768fqb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 20 Oct 2024 16:20:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rXdfuzYabm0mIq96brROStUIdEHen6BpysgsPBPdjCtE1SvL/3RMm0AKjmHKCMdfpbID9eqa9gNzP5oguXKLKNMTG9UEdFI2ztS2Ku+aHhOlNIPFiyOTzPn37jB8IM96H//rBdtG6jAz3V7Uv5+MivGvUHZTZI36Cz9xp2DgWCv7WgZB13GCWX4q+5zXmiu0xhiWWsUtBBDrB5xZpR/UwLwYwC0555RsRuaHIbTSmOnMx7G1TyjdpgN+A4RWSKW9vHFw9FiUkbMyQnCwb3XtVXg0Zf1CwXHobp7RKMszFnFM9K9IYNWc+DHqV9fzTgQjVmVSLH5UtNcXo6bv+rEr+Q== 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=H8+OeiOA7LbXlMb4dJ93wFyuZQtE9inPfUq4/oA3sfE=; b=judN2HQzkswrA92dXhajFIyIBcnV/M1A/p90YMyTqYUTkPzingyxJ4VtLVfP2KTLBZOjQj5Zl3nbH7qQ7WTPO97nXVYiSrPMKrU0v3TpwkK0ic7/bxyQNSCV8dEvFa3qJ9Pdzl65ENdP2hWFvzWSfpFwYW+tCoM8LMKlOVL2N9fqJWp48k++fH7767tEHelIehc4VeiA1S49bvrB8vRJLOk8hrgaTpjKR6yWiG0VFbaW6L2L/qBtRIYgBwKoTFUYmTmofrWDJ0tcTqKiA8y+VnQT/93qzcmJFbkOqAQT7+Tj+od/kKv1XHMqlIaB07k2t0+V1zNtVPRIPW1Vnn9u4w== 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=H8+OeiOA7LbXlMb4dJ93wFyuZQtE9inPfUq4/oA3sfE=; b=b70TdbEYV7/Ifu9lQM3+dKj+egjgTeQ+nz4hgM4fSwEHGWZYtQaCwIbVI9B06fxwjsKYJnwrdzlROTFPsff3Z16vmuS1R8FUo+gb7yZ9Yu0ft3wLLdEXRi8OGGhtKuEhAVRstofPbXmi7uLAfEzB7DkxwtUrGkCmTGOOrtFHgDo= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by DS0PR10MB6703.namprd10.prod.outlook.com (2603:10b6:8:139::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.27; Sun, 20 Oct 2024 16:20:20 +0000 Received: from BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9]) by BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9%6]) with mapi id 15.20.8069.024; Sun, 20 Oct 2024 16:20:20 +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 , Jeff Xu , Christoph Hellwig , linux-api@vger.kernel.org, John Hubbard Subject: [PATCH v2 2/5] mm: add PTE_MARKER_GUARD PTE marker Date: Sun, 20 Oct 2024 17:20:02 +0100 Message-ID: <081837b697a98c7fa5832542b20f603d49e0b557.1729440856.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: X-ClientProxiedBy: LO4P265CA0050.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2ac::16) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|DS0PR10MB6703:EE_ X-MS-Office365-Filtering-Correlation-Id: 452254f3-efb4-48c4-b0da-08dcf12317a2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|10070799003|1800799024|7416014|376014|366016; X-Microsoft-Antispam-Message-Info: Is5Az2c4onPppbZN1/q6i4LLoPwhGu59ogzE7DZGh6CwzMvFUxR5A03skOik/ss35mKvtCJAVARxaZrdSczfJhPi38XcrnAuULvFOpnNubT6QkDItjLeUW716Lui4lh3rLeEw3Be+32GS1BLTnXLsqIRvM1cL5X+hU+8nSZSb+wbpHq8Wwap2P8LvCPOMSOQzsLM4cDq2FEWQweS8IcExbfNYCVW8VbqmP5F7M7CM6cXsq0lEqIOF7YxAKWcLOFLG398ZkEq3s07w4//QkZnCNBtWgctRPSpi3WwVfh6FGemyeRlMV/s1pMECfs61toHPqL9ZS5llRNlf7XuK6mvsyD0MCdmwmcz4/O9Im1bWeFE6V+Fq/V/90q2GStw7qzr8YHPWGm/MHUfIGPQnFgJn3v6jyfBptiM3naeXDDqe+YgsYXwQHoAQ+cZp0jfcOuy59KLC4oFgQa1rlOOIsBI4OsL6w9VICWzvtcwWZr9hTEpYGn9lo0amWgOonAeK/9USS+rcfQmMJmG4jPwTKCKtRTJUnANKJ7/Z9JLKSGOz4rhgBmHYVrRCCxtpnMG7XBx1yi+R/QuT6FSRGd3x/LNTeV6thPKuZebUd2ImaAJqjr/yhxTyM0aXp0eHERIYvNLHS1UorL23iqjRykJOIByETiJpsXmbkqz2aRsbfdxFPKfITvCJJtScbH4iIKc3MsMOLVPrL8/Gny4tsSckLyqftYkHXr/oDIL6pUmPOs3h/gkeRX31rZFtWn+vDdpzgMoA4c2gf/Vu8XphP9OOOnGn6FpPwc0Svcfr6dLlVb63PbqIxp7CMwuXu1ZfxVW4noTk+f5x53zw3sjcUMn9OAUrYjdoGIuCE39FKxgYfAml6qA6/6xBfyY9jKfS4qDUZ7KR+kReUZUlTRaS6D/+9zfmlfeVH7qeFKdWpwRBjaYLxGkdu+nuR/a195FAlXH3xTkYc3PAPsQ+Wf6AtqRutYx82aiBjeL8+kyV4dtNiOJgKDu59ueN+3FVwagF7+j18OAVWrFKU4iWB517RusJB4JoPcxAwfyrxM7B2kvz+KRC4EDutUDh7EdzndctcwvIRoNRxFoZkdd0zojQ1orXMBnPSVN+Z5atKlf5TW0ulhONQa/qxUQAzSQkU4BJq77en7Hit12m3o9kQUIiVZ7ZxEGRPJeWwx15NUyuOaBHGqUOPbEYcUArQ46aZmFOhjRimCQ0m05jvzKKFWD0t9bMejjdOGc/NpL1+B2TtmMuy6+zRuTsJ7XXCUQKqSCuddV4Q/Um7yCE7QTx/o5e+epeRkyFj7qUkRJ5BxX0Meuvujsalc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3366.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(10070799003)(1800799024)(7416014)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2+siz7bM8do+NgkQnswhKBhf5ZsGCrBEJnBHJ08K/NqgT7ZJroZ6s6jAcMJRW38UoLib94vYgHkteY5VOUFpFN3HQvag34yENUFzqF7WOQkUT4icF78LP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2AcS3ckGpQGbGJMOnvm2DWePzpicbDHd8a+IMWhb8YKjAQo2e1zJ6VW5ARUOgu5wYyzTdn0s3RwD2hmQ5eyK3jl8QNZukp8Wgx8cPDmEiiBwfJ39JCZlCVdI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 452254f3-efb4-48c4-b0da-08dcf12317a2 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2024 16:20:20.4874 (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: db7Hjelck6q8W+dPWCIEi0SvAayclm1APxneG4okPM6fGM8s1ru75q7Y4NwFHhCTO/9cXG9ijfgK/vyiWyC6d2ZgIlH1ncC1jpZ/sFXaCpk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6703 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-20_14,2024-10-17_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 adultscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410200114 X-Proofpoint-GUID: iX_W0srb_wC0cISVUGMtD1It4TYlLpxT X-Proofpoint-ORIG-GUID: iX_W0srb_wC0cISVUGMtD1It4TYlLpxT X-Rspam-User: X-Stat-Signature: o3kgr4sr18znpkrogmp8hpcji5qqandm X-Rspamd-Queue-Id: 1378A140013 X-Rspamd-Server: rspam02 X-HE-Tag: 1729441237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ZhOl61g3H+O/K7LIKaLoqAxEQughFjEGo8lRXeiNhai05KeDmHMAh83P/QsBt5A/RmBegCCyPzbjk5iB2igyJbybg3SzywkF4h9XJ+cNfPwf7IHFGfI804+l6fmFr/T/3HBvmb3E7t7VOY9dV7IpYkifAxieFBYdbVrcKcQivjQeH+rke227PLZd3+xJvmjY9I2MN+5jLt24KmJXgyHB0ZJ92k92TWxejCReK2I6viSwLsQP9hdbx857p103kwg5os+RFhM4vUhL0tr/J47Hd3zLPsprwILyURv2sAmz/dSQR4YCyvrj4Qg+ks1irGS+Ol12pwsgdYZdmmvqmo64CKq7nNM8inKPEg4hNb5cYZ57Jy3SWFzEMIW6+ULeI5VpM7HtL4NweRlpahxJSS9rUQekKKK4tCKjNwj8xwdFOUSkKYF0JW7d0juzDmLqPxd/5//lqDi0/HFadA7gDjOebFF5ohtuVgNnos8AegGGw== 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: Add a new PTE marker that results in any access causing the accessing process to segfault. This is preferable to PTE_MARKER_POISONED, which results in the same handling as hardware poisoned memory, and is thus undesirable for cases where we simply wish to 'soft' poison a range. This is in preparation for implementing the ability to specify guard pages at the page table level, i.e. ranges that, when accessed, should cause process termination. Additionally, rename zap_drop_file_uffd_wp() to zap_drop_markers() - the function checks the ZAP_FLAG_DROP_MARKER flag so naming it for this single purpose was simply incorrect. We then reuse the same logic to determine whether a zap should clear a guard entry - this should only be performed on teardown and never on MADV_DONTNEED or the like. Signed-off-by: Lorenzo Stoakes Acked-by: Vlastimil Babka --- include/linux/mm_inline.h | 2 +- include/linux/swapops.h | 26 ++++++++++++++++++++++++-- mm/hugetlb.c | 3 +++ mm/memory.c | 18 +++++++++++++++--- 4 files changed, 43 insertions(+), 6 deletions(-) diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h index 355cf46a01a6..1b6a917fffa4 100644 --- a/include/linux/mm_inline.h +++ b/include/linux/mm_inline.h @@ -544,7 +544,7 @@ static inline pte_marker copy_pte_marker( { pte_marker srcm = pte_marker_get(entry); /* Always copy error entries. */ - pte_marker dstm = srcm & PTE_MARKER_POISONED; + pte_marker dstm = srcm & (PTE_MARKER_POISONED | PTE_MARKER_GUARD); /* Only copy PTE markers if UFFD register matches. */ if ((srcm & PTE_MARKER_UFFD_WP) && userfaultfd_wp(dst_vma)) diff --git a/include/linux/swapops.h b/include/linux/swapops.h index cb468e418ea1..4d0606df0791 100644 --- a/include/linux/swapops.h +++ b/include/linux/swapops.h @@ -426,9 +426,15 @@ typedef unsigned long pte_marker; * "Poisoned" here is meant in the very general sense of "future accesses are * invalid", instead of referring very specifically to hardware memory errors. * This marker is meant to represent any of various different causes of this. + * + * Note that, when encountered by the faulting logic, PTEs with this marker will + * result in VM_FAULT_HWPOISON and thus regardless trigger hardware memory error + * logic. */ #define PTE_MARKER_POISONED BIT(1) -#define PTE_MARKER_MASK (BIT(2) - 1) +/* Indicates that, on fault, this PTE will case a SIGSEGV signal to be sent. */ +#define PTE_MARKER_GUARD BIT(2) +#define PTE_MARKER_MASK (BIT(3) - 1) static inline swp_entry_t make_pte_marker_entry(pte_marker marker) { @@ -461,9 +467,25 @@ static inline swp_entry_t make_poisoned_swp_entry(void) } static inline int is_poisoned_swp_entry(swp_entry_t entry) +{ + /* + * We treat guard pages as poisoned too as these have the same semantics + * as poisoned ranges, only with different fault handling. + */ + return is_pte_marker_entry(entry) && + (pte_marker_get(entry) & + (PTE_MARKER_POISONED | PTE_MARKER_GUARD)); +} + +static inline swp_entry_t make_guard_swp_entry(void) +{ + return make_pte_marker_entry(PTE_MARKER_GUARD); +} + +static inline int is_guard_swp_entry(swp_entry_t entry) { return is_pte_marker_entry(entry) && - (pte_marker_get(entry) & PTE_MARKER_POISONED); + (pte_marker_get(entry) & PTE_MARKER_GUARD); } /* diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 906294ac85dc..50e3f6ed73ac 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -6353,6 +6353,9 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, ret = VM_FAULT_HWPOISON_LARGE | VM_FAULT_SET_HINDEX(hstate_index(h)); goto out_mutex; + } else if (marker & PTE_MARKER_GUARD) { + ret = VM_FAULT_SIGSEGV; + goto out_mutex; } } diff --git a/mm/memory.c b/mm/memory.c index 0f614523b9f4..551455cd453f 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1455,7 +1455,7 @@ static inline bool should_zap_folio(struct zap_details *details, return !folio_test_anon(folio); } -static inline bool zap_drop_file_uffd_wp(struct zap_details *details) +static inline bool zap_drop_markers(struct zap_details *details) { if (!details) return false; @@ -1476,7 +1476,7 @@ zap_install_uffd_wp_if_needed(struct vm_area_struct *vma, if (vma_is_anonymous(vma)) return; - if (zap_drop_file_uffd_wp(details)) + if (zap_drop_markers(details)) return; for (;;) { @@ -1671,7 +1671,15 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb, * drop the marker if explicitly requested. */ if (!vma_is_anonymous(vma) && - !zap_drop_file_uffd_wp(details)) + !zap_drop_markers(details)) + continue; + } else if (is_guard_swp_entry(entry)) { + /* + * Ordinary zapping should not remove guard PTE + * markers. Only do so if we should remove PTE markers + * in general. + */ + if (!zap_drop_markers(details)) continue; } else if (is_hwpoison_entry(entry) || is_poisoned_swp_entry(entry)) { @@ -4003,6 +4011,10 @@ static vm_fault_t handle_pte_marker(struct vm_fault *vmf) if (marker & PTE_MARKER_POISONED) return VM_FAULT_HWPOISON; + /* Hitting a guard page is always a fatal condition. */ + if (marker & PTE_MARKER_GUARD) + return VM_FAULT_SIGSEGV; + if (pte_marker_entry_uffd_wp(entry)) return pte_marker_handle_uffd_wp(vmf);