Skip to content

Commit 3c0da3d

Browse files
thejhtorvalds
authored andcommitted
fuse: Initialize beyond-EOF page contents before setting uptodate
fuse_notify_store(), unlike fuse_do_readpage(), does not enable page zeroing (because it can be used to change partial page contents). So fuse_notify_store() must be more careful to fully initialize page contents (including parts of the page that are beyond end-of-file) before marking the page uptodate. The current code can leave beyond-EOF page contents uninitialized, which makes these uninitialized page contents visible to userspace via mmap(). This is an information leak, but only affects systems which do not enable init-on-alloc (via CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y or the corresponding kernel command line parameter). Link: https://bugs.chromium.org/p/project-zero/issues/detail?id=2574 Cc: stable@kernel.org Fixes: a1d75f2 ("fuse: add store request") Signed-off-by: Jann Horn <jannh@google.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent c3f2d78 commit 3c0da3d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/fuse/dev.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,9 +1618,11 @@ static int fuse_notify_store(struct fuse_conn *fc, unsigned int size,
16181618

16191619
this_num = min_t(unsigned, num, PAGE_SIZE - offset);
16201620
err = fuse_copy_page(cs, &page, offset, this_num, 0);
1621-
if (!err && offset == 0 &&
1622-
(this_num == PAGE_SIZE || file_size == end))
1621+
if (!PageUptodate(page) && !err && offset == 0 &&
1622+
(this_num == PAGE_SIZE || file_size == end)) {
1623+
zero_user_segment(page, this_num, PAGE_SIZE);
16231624
SetPageUptodate(page);
1625+
}
16241626
unlock_page(page);
16251627
put_page(page);
16261628

0 commit comments

Comments
 (0)