]> www.infradead.org Git - nvme.git/commit
cachestat: fix page cache statistics permission checking
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 21 Jan 2025 17:27:22 +0000 (09:27 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 22 Jan 2025 04:30:19 +0000 (20:30 -0800)
commit5f537664e705b0bf8b7e329861f20128534f6a83
tree6a72107580c34ce2636fe9cd5ea834a881f40889
parentc4b9570cfb63501638db720f3bee9f6dfd044b82
cachestat: fix page cache statistics permission checking

When the 'cachestat()' system call was added in commit cf264e1329fb
("cachestat: implement cachestat syscall"), it was meant to be a much
more convenient (and performant) version of mincore() that didn't need
mapping things into the user virtual address space in order to work.

But it ended up missing the "check for writability or ownership" fix for
mincore(), done in commit 134fca9063ad ("mm/mincore.c: make mincore()
more conservative").

This just adds equivalent logic to 'cachestat()', modified for the file
context (rather than vma).

Reported-by: Sudheendra Raghav Neela <sneela@tugraz.at>
Fixes: cf264e1329fb ("cachestat: implement cachestat syscall")
Tested-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Nhat Pham <nphamcs@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/filemap.c