From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,willy@infradead.org,stable@vger.kernel.org,
nphamcs@gmail.com,jack@suse.cz,hannes@cmpxchg.org,bsdhenrymartin@gmail.com,
akpm@linux-foundation.org
Subject: [merged mm-hotfixes-stable] mm-report-all-zero-cachestat-for-dax-mappings.patch removed from -mm tree
Date: Tue, 01 Dec 2026 19:47:58 -0800 [thread overview]
Message-ID: <20261202034759.19E371F00896@smtp.kernel.org> (raw)
In-Reply-To: <20261125030432.274396-1-bsdhenrymartin@gmail.com>
The quilt patch titled
Subject: mm: report all-zero cachestat for DAX mappings
has been removed from the -mm tree. Its filename was
mm-report-all-zero-cachestat-for-dax-mappings.patch
This patch was dropped because it was merged into the mm-hotfixes-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Henry Martin <bsdhenrymartin@gmail.com>
Subject: mm: report all-zero cachestat for DAX mappings
Date: Wed, 25 Nov 2026 11:04:32 +0800
filemap_cachestat() treats every xarray value entry as a workingset
shadow. On DAX mappings, value entries are DAX exceptional entries: same
value bit, different bit layout (flags in the low bits, pfn above).
Decoded as a shadow, a DAX entry yields a bogus node id; NODE_DATA() for
it can be NULL, and lru_gen_test_recent() then dereferences it:
Oops: general protection fault
RIP: 0010:lru_gen_test_recent+0xde/0x300
Call Trace:
workingset_test_recent
filemap_cachestat
__x64_sys_cachestat
Any writable file on a DAX mount triggers this once an mmap write fault
has populated entries.
DAX mappings have no page cache, so none of the cachestat fields make
sense for them. Skip the xarray walk for them and report all zeros, and
document the behaviour in the syscall's kernel-doc.
This issue was discovered by Tencent CodeBuddy Security.
Link: https://patch.msgid.link/20261125030432.274396-1-bsdhenrymartin@gmail.com
Fixes: cf264e1329fb ("cachestat: implement cachestat syscall")
Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: <stable@vger.kernel.org>
mm/filemap.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/mm/filemap.c~mm-report-all-zero-cachestat-for-dax-mappings
+++ a/mm/filemap.c
@@ -4789,7 +4789,8 @@ static inline bool can_do_cachestat(stru
* The `flags` argument is unused for now, but is included for future
* extensibility. User should pass 0 (i.e no flag specified).
*
- * Currently, hugetlbfs is not supported.
+ * Currently, hugetlbfs is not supported. DAX mappings have no page
+ * cache, so cachestat() always reports all zeros for them.
*
* Because the status of a page can change after cachestat() checks it
* but before it returns to the application, the returned values may
@@ -4834,7 +4835,10 @@ SYSCALL_DEFINE4(cachestat, unsigned int,
csr.len == 0 ? ULONG_MAX : (csr.off + csr.len - 1) >> PAGE_SHIFT;
memset(&cs, 0, sizeof(struct cachestat));
mapping = fd_file(f)->f_mapping;
- filemap_cachestat(mapping, first_index, last_index, &cs);
+
+ /* DAX mappings have no page cache; report all zeros. */
+ if (!dax_mapping(mapping))
+ filemap_cachestat(mapping, first_index, last_index, &cs);
if (copy_to_user(cstat, &cs, sizeof(struct cachestat)))
return -EFAULT;
_
Patches currently in -mm which might be from bsdhenrymartin@gmail.com are
prev parent reply other threads:[~2026-12-02 3:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 3:04 [PATCH v2] mm: report all-zero cachestat for DAX mappings Henry Martin
2026-11-25 9:14 ` Jan Kara
2026-11-25 20:48 ` + mm-report-all-zero-cachestat-for-dax-mappings.patch added to mm-hotfixes-unstable branch Andrew Morton
2026-12-02 3:47 ` 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=20261202034759.19E371F00896@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=bsdhenrymartin@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=jack@suse.cz \
--cc=mm-commits@vger.kernel.org \
--cc=nphamcs@gmail.com \
--cc=stable@vger.kernel.org \
--cc=willy@infradead.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.