Linux-Fsdevel Archive on lore.kernel.org help / color / mirror / Atom feed
From: Mike Kravetz <mike.kravetz@oracle.com> To: Miklos Szeredi <miklos@szeredi.hu> Cc: Amir Goldstein <amir73il@gmail.com>, Al Viro <viro@zeniv.linux.org.uk>, Linux MM <linux-mm@kvack.org>, linux-fsdevel <linux-fsdevel@vger.kernel.org>, overlayfs <linux-unionfs@vger.kernel.org>, linux-kernel <linux-kernel@vger.kernel.org>, Matthew Wilcox <willy@infradead.org>, Colin Walters <walters@verbum.org>, Andrew Morton <akpm@linux-foundation.org>, syzbot <syzbot+d6ec23007e951dadf3de@syzkaller.appspotmail.com>, syzkaller-bugs <syzkaller-bugs@googlegroups.com> Subject: Re: [PATCH v4 1/2] hugetlb: use f_mode & FMODE_HUGETLBFS to identify hugetlbfs files Date: Mon, 15 Jun 2020 16:45:09 -0700 [thread overview] Message-ID: <80f869aa-810d-ef6c-8888-b46cee135907@oracle.com> (raw) In-Reply-To: <CAJfpegsugobr8LnJ7e3D1+QFHCdYkW1swtSZ_hKouf_uhZreMg@mail.gmail.com> On 6/15/20 12:53 AM, Miklos Szeredi wrote: > On Sat, Jun 13, 2020 at 9:12 PM Mike Kravetz <mike.kravetz@oracle.com> wrote: >> On 6/12/20 11:53 PM, Amir Goldstein wrote: >>> >>> The simplest thing for you to do in order to shush syzbot is what procfs does: >>> /* >>> * procfs isn't actually a stacking filesystem; however, there is >>> * too much magic going on inside it to permit stacking things on >>> * top of it >>> */ >>> s->s_stack_depth = FILESYSTEM_MAX_STACK_DEPTH; >>> >>> Currently, the only in-tree stacking fs are overlayfs and ecryptfs, but there >>> are some out of tree implementations as well (shiftfs). >>> So you may only take that option if you do not care about the combination >>> of hugetlbfs with any of the above. >>> >>> overlayfs support of mmap is not as good as one might hope. >>> overlayfs.rst says: >>> "If a file residing on a lower layer is opened for read-only and then >>> memory mapped with MAP_SHARED, then subsequent changes to >>> the file are not reflected in the memory mapping." >>> >>> So if I were you, I wouldn't go trying to fix overlayfs-huguetlb interop... >> >> Thanks again, >> >> I'll look at something as simple as s_stack_depth. > > Agree. Apologies again for in the incorrect information about writing to lower filesystem. Stacking ecryptfs on hugetlbfs does not work either. Here is what happens when trying to create a new file. [ 1188.863425] ecryptfs_write_metadata_to_contents: Error attempting to write header information to lower file; rc = [-22] [ 1188.865469] ecryptfs_write_metadata: Error writing metadata out to lower file; rc = [-22] [ 1188.867022] Error writing headers; rc = [-22] I like Amir's idea of just setting s_stack_depth in hugetlbfs to prevent stacking. From 0fbed66b37c18919ea7edd47b113c97644f49362 Mon Sep 17 00:00:00 2001 From: Mike Kravetz <mike.kravetz@oracle.com> Date: Mon, 15 Jun 2020 14:37:52 -0700 Subject: [PATCH] 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> --- fs/hugetlbfs/inode.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 991c60c7ffe0..f32759c8e84d 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -1313,6 +1313,12 @@ hugetlbfs_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_magic = HUGETLBFS_MAGIC; sb->s_op = &hugetlbfs_ops; sb->s_time_gran = 1; + + /* + * Due to the special and limited functionality of hugetlbfs, it does + * not work well as a stacking filesystem. + */ + sb->s_stack_depth = FILESYSTEM_MAX_STACK_DEPTH; sb->s_root = d_make_root(hugetlbfs_get_root(sb, ctx)); if (!sb->s_root) goto out_free; -- 2.25.4
next prev parent reply other threads:[~2020-06-15 23:45 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-12 0:46 [PATCH v4 1/2] hugetlb: use f_mode & FMODE_HUGETLBFS to identify hugetlbfs files Mike Kravetz 2020-06-12 0:46 ` [PATCH v4 2/2] ovl: call underlying get_unmapped_area() routine. propogate FMODE_HUGETLBFS Mike Kravetz 2020-06-14 12:50 ` Amir Goldstein 2020-06-12 1:53 ` [PATCH v4 1/2] hugetlb: use f_mode & FMODE_HUGETLBFS to identify hugetlbfs files Matthew Wilcox 2020-06-12 1:58 ` Al Viro 2020-06-12 21:51 ` Mike Kravetz 2020-06-13 6:53 ` Amir Goldstein 2020-06-13 14:38 ` Matthew Wilcox 2020-06-13 19:12 ` Mike Kravetz 2020-06-15 7:53 ` Miklos Szeredi 2020-06-15 10:05 ` Amir Goldstein 2020-06-15 13:01 ` Miklos Szeredi 2020-06-15 23:45 ` Mike Kravetz [this message] 2020-06-16 9:01 ` Miklos Szeredi 2020-06-15 8:24 ` Miklos Szeredi 2020-06-15 17:48 ` Mike Kravetz 2020-06-12 6:28 ` [RFC PATCH] hugetlb: hugetlbfs_file_operations can be static kernel test robot
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=80f869aa-810d-ef6c-8888-b46cee135907@oracle.com \ --to=mike.kravetz@oracle.com \ --cc=akpm@linux-foundation.org \ --cc=amir73il@gmail.com \ --cc=linux-fsdevel@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=linux-unionfs@vger.kernel.org \ --cc=miklos@szeredi.hu \ --cc=syzbot+d6ec23007e951dadf3de@syzkaller.appspotmail.com \ --cc=syzkaller-bugs@googlegroups.com \ --cc=viro@zeniv.linux.org.uk \ --cc=walters@verbum.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).