From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,david@kernel.org,rppt@kernel.org,
akpm@linux-foundation.org
Subject: + mm-secretmem-disable-memfd_secret-if-secretmem_init-fails.patch added to mm-new branch
Date: Wed, 02 Dec 2026 11:24:39 -0800 [thread overview]
Message-ID: <20261202192439.974F31F00893@smtp.kernel.org> (raw)
In-Reply-To: <20261202113847.1412019-1-rppt@kernel.org>
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)" <rppt@kernel.org>
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) <rppt@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/bug/linux-ad411cd2-f343-445a-b61d-9fb3eb712762
Reviewed-by: David Hildenbrand (Arm) <david@kernel.org>
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
prev parent reply other threads:[~2026-12-02 19:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 11:38 [PATCH] mm/secretmem: disable memfd_secret() if secretmem_init() fails Mike Rapoport
2026-12-02 12:44 ` David Hildenbrand (Arm)
2026-12-02 16:00 ` Mike Rapoport
2026-12-02 19:24 ` Andrew Morton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261202192439.974F31F00893@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=mm-commits@vger.kernel.org \
--cc=rppt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.