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=1796183279; b=fNTVGIfN/2mfr0h05fesEnI/A3VHtAqTXqwcnhusI8EwIIvbNCZfOTSpwX/N8JSs8s02 Hy/wWgZcr/nGjcBXLCG//Xpcrdswik77G8UkimoOLy0Fp36vMmXkwKYfNc46B/lQQXl0p /ISF4sSwcaHfmfYL+O+Wum4IP4AErqGHWxkCbvHbVz3DCloZA7yx5zAIX0RFsjL5kmef2 T5xXbFl4TBTUc33wdhngIpZ80r5RGbkBWA1qkhThh3u1I23xD57T4TZCoIARyXrdG2Asx GfxKK9vEoQ6mGBkfOOhPvH9WOY9Xkn22n46+TfxMy2kMErRuqo+rl0EeaZTVEBzhCZQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796183279; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=2+N5znj6eO998coi3XKY1AlHpjFujhLtDthHz/7akCc=; b=dw+TOIDNTaNY8gB3Yq3VJgAq2T+QEXB0+GwPDntDQzlR4zZ4RMC+jgUu0JCpAhNQqev9 wxjq0WYsWXvHkdW7f0KGv8rPz0z8pohMC0DCLHR1Gs4tQRu72m2uXbcQYtyuzS6hX83rU MtplU6lM02ZZ5d894AhMUwyoSUTYGbBjBypuuViSaX0+9eC5JKlM61oaYllAmiyD/Lfsp CCnJOiSpqW/R7m/erSiEkzQTXidagLiRQuo29elaE7RXC3El/7BhMwGOewuTzj+TEyXTX QC4nUK7irrYkvSbEyz4zFMixOHp+yl2CQ/VNUX/Sauaany1+uW4ezvV9NPyroKGNm8A== 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=dKeMmyec; 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 8D0EE606A31A; Wed, 2 Dec 2026 03:47: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=dKeMmyec Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19E371F00896; Wed, 2 Dec 2026 03:47:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796183279; bh=2+N5znj6eO998coi3XKY1AlHpjFujhLtDthHz/7akCc=; h=Date:To:From:In-Reply-To:References:Subject; b=dKeMmyec3DxQxEYcxkq+mTCyLxwGgdCA7ouBmrx3PSIvotMKCLDKdvm/Fn1gU2fS4 ZIsKtObRjN+HJ6YD1E+JeGIsVGML/PDouDI7Xee8yVaob3vf+b4nvZXYJuBggtyvmt l6hSj6iJgHDCePjquODnI/gkKK8RDAq3/I33IZs8= Date: Tue, 01 Dec 2026 19:47:58 -0800 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 From: Andrew Morton In-Reply-To: <20261125030432.274396-1-bsdhenrymartin@gmail.com> References: <20261125030432.274396-1-bsdhenrymartin@gmail.com> Subject: [merged mm-hotfixes-stable] mm-report-all-zero-cachestat-for-dax-mappings.patch removed from -mm tree Message-Id: <20261202034759.19E371F00896@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 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 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 Signed-off-by: Andrew Morton Reviewed-by: Jan Kara Cc: Matthew Wilcox (Oracle) Cc: Nhat Pham Cc: Johannes Weiner Cc: 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