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=1796239480; b=jEE7vLFhj3Uwf3DD0cErN/u3PX2MtQHneOSYwyeNGY5ZtinwL/4UOdXBsBlm1kgnThVF ELFpVHPQDYxzeRJ2Nn5PJV8nrTAk6Di3VvnWtpp0G0KxX3df/I+1fygVNM1WmuKh8AbpX QiYQgxB/9YOfgFfEfF+2BfdlKEsc+xJAafUivlFZWtlxtqdkBqDiISpl5DAVSycAqHRY+ t/s/+Z3SIWClSONZ7UdQZXelv+IamGt7iwKx98XcHx8lc/4DBwWjShwvRoe8MDyBL5iIa TFG9LrEbU8j5tJRHyKYx2u7UY2RLRhXlS084ZUpznhScNscoiSA6CBTU1DMbBcDpO4Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796239480; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=yvWrAlFUr4dRmIiHRnB+GiLHR78np2O8WQb59ZGUxas=; b=Trek4mlqctOCyXMYV75icpucNHzzMD9Gskxn3CfHguDkeQh/waNOLuA8aQb3GYYsJZjF iL4SQUlw0EXJoQCR7m4wAv2FD+IeFh2EUrEDEA4vP0P8O+l9ZYuIfSZM3KgSzaeAYyauf eQgMDzKjL8x5UXSxRASTiYRnBDSLatF+3rpZDC0lLxVNRqS0VWcTYfX3LzBdaEMfgi29c yLjTVBQbGP6VTpGwBcWHOKqun0YUjnHjDIw8cRFRmoRjLeaLUXJHkfUQUzBB+Q42zbLe+ f6DBPveqVEUYmLGXmRlNfDrvZXxCquNo1y/1itiJ59f37f4j86ad8q3tTDl8lGgufGQ== 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=s0hXNglE; 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 2F2FD606A322 for ; Wed, 2 Dec 2026 19:24:39 +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=s0hXNglE Received: by smtp.kernel.org (Postfix) with ESMTPSA id 974F31F00893; Wed, 2 Dec 2026 19:24:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796239479; bh=yvWrAlFUr4dRmIiHRnB+GiLHR78np2O8WQb59ZGUxas=; h=Date:To:From:In-Reply-To:References:Subject; b=s0hXNglEZjRNGSn6GFNYyqqmSdFH26D++F2/vb5EQK6D0yn9fBsNtf+5yQ0AT8kfu UF1xxWZXZtZ6fo1wiKFY4k00fM3eGM1M1OO340qGJuDUJlnUjOTCx3VKjDHPUZEEW+ O3GfXh30fBafbLg9kfTeDaCggquGK4ggVwyt8rTo= Date: Wed, 02 Dec 2026 11:24:39 -0800 To: mm-commits@vger.kernel.org,david@kernel.org,rppt@kernel.org, akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261202113847.1412019-1-rppt@kernel.org> References: <20261202113847.1412019-1-rppt@kernel.org> Subject: + mm-secretmem-disable-memfd_secret-if-secretmem_init-fails.patch added to mm-new branch Message-Id: <20261202192439.974F31F00893@smtp.kernel.org> X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The patch titled Subject: mm/secretmem: disable memfd_secret() if secretmem_init() fails has been added to the -mm mm-new branch. Its filename is mm-secretmem-disable-memfd_secret-if-secretmem_init-fails.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-secretmem-disable-memfd_secret-if-secretmem_init-fails.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: "Mike Rapoport (Microsoft)" Subject: mm/secretmem: disable memfd_secret() if secretmem_init() fails Date: Wed, 02 Dec 2026 13:38:46 +0200 If kern_mount() fails in secretmem_init(), secretmem_mnt holds an error pointer, but secretmem_enable remains set. A later memfd_secret() call then dereferences secretmem_mnt in secretmem_file_create() and oopses. At fs_initcall time kern_mount() of a pseudo filesystem realistically fails only when a memory allocation fails, so this is unlikely to happen in practice. Clear secretmem_enable when kern_mount() fails, so that memfd_secret() returns -ENOSYS as if secretmem was disabled. Link: https://patch.msgid.link/20261202113847.1412019-1-rppt@kernel.org Fixes: 4eb5bbde3ccb ("mm: fix dereferencing possible ERR_PTR") Signed-off-by: Mike Rapoport (Microsoft) Signed-off-by: Andrew Morton Reported-by: Sashiko Closes: https://sashiko.dev/bug/linux-ad411cd2-f343-445a-b61d-9fb3eb712762 Reviewed-by: David Hildenbrand (Arm) mm/secretmem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/mm/secretmem.c~mm-secretmem-disable-memfd_secret-if-secretmem_init-fails +++ a/mm/secretmem.c @@ -362,8 +362,10 @@ static int __init secretmem_init(void) return 0; secretmem_mnt = kern_mount(&secretmem_fs); - if (IS_ERR(secretmem_mnt)) + if (IS_ERR(secretmem_mnt)) { + secretmem_enable = false; return PTR_ERR(secretmem_mnt); + } return 0; } _ Patches currently in -mm which might be from rppt@kernel.org are mm-cma-simplify-cma_declare_contiguous_multi.patch mm-fake-numa-fix-leak-of-the-distance-table-copy-on-errors.patch mm-secretmem-disable-memfd_secret-if-secretmem_init-fails.patch hibernation-make-swsusp_page-helpers-static.patch hibernation-ensure-secretmem-pages-dont-reach-a-snapshot.patch hibernate-handle-potential-errors-in-hibernate_mapunmap_page.patch hibernation-kfence-explicitly-map-unmap-kfence-pages.patch hibernation-make-hibernation-unavailable-when-debug_pagealloc-is-on.patch