From: Miklos Szeredi <miklos@szeredi.hu>
To: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Colin Walters <walters@verbum.org>,
syzbot <syzbot+d6ec23007e951dadf3de@syzkaller.appspotmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm <linux-mm@kvack.org>,
Miklos Szeredi <mszeredi@redhat.com>,
syzkaller-bugs <syzkaller-bugs@googlegroups.com>,
Al Viro <viro@zeniv.linux.org.uk>,
linux-unionfs@vger.kernel.org
Subject: Re: kernel BUG at mm/hugetlb.c:LINE!
Date: Fri, 22 May 2020 12:05:53 +0200 [thread overview]
Message-ID: <20200522100553.GE13131@miu.piliscsaba.redhat.com> (raw)
In-Reply-To: <78313ae9-8596-9cbe-f648-3152660be9b3@oracle.com>
On Wed, May 20, 2020 at 10:27:15AM -0700, Mike Kravetz wrote:
> I am fairly confident it is all about checking limits and alignment. The
> filesystem knows if it can/should align to base or huge page size. DAX has
> some interesting additional restrictions, and several 'traditional' filesystems
> check if they are 'on DAX'.
Okay, I haven't looked at DAX vs. overlay. I'm sure it's going to come up at
some point, if it hasn't already.
>
> In a previous e-mail, you suggested hugetlb_get_unmapped_area could do the
> length adjustment in hugetlb_get_unmapped_area (generic and arch specific).
> I agree, although there may be the need to add length overflow checks in
> these routines (after round up) as this is done in core code now. However,
> this can be done as a separate cleanup patch.
>
> In any case, we need to get the core mmap code to call filesystem specific
> get_unmapped_area if on a union/overlay. The patch I suggested does this
> by simply calling real_file to determine if there is a filesystem specific
> get_unmapped_area. The other approach would be to provide an overlayfs
> get_unmapped_area that calls the underlying filesystem get_unmapped_area.
That latter is what's done for all other stacked operations in overlayfs.
Untested patch below.
Thanks,
Miklos
---
fs/overlayfs/file.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
--- a/fs/overlayfs/file.c
+++ b/fs/overlayfs/file.c
@@ -757,6 +757,17 @@ static loff_t ovl_remap_file_range(struc
remap_flags, op);
}
+static unsigned long ovl_get_unmapped_area(struct file *file,
+ unsigned long uaddr, unsigned long len,
+ unsigned long pgoff, unsigned long flags)
+{
+ struct file *realfile = file->private_data;
+
+ return (realfile->f_op->get_unmapped_area ?:
+ current->mm->get_unmapped_area)(realfile,
+ uaddr, len, pgoff, flags);
+}
+
const struct file_operations ovl_file_operations = {
.open = ovl_open,
.release = ovl_release,
@@ -774,6 +785,7 @@ const struct file_operations ovl_file_op
.copy_file_range = ovl_copy_file_range,
.remap_file_range = ovl_remap_file_range,
+ .get_unmapped_area = ovl_get_unmapped_area,
};
int __init ovl_aio_request_cache_init(void)
next prev parent reply other threads:[~2020-05-22 10:06 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-06 3:06 kernel BUG at mm/hugetlb.c:LINE! syzbot
2020-04-06 22:05 ` Mike Kravetz
2020-05-12 15:04 ` Miklos Szeredi
2020-05-12 18:11 ` Mike Kravetz
2020-05-15 22:15 ` Mike Kravetz
2020-05-18 11:12 ` Miklos Szeredi
2020-05-18 23:22 ` Mike Kravetz
2020-05-18 23:41 ` Colin Walters
2020-05-19 0:35 ` Mike Kravetz
2020-05-20 11:20 ` Miklos Szeredi
2020-05-20 17:27 ` Mike Kravetz
2020-05-22 10:05 ` Miklos Szeredi [this message]
2020-05-28 0:01 ` Mike Kravetz
2020-05-28 8:37 ` [PATCH v2] ovl: provide real_file() and overlayfs get_unmapped_area() kbuild test robot
2020-05-28 21:01 ` Mike Kravetz
2020-06-04 9:16 ` Miklos Szeredi
2020-06-11 0:13 ` Mike Kravetz
2020-06-11 0:37 ` Al Viro
2020-06-11 1:36 ` Matthew Wilcox
2020-06-11 2:17 ` Al Viro
2020-06-11 2:31 ` Mike Kravetz
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=20200522100553.GE13131@miu.piliscsaba.redhat.com \
--to=miklos@szeredi.hu \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=mike.kravetz@oracle.com \
--cc=mszeredi@redhat.com \
--cc=syzbot+d6ec23007e951dadf3de@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=viro@zeniv.linux.org.uk \
--cc=walters@verbum.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: link
Be 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).