Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hugetlbfs: prevent filesystem stacking of hugetlbfs

syzbot found issues with having hugetlbfs on a union/overlay as reported
in [1]. Due to the limitations (no write) and special functionality of
hugetlbfs, it does not work well in filesystem stacking. There are no
know use cases for hugetlbfs stacking. Rather than making modifications
to get hugetlbfs working in such environments, simply prevent stacking.

[1] https://lore.kernel.org/linux-mm/000000000000b4684e05a2968ca6@google.com/

Reported-by: syzbot+d6ec23007e951dadf3de@syzkaller.appspotmail.com
Suggested-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Miklos Szeredi <mszeredi@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Colin Walters <walters@verbum.org>
Link: http://lkml.kernel.org/r/80f869aa-810d-ef6c-8888-b46cee135907@oracle.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Mike Kravetz and committed by
Linus Torvalds
15568299 619b5b46

+6
+6
fs/hugetlbfs/inode.c
··· 1364 1364 sb->s_magic = HUGETLBFS_MAGIC; 1365 1365 sb->s_op = &hugetlbfs_ops; 1366 1366 sb->s_time_gran = 1; 1367 + 1368 + /* 1369 + * Due to the special and limited functionality of hugetlbfs, it does 1370 + * not work well as a stacking filesystem. 1371 + */ 1372 + sb->s_stack_depth = FILESYSTEM_MAX_STACK_DEPTH; 1367 1373 sb->s_root = d_make_root(hugetlbfs_get_root(sb, ctx)); 1368 1374 if (!sb->s_root) 1369 1375 goto out_free;