From patchwork Mon Oct 28 14:13:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13853555 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 E3FD2D33989 for ; Mon, 28 Oct 2024 14:14:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 77BDA6B008C; Mon, 28 Oct 2024 10:14:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 72B3A6B0092; Mon, 28 Oct 2024 10:14:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4E2C36B0093; Mon, 28 Oct 2024 10:14:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 267DE6B008C for ; Mon, 28 Oct 2024 10:14:29 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id C3AC416042F for ; Mon, 28 Oct 2024 14:14:28 +0000 (UTC) X-FDA: 82723205670.05.F13F824 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf01.hostedemail.com (Postfix) with ESMTP id D124C40021 for ; Mon, 28 Oct 2024 14:14:06 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=XRymvCF3; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=jKq8zzXr; spf=pass (imf01.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730124786; 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=UqT2CVmVCpT+D5QlLXoeGeO/AB/2IlXG/SqYjtZ69nI=; b=iOIWlPG1iIBkdRJ6w/RSBdKRN56Rs9eW2V6iLzu4HByIIYiu59vw2cg19QYxnXfMdKBsfN YPuaVmor68NIlyvnBV6ickXrAJD2SOZ6gZHKjO4JKbXN13FRY86Sdbdnv2eP3SPuPOi0Ej kRiMwcKWj+49jrFypwTfs7/qVNzqsIU= ARC-Authentication-Results: i=2; imf01.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=XRymvCF3; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=jKq8zzXr; spf=pass (imf01.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1730124786; a=rsa-sha256; cv=pass; b=uUX11m39AtCu4NBK79FnR4wb6S4ecsIkfaCljBHxcrUMRi0zA3hcZtRfZlEbaVrIqa1Z8Y 5TsJwpmHeFGoo6ych8i0QLFQ15lbvibXE9y0rPb7ifXMqjgWsZAIK/AD8mBZ44SLxwGLd+ TTKXx3I1YZz1Gze3k8n6rqypzX12O6g= Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49SBTGnk024845; Mon, 28 Oct 2024 14:13:53 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=UqT2CVmVCpT+D5QlLXoeGeO/AB/2IlXG/SqYjtZ69nI=; b= XRymvCF3ZZ0enH6XIGHeCkGYI+pJ3lwSwD4SKGgyGvBh0FwdQaVVS5WEca+/4G+F A7MKSbfYR0fw1Bcw+z18GPHhujeJeWPUZlkXsBP5Jy8UY+FDCNxUQad2q7qHFivG M1LKYYi4Um374uRIK28xmP7ewvsP1mIdvWZmKAvKvpCgbGwvt69+dW7Va0+BmhHL kldGK7o5Q/cEIu49UQJLhgn71/jQXpYSWWDFGISo3Dlz8vqpli3IyUBEewKM2sPB k63KQEvrY0RMx5cG0Eeaenc/T3wIyEB5wduvEvVt/u/wyu9tX3k0cREfTGRSLES6 4kLJGXl96kNFe0BI+HsKfQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42grdxjymv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Oct 2024 14:13:52 +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 49SCvIaC004777; Mon, 28 Oct 2024 14:13:51 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2168.outbound.protection.outlook.com [104.47.55.168]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42jb2ska3p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Oct 2024 14:13:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ffGlYtulRWCoJhjveaqHi8iGQIuVh7nB4EVYOoR5S49SE6QrhSgcgwcGkGbNUptTXa00C5+cXl3d98L1USfer7/CX7S+AVw66SZPqz/kB1loGHhSynjMSXQTPV5CaDhtyDPD2L9XL4krazwZDqO6r/mNMK7IVJ1HLaTNr9WU3SfnF27iC8PfgzkGIAMTvp+vRkqPSjx8xMU8VgnOBhF9MBNu1CdkzU8j/jO0FNXypS6KY+f8UlFfFnTVcbiE1QFptirT9DH64y8eCTNEcaWm1HroapxgW1Qbt1AIVsZafZnd/X5qTFJJhDJJmEhrzjnVp6vXtlNp9IUaOrhn1Y7/3w== 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=UqT2CVmVCpT+D5QlLXoeGeO/AB/2IlXG/SqYjtZ69nI=; b=zR3Hk9P6AN+dJ06Ccmn6yeKeNtL27cB8udgRxppjMdU1yNglMVfEsfFEgmRNkJWLZ3NjOu1TUt4jHMmDCjja/CVtNVJ+jtWnRBFW1HeVkXbdqyLrKRqKnFm2za1h1erBK5zO8M1DvikT36lgoYCfttWUOj7HFBV2l8GogcQxOsubuF+jWupTJyFhFaHllzoIiESyMeVghGzF0++kIN8k1aIhEBZmjHst0KdwfaxfJ4RPbvEnk5O9Zm0QWS/4mKBjyHeEpK44FZgINuc2qUwp90DTejIzPUMf1bkDL2eHlPw1/tX8mNLkmV2facgVqTNFQzkgttD8YjDSOvmaZCcxgQ== 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=UqT2CVmVCpT+D5QlLXoeGeO/AB/2IlXG/SqYjtZ69nI=; b=jKq8zzXrCOF6bNv9P7+k+pUNE1+LE8btGSGOwz1QkZzNIG7Erd/nx/T0tvMG2tXEO81sumbBvSXF8qpRSPJF2UVoqi3kXyHHwusQq8izy6hbtQ+RjOvFajeAh9jxvZIdQGf+j7xhnY8or6x8ZJsY9JysosIjI756+5FPd70dCPM= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by SJ2PR10MB7598.namprd10.prod.outlook.com (2603:10b6:a03:540::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.24; Mon, 28 Oct 2024 14:13:42 +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.8093.024; Mon, 28 Oct 2024 14:13:42 +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 , 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 v4 2/5] mm: add PTE_MARKER_GUARD PTE marker Date: Mon, 28 Oct 2024 14:13:28 +0000 Message-ID: X-Mailer: git-send-email 2.47.0 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0451.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:e::31) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|SJ2PR10MB7598:EE_ X-MS-Office365-Filtering-Correlation-Id: bd9b84c7-4d43-4e19-5567-08dcf75aba37 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|7416014|376014; X-Microsoft-Antispam-Message-Info: a9xmdxT/Aa2+Z9Xw0HdisOm3Q/fFMHk+M6DvNninGY519qEwkRqnYCWiEtEjjcg57EmMTTnj838SucR2YzC0miTZX4kubXEliqhJn+YnkAkvV4OAcsGchVQAPXKAENvnuPN9cSsHiT4GwaB9UUbDhtipDM3Zeu5mM2QAFgrZLT/psEOvAyYUqbYJiZRrV9SzvS6wIKCnDMtZtLcLVTounTFOJVQLv1FMK0EwcJxilFga/6KQiLfSiogKNTHJk9OnVdRnmqg0kBuZx5eOY8fsrJcm5WLK5+uimdd4SgNR9pKkBckxhDdMnY7dKOLdUuta6g1WbIXUM+xrVkNQMibtmo9Q/MLIBasLw451v6PkWA/JWlA5upgsqw6T43Bawis5o2i63aUy2+jL038nXRpjMD14pQRnXniHFgyZZOxxsvu0Mf7dpMu9tvowTHrYnpTKpKb0yf+H1le8mu8aFwmiKmx7fOUT5OTnpF8I5Mlyu6WqCRvAbtNITFQZqt59wDoN5f4c/QnU5ulieo9J9Yu5Itat+WZSJIqiqA4a0bKtZYYVUbI7/IOUzuK+g5qXsZMp1AU2/LdcYpD1JmNeih63XTktogJew4xRjiFQDZ0hAzyjPxZldtwv1+rWSKVuMoXD/5Az794dCc7ZnGs9Xlla9xCau97vALlkzBys+lzrEoqgJyjmfLC3qBoVqfw6E0/AcpgJ6xtPH7+gyoV2NmgCyMKV8UWqlXyPLqhRs9MkXv5uvzoJuNeSO3InxOzw/RkD0D9hyBOxSPWfTMShSTlSOmBLGq14OZOsgfELkaaX4rJaU7h7BSWhcxYwcnADyX1XSWtvkh+Urc9hvMroMU/H68gPDblyhpKLIumQxuUJDzCmIKrOXGffbkoQ09AjVgGhbpd+0bzh7vMpb4+LJ5Dd+l4ekozIulatzNbtSfPF2inLqMN/N4Q2IZEL5QBq+FmdiKGuWlPksEhvo1T/eEkwosGOfJjpkMr8HBc6U//mIOX/USkpV6CJLKjEeo5G/NMW36pactzE2Ywl/8BM4nip3tM3m7+YMiTRh4RyjXb0QPRb/r1qT3rTGRadREuAnZ47QwR1YBDythMX+n6h2EhgKsH1R9laeoKhCit8a6mtHu78uHaLjhmOR0WLEZTqmLF+I8uqJycTHE8pl6z+6fgclcQjjUdiKuMX01wRsJcPNRKMul93IQE9mM7nPbZorwWRk+nT2oGqh/YuF/ap+ADmxfs1Tht7EtSnzAtc8gbXco9O3CgZGbbIqWkZA9Og3bq5mNkULHaf3fdeUhoYbXpM+CwSr1GIbzZbdU/Sps2X63M= 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)(1800799024)(366016)(7416014)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: C2Z1HHx7dZGn2tFDqi6o4VqXRVzjuDfmgkIqBfiDMwMLq5ntHTGSU8O4mwEkY1zvNRwtE53LZYepUoCajfnM1TmYH4zfVJVD2OvCd11Pavqh2xLG6XWKzv7BgDL3faFOgxahh/Twsyq1i7sVgwvOJ7JJpp55Fhci90mh2DBT7Zf3FePw8xQh2ScsXyiDG+LvDGBKpcUEwprI++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-Exchange-CrossTenant-Network-Message-Id: bd9b84c7-4d43-4e19-5567-08dcf75aba37 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 14:13:42.5426 (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: XWVeaT8jYTaCZrStXvasEydF852pbFF7Njrd/ZQp7JABjFsKW7Kl6vFHNooT4/x741sqWaRuq8XnQgtohhRcXhEGBHt0VFFMZht9z89u6dE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR10MB7598 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-28_04,2024-10-28_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 bulkscore=0 adultscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410280114 X-Proofpoint-GUID: anEky7ilylRdCvo4SPsMd6iJo0bzrgj3 X-Proofpoint-ORIG-GUID: anEky7ilylRdCvo4SPsMd6iJo0bzrgj3 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: D124C40021 X-Stat-Signature: rmpo9wihghpe7cgubu7gjki19usxgzj3 X-HE-Tag: 1730124846-963640 X-HE-Meta: U2FsdGVkX1/r3SzsI3dUwxKBcgSvgOlYWrdOryLDNvenk1zeTrbKVev7w1uhPDXYxC4WzGLltVNGJbWSuVBf/N34MjibdeuBsuYyHlsw7vQyuREmAeG+zbtkX+e+/luvZl/tmdI1+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Bcvo+5lpkhS/LuJeUXwY0NC/6Bptv0a3JD1QtUoQDiwOKeph8Ss6YHAf6/8LtyWkmXyjkHjRvTdnslhEDQNheyU71Fr18vFu8fQEIpy4cVK9VaQOF/kUQCiYo9AutYR30Esi2lkseGzx4Ck2n0AWp4LqL04zM03x9eqPQpcaZ8oMQr5d+R++RBK1Ju2GJVTVLjvRMsEJEJ18qyYsaB3XmXdieWOZWcMwvTFuO9K2rUe/s03V73bti8/Fi1okgYxx+IWkxDbRMqVKSceBoxEUTvlMnKYhX7ooDepgtZLD7Sir0NOPaS/vnv6uQVJd0vZqoK56BlZW2lKlfzFQsSXDPxuRVMj0iwcFfg== 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 MADV_FREE. We additionally add a WARN_ON_ONCE() in hugetlb logic should a guard marker be encountered there, as we explicitly do not support this operation and this should not occur. Acked-by: Vlastimil Babka Signed-off-by: Lorenzo Stoakes --- include/linux/mm_inline.h | 2 +- include/linux/swapops.h | 24 +++++++++++++++++++++++- mm/hugetlb.c | 4 ++++ mm/memory.c | 18 +++++++++++++++--- mm/mprotect.c | 6 ++++-- 5 files changed, 47 insertions(+), 7 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..96f26e29fefe 100644 --- a/include/linux/swapops.h +++ b/include/linux/swapops.h @@ -426,9 +426,19 @@ 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. This means guard markers behave in effect as if the region were mapped + * PROT_NONE, rather than if they were a memory hole or equivalent. + */ +#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) { @@ -464,6 +474,18 @@ static inline int is_poisoned_swp_entry(swp_entry_t entry) { return is_pte_marker_entry(entry) && (pte_marker_get(entry) & PTE_MARKER_POISONED); + +} + +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_GUARD); } /* diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 906294ac85dc..2c8c5da0f5d3 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -6353,6 +6353,10 @@ 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 (WARN_ON_ONCE(marker & PTE_MARKER_GUARD)) { + /* This isn't supported in hugetlb. */ + ret = VM_FAULT_SIGSEGV; + goto out_mutex; } } diff --git a/mm/memory.c b/mm/memory.c index 2d32023d4eb8..75c2dfd04f72 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); diff --git a/mm/mprotect.c b/mm/mprotect.c index 6f450af3252e..516b1d847e2c 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -236,9 +236,11 @@ static long change_pte_range(struct mmu_gather *tlb, } else if (is_pte_marker_entry(entry)) { /* * Ignore error swap entries unconditionally, - * because any access should sigbus anyway. + * because any access should sigbus/sigsegv + * anyway. */ - if (is_poisoned_swp_entry(entry)) + if (is_poisoned_swp_entry(entry) || + is_guard_swp_entry(entry)) continue; /* * If this is uffd-wp pte marker and we'd like