Linux 9p file system development
 help / color / mirror / Atom feed
* Re: [syzbot] [netfs?] kernel BUG in folio_unlock (3)
       [not found] <67b75198.050a0220.14d86d.02e2.GAE@google.com>
@ 2025-02-20 16:15 ` Matthew Wilcox
  2025-02-20 22:05   ` Dominique Martinet
  2025-05-31 23:20 ` syzbot
  1 sibling, 1 reply; 5+ messages in thread
From: Matthew Wilcox @ 2025-02-20 16:15 UTC (permalink / raw)
  To: syzbot
  Cc: Dominique Martinet, v9fs, dhowells, jlayton, linux-fsdevel,
	linux-kernel, netfs, syzkaller-bugs

On Thu, Feb 20, 2025 at 08:00:24AM -0800, syzbot wrote:
> ------------[ cut here ]------------
> kernel BUG at mm/filemap.c:1499!

Tried to unlock a folio that wasn't locked.

The entire log is interesting:

https://syzkaller.appspot.com/x/log.txt?x=12af2fdf980000

It injects a failure which hits p9_tag_alloc() (so adding the 9p people
to the cc)

The page dump is:

 page: refcount:1 mapcount:0 mapping:ffff888035b30890 index:0x0 pfn:0x37e9a
 memcg:ffff88801c6be000
 aops:v9fs_addr_operations ino:2721d72 dentry name(?):"file0"
 flags: 0xfff20000000020(lru|node=0|zone=1|lastcpupid=0x7ff)
 raw: 00fff20000000020 ffffea0000e1d1c8 ffff88801b0b31a0 ffff888035b30890
 raw: 0000000000000000 0000000000000000 00000001ffffffff ffff88801c6be000
 page dumped because: VM_BUG_ON_FOLIO(!folio_test_locked(folio))

> Call Trace:
>  <TASK>
>  netfs_perform_write+0xc04/0x2140 fs/netfs/buffered_write.c:400
>  netfs_buffered_write_iter_locked fs/netfs/buffered_write.c:445 [inline]
>  netfs_file_write_iter+0x494/0x550 fs/netfs/buffered_write.c:484
>  v9fs_file_write_iter+0x9b/0x100 fs/9p/vfs_file.c:407
>  new_sync_write fs/read_write.c:586 [inline]
>  vfs_write+0x5ae/0x1150 fs/read_write.c:679
>  ksys_write+0x12b/0x250 fs/read_write.c:731

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [syzbot] [netfs?] kernel BUG in folio_unlock (3)
  2025-02-20 16:15 ` [syzbot] [netfs?] kernel BUG in folio_unlock (3) Matthew Wilcox
@ 2025-02-20 22:05   ` Dominique Martinet
  0 siblings, 0 replies; 5+ messages in thread
From: Dominique Martinet @ 2025-02-20 22:05 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: syzbot, v9fs, dhowells, jlayton, linux-fsdevel, linux-kernel,
	netfs, syzkaller-bugs

Matthew Wilcox wrote on Thu, Feb 20, 2025 at 04:15:53PM +0000:
> On Thu, Feb 20, 2025 at 08:00:24AM -0800, syzbot wrote:
> > ------------[ cut here ]------------
> > kernel BUG at mm/filemap.c:1499!
> 
> Tried to unlock a folio that wasn't locked.
> 
> The entire log is interesting:
> 
> https://syzkaller.appspot.com/x/log.txt?x=12af2fdf980000
> 
> It injects a failure which hits p9_tag_alloc() (so adding the 9p people
> to the cc)

9p is calling iov_iter_revert() in p9_client_write() on failure, but at
this point of the failure copy_from_iter_full (which advanced the iter)
wasn't called yet because the format processing happens after
allocation...

This was changed by Al Viro in 2015 so it's a "fairly old" bug, but it's
a bug on 9p side alright - thanks for the cc

Now to figure out how to decide if we want to revert or not... I
honestly don't have any bright idea, but I don't know the iov API well
at all -- perhaps it's possible to copy without advancing and only
advance the iov if IO worked?

-- 
Dominique Martinet | Asmadeus

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [syzbot] [netfs?] kernel BUG in folio_unlock (3)
       [not found] <67b75198.050a0220.14d86d.02e2.GAE@google.com>
  2025-02-20 16:15 ` [syzbot] [netfs?] kernel BUG in folio_unlock (3) Matthew Wilcox
@ 2025-05-31 23:20 ` syzbot
  2025-06-01  0:26   ` Matthew Wilcox
  1 sibling, 1 reply; 5+ messages in thread
From: syzbot @ 2025-05-31 23:20 UTC (permalink / raw)
  To: asmadeus, chao, dhowells, hch, hdanton, jaegeuk, jlayton,
	linux-f2fs-devel, linux-fsdevel, linux-kernel, netfs,
	syzkaller-bugs, v9fs, willy

syzbot has bisected this issue to:

commit 80f31d2a7e5f4efa7150c951268236c670bcb068
Author: Christoph Hellwig <hch@lst.de>
Date:   Thu May 8 05:14:32 2025 +0000

    f2fs: return bool from __write_node_folio

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=1129d00c580000
start commit:   0f70f5b08a47 Merge tag 'pull-automount' of git://git.kerne..
git tree:       upstream
final oops:     https://syzkaller.appspot.com/x/report.txt?x=1329d00c580000
console output: https://syzkaller.appspot.com/x/log.txt?x=1529d00c580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=22765942f2e2ebcf
dashboard link: https://syzkaller.appspot.com/bug?extid=c0dc46208750f063d0e0
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=15bfe970580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=13bfe970580000

Reported-by: syzbot+c0dc46208750f063d0e0@syzkaller.appspotmail.com
Fixes: 80f31d2a7e5f ("f2fs: return bool from __write_node_folio")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [syzbot] [netfs?] kernel BUG in folio_unlock (3)
  2025-05-31 23:20 ` syzbot
@ 2025-06-01  0:26   ` Matthew Wilcox
  2025-06-11 14:08     ` Aleksandr Nogikh
  0 siblings, 1 reply; 5+ messages in thread
From: Matthew Wilcox @ 2025-06-01  0:26 UTC (permalink / raw)
  To: syzbot
  Cc: asmadeus, chao, dhowells, hch, hdanton, jaegeuk, jlayton,
	linux-f2fs-devel, linux-fsdevel, linux-kernel, netfs,
	syzkaller-bugs, v9fs

On Sat, May 31, 2025 at 04:20:02PM -0700, syzbot wrote:
> syzbot has bisected this issue to:
> 
> commit 80f31d2a7e5f4efa7150c951268236c670bcb068
> Author: Christoph Hellwig <hch@lst.de>
> Date:   Thu May 8 05:14:32 2025 +0000

That's not possible; this commit is after the original report.

That said, there _is_ a double folio_unlock() in this patch, which
I'm about to send a fix for.  It's just not fixing the original report.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [syzbot] [netfs?] kernel BUG in folio_unlock (3)
  2025-06-01  0:26   ` Matthew Wilcox
@ 2025-06-11 14:08     ` Aleksandr Nogikh
  0 siblings, 0 replies; 5+ messages in thread
From: Aleksandr Nogikh @ 2025-06-11 14:08 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: syzbot, asmadeus, chao, dhowells, hch, hdanton, jaegeuk, jlayton,
	linux-f2fs-devel, linux-fsdevel, linux-kernel, netfs,
	syzkaller-bugs, v9fs

On Sun, Jun 1, 2025 at 2:26 AM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Sat, May 31, 2025 at 04:20:02PM -0700, syzbot wrote:
> > syzbot has bisected this issue to:
> >
> > commit 80f31d2a7e5f4efa7150c951268236c670bcb068
> > Author: Christoph Hellwig <hch@lst.de>
> > Date:   Thu May 8 05:14:32 2025 +0000
>
> That's not possible; this commit is after the original report.
>
> That said, there _is_ a double folio_unlock() in this patch, which
> I'm about to send a fix for.  It's just not fixing the original report.
>

Thanks for bringing this up!
The underlying problem is that syzbot has merged several unrelated
kernel crashes into one bug report (`kernel BUG in folio_unlock` is
just a too generic title). The reported bisection result seems to be
correct, but it refers to only one of those incorrectly merged bugs.

I've just sent a fix for the syzbot's crash report parsing code [1].
It won't affect this specific bug report, but once the new code is
deployed, syzbot will re-report the two underlying findings
separately.

[1] https://github.com/google/syzkaller/pull/6081

-- 
Aleksandr

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-06-11 14:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <67b75198.050a0220.14d86d.02e2.GAE@google.com>
2025-02-20 16:15 ` [syzbot] [netfs?] kernel BUG in folio_unlock (3) Matthew Wilcox
2025-02-20 22:05   ` Dominique Martinet
2025-05-31 23:20 ` syzbot
2025-06-01  0:26   ` Matthew Wilcox
2025-06-11 14:08     ` Aleksandr Nogikh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox