From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795986959; b=Iy/hV+Gj0dBkzklsNXs4JBLwlzbhMYOJZ/iRw/CCB7qBj0zmW/PdN/6N3flAuar1Frao mHssBX6MJZV52pt2+yaqsotEdSQ8iknyf6Qdiz0S+e+BacRmdAphK0Ecq/za8nA2ytqLk oxAZEwhB+g7ZGvCiPyoJa16TYKrWetsNU25ci4EeV+3hgPUbn2dGqteM2oPbY/1sYiYDb 0of+I/5MskNWlFC27+tPHG43B0WILHxOEvkhrI5y5jH5RtLPZTMP/0KD4jpIpvt1UiuB+ oPuc+9wVhGYCzec075kcHifvSX+NNNcYoFCUyGAZetmF7hO8TiMSPceHFd8zORCNYMQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795986959; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=porC+Ldj8MTfNsPJEfSG3E3KEzkVfV76kZhO+CZd6KU=; b=pHBGu0ajDzcMJ8xcP/PPiLeH+CMJsBO8vOOWetEvarc6r6MmA8E0vSsUB+VL++0CxgwZ NHpkU3rUUh3IC6BOFL44HvQY8385iFMpYQ8+hCUfSJ1LQFMcumwm6XGWxWEeptqfmuWfi CjNBm+t48POHLX/iOUKg0q0GW1fKNCnJpzMpEGCDf0t1tFqDO1meU8Ad16wMLC5Lp4Ja4 zgEe9BS2dRaPJBpAgwWrBOiOmYLWyLq3QYI9weaJ5Y29/XTYJ5iMWQUtL8eUcq138+Qd1 xtzEJmfP8Uy6rGkJf4bT9EXMmyNTJGMCsnuR+C34EwR/0sflNB0Tw+uvuM9SQwuAwzQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=t6X3pMnX; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C918606A31C; Sun, 29 Nov 2026 21:15:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=t6X3pMnX Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0848F1F00896; Sun, 29 Nov 2026 21:15:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1795986959; bh=porC+Ldj8MTfNsPJEfSG3E3KEzkVfV76kZhO+CZd6KU=; h=Date:To:From:In-Reply-To:References:Subject; b=t6X3pMnXwhOFRvVZZq41uQrK+0zfKMDXxDH9M4G6lMxHNUW9k7V/7khBzJ3kvhMnp BVSEZmdVO1sObqxCyNm1EeNBsQALnnIz+uWCMsX/9sijgDjhvfR4pFtzNEqFUYjsKt ZmTByP/svyIC7P/hag8qSnShX23Ritbn2+gYPdyM= Date: Sun, 29 Nov 2026 13:15:58 -0800 To: mm-commits@vger.kernel.org,stable@vger.kernel.org,rppt@kernel.org, leon@kernel.org,jgg@ziepe.ca,james.bottomley@hansenpartnership.com, hagen@jauu.net,david@kernel.org,mason@kernel.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261129-hmm_secretmem-v1-1-113c4f5e18a1@kernel.org> References: <20261129-hmm_secretmem-v1-1-113c4f5e18a1@kernel.org> Subject: + mm-hmm-refuse-secretmem-vmas-in-hmm_range_fault.patch added to mm-new branch Message-Id: <20261129211559.0848F1F00896@smtp.kernel.org> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The patch titled Subject: mm/hmm: refuse secretmem VMAs in hmm_range_fault() has been added to the -mm mm-new branch. Its filename is mm-hmm-refuse-secretmem-vmas-in-hmm_range_fault.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-hmm-refuse-secretmem-vmas-in-hmm_range_fault.patch This patch will later appear in the mm-new branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new. The mm-new branch of mm.git is not included in linux-next If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: Chris Mason Subject: mm/hmm: refuse secretmem VMAs in hmm_range_fault() Date: Sun, 29 Nov 2026 09:47:02 +0100 secretmem folios are removed from the directmap. GUP refuses secretmem VMAs for that reason, but hmm_range_fault() hands out secretmem folios to drivers. Consequently, drivers that are not aware of this might access these folios through the direct map, resulting in a kernel page fault. For example, the rxe ODP code accesses the folios through kmap_local_page() when copying data or performing atomic operations on a memory region. Let's fix it by refusing secretmem VMAs in hmm_range_fault(), just like GUP does. This has low urgency, as it requires registering secretmem with a driver that uses hmm_range_fault(), such as rxe ODP. [david@kernel.org: adjust description and comment] Link: https://patch.msgid.link/20261129-hmm_secretmem-v1-1-113c4f5e18a1@kernel.org Fixes: 1507f51255c9 ("mm: introduce memfd_secret system call to create "secret" memory areas") Signed-off-by: Chris Mason Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Andrew Morton Reviewed-by: Mike Rapoport (Microsoft) Cc: Jason Gunthorpe Cc: Leon Romanovsky Cc: James Bottomley Cc: Hagen Paul Pfeifer Cc: mm/hmm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/mm/hmm.c~mm-hmm-refuse-secretmem-vmas-in-hmm_range_fault +++ a/mm/hmm.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "internal.h" @@ -598,7 +599,7 @@ static int hmm_vma_walk_test(unsigned lo if (!vma_test_any(vma, VMA_IO_BIT, VMA_PFNMAP_BIT) && !vma_test_single_mask(vma, VMA_SHADOW_STACK) && - vma_test(vma, VMA_READ_BIT)) + !vma_is_secretmem(vma) && vma_test(vma, VMA_READ_BIT)) return 0; /* @@ -611,6 +612,9 @@ static int hmm_vma_walk_test(unsigned lo * * Devices must not gain ordinary write access to shadow stacks. * + * secretmem folios have no directmap and drivers are not aware of + * that; refuse such mappings, just like GUP does. + * * If a fault is requested for an unsupported range then it is a hard * failure. */ _ Patches currently in -mm which might be from mason@kernel.org are mm-swap-fix-large-swap-in-across-swap-file-extents.patch hugetlbfs-do-not-grow-a-sealed-file-in-mmap.patch mm-hugetlb-keep-surplus-folios-that-are-reserved.patch mm-hugetlb-fix-reservation-leak-on-min_size=-mounts.patch mm-cachestat-count-each-page-only-once.patch mm-cachestat-restart-the-walk-after-each-entry.patch percpu-queue-the-balance-work-on-an-unbound-workqueue.patch mm-vma-fix-uncharge-after-failed-stack-relocation.patch mm-mremap-apply-the-mmap-offset-limits-on-expansion.patch mm-mremap-respect-guard-gaps-on-in-place-expansion.patch mm-vma-make-brk-mappings-non-executable-under-mdwe.patch mm-hmm-refuse-secretmem-vmas-in-hmm_range_fault.patch