[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6913dac8.a70a0220.22f260.0150.GAE@google.com>
Date: Tue, 11 Nov 2025 16:54:32 -0800
From: syzbot <syzbot+f64019ba229e3a5c411b@...kaller.appspotmail.com>
To: linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com
Subject: Forwarded: [PATCH] mm/memfd: zero hugetlb pages on allocation
For archival purposes, forwarding an incoming command email to
linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com.
***
Subject: [PATCH] mm/memfd: zero hugetlb pages on allocation
Author: kartikey406@...il.com
#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
When allocating hugetlb pages for memfd, the pages were not being
zeroed, which could lead to uninitialized kernel memory being exposed
to userspace through read() or mmap() operations.
This is a security issue as it allows information disclosure of
potentially sensitive kernel data. Add __GFP_ZERO to the gfp_mask
to ensure pages are cleared before being made accessible to userspace.
This is particularly important for udmabuf use cases where these
pages are pinned and directly accessed by userspace via DMA buffers.
Reproducer:
- Create memfd with MFD_HUGETLB flag
- Use udmabuf ioctl to pin the pages
- Read from the memfd using preadv()
- KMSAN detects uninitialized memory leak to userspace
Reported-by: syzbot+f64019ba229e3a5c411b@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=f64019ba229e3a5c411b
Signed-off-by: Deepanshu Kartikey <kartikey406@...il.com>
---
mm/memfd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/mm/memfd.c b/mm/memfd.c
index 1d109c1acf21..0095b9f4fe00 100644
--- a/mm/memfd.c
+++ b/mm/memfd.c
@@ -85,6 +85,7 @@ struct folio *memfd_alloc_folio(struct file *memfd, pgoff_t idx)
gfp_mask = htlb_alloc_mask(h);
gfp_mask &= ~(__GFP_HIGHMEM | __GFP_MOVABLE);
+ gfp_mask |= __GFP_ZERO;
idx >>= huge_page_order(h);
nr_resv = hugetlb_reserve_pages(inode, idx, idx + 1, NULL, 0);
--
2.43.0
Powered by blists - more mailing lists