On Sun, Apr 12, 2020 at 12:17 PM Ritesh Harjani <riteshh@xxxxxxxxxxxxx> wrote: > > > > On 4/11/20 9:44 PM, Matthew Wilcox wrote: > > On Sat, Apr 11, 2020 at 12:39:13AM -0700, syzbot wrote: > >> The bug was bisected to: > >> > >> commit d3b6f23f71670007817a5d59f3fbafab2b794e8c > >> Author: Ritesh Harjani <riteshh@xxxxxxxxxxxxx> > >> Date: Fri Feb 28 09:26:58 2020 +0000 > >> > >> ext4: move ext4_fiemap to use iomap framework > >> > >> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=16c62a57e00000 > >> final crash: https://syzkaller.appspot.com/x/report.txt?x=15c62a57e00000 > >> console output: https://syzkaller.appspot.com/x/log.txt?x=11c62a57e00000 > >> > >> IMPORTANT: if you fix the bug, please add the following tag to the commit: > >> Reported-by: syzbot+77fa5bdb65cc39711820@xxxxxxxxxxxxxxxxxxxxxxxxx > >> Fixes: d3b6f23f7167 ("ext4: move ext4_fiemap to use iomap framework") > >> > >> ------------[ cut here ]------------ > >> WARNING: CPU: 0 PID: 7023 at fs/iomap/apply.c:51 iomap_apply+0xa0c/0xcb0 fs/iomap/apply.c:51 > > > > This is: > > > > if (WARN_ON(iomap.length == 0)) > > return -EIO; > > > > and the call trace contains ext4_fiemap() so the syzbot bisection looks > > correct. > > I think I know what could be going wrong here. > > So the problem happens when we have overlayfs mounted on top of ext4. > Now overlayfs might be supporting max logical filesize which is more > than what ext4 could support (i.e. sb->s_maxbytes for overlayfs must > be greater than compared to ext4). So that's why the check in func > ioctl_fiemap -> fiemap_check_ranges() couldn't truncate to logical > filesize which the actual underlying filesystem supports. > > @All, > Do you think we should make overlayfs also check for > fiemap_check_ranges()? Not as part of this fix, but as a later > addition to overlayfs? Please let me know, I could also make that patch. > Yes, I think that would be correct. Thanks, Amir.