* [syzbot] [bcachefs?] WARNING in bch2_fs_journal_stop
@ 2024-07-17 4:30 syzbot
2024-07-17 21:33 ` [syzbot] [PATCH] bcachefs: " syzbot
2024-08-22 16:59 ` [syzbot] [bcachefs?] " Kent Overstreet
0 siblings, 2 replies; 4+ messages in thread
From: syzbot @ 2024-07-17 4:30 UTC (permalink / raw)
To: bfoster, kent.overstreet, linux-bcachefs, linux-kernel,
syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: 975f3b6da180 Merge tag 'for-6.10-rc7-tag' of git://git.ker..
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=11b17221980000
kernel config: https://syzkaller.appspot.com/x/.config?x=42a432cfd0e579e0
dashboard link: https://syzkaller.appspot.com/bug?extid=4093905737cf289b6b38
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17460766980000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=130028f6980000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/62ced967be02/disk-975f3b6d.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/c237fa04e1d4/vmlinux-975f3b6d.xz
kernel image: https://storage.googleapis.com/syzbot-assets/47f6105ecbe2/bzImage-975f3b6d.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/02b246be7736/mount_0.gz
The issue was bisected to:
commit f7643bc9749f270d487c32dc35b578575bf1adb0
Author: Kent Overstreet <kent.overstreet@linux.dev>
Date: Wed Apr 17 05:26:02 2024 +0000
bcachefs: make btree read errors silent during scan
bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=10381495980000
final oops: https://syzkaller.appspot.com/x/report.txt?x=12381495980000
console output: https://syzkaller.appspot.com/x/log.txt?x=14381495980000
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+4093905737cf289b6b38@syzkaller.appspotmail.com
Fixes: f7643bc9749f ("bcachefs: make btree read errors silent during scan")
bcachefs (loop0): flushing journal and stopping allocators, journal seq 13
bcachefs (loop0): flushing journal and stopping allocators complete, journal seq 13
------------[ cut here ]------------
journal shutdown error: cur seq 13 but last empty seq 14
WARNING: CPU: 0 PID: 5081 at fs/bcachefs/journal.c:1191 bch2_fs_journal_stop+0x5f3/0x630 fs/bcachefs/journal.c:1187
Modules linked in:
CPU: 0 PID: 5081 Comm: syz-executor334 Not tainted 6.10.0-rc7-syzkaller-00244-g975f3b6da180 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024
RIP: 0010:bch2_fs_journal_stop+0x5f3/0x630 fs/bcachefs/journal.c:1187
Code: 44 24 18 42 80 3c 20 00 48 8b 5c 24 20 74 08 48 89 df e8 20 a2 c7 fd 48 8b 13 48 c7 c7 a0 34 13 8c 4c 89 f6 e8 8e 51 27 fd 90 <0f> 0b 90 90 e9 e4 fe ff ff 44 89 f1 80 e1 07 38 c1 0f 8c 7f fc ff
RSP: 0018:ffffc90003cc7780 EFLAGS: 00010246
RAX: 9ce99195b516ba00 RBX: ffff8880772caaa0 RCX: ffff88801ab3bc00
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc90003cc78c0 R08: ffffffff815857a2 R09: 1ffff1101728519a
R10: dffffc0000000000 R11: ffffed101728519b R12: dffffc0000000000
R13: ffff8880772ca440 R14: 000000000000000d R15: 1ffff1100ee59488
FS: 000055557822d380(0000) GS:ffff8880b9400000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffd538a8b68 CR3: 000000002bf54000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__bch2_fs_read_only+0x30c/0x430 fs/bcachefs/super.c:291
bch2_fs_read_only+0xb52/0x1210 fs/bcachefs/super.c:356
__bch2_fs_stop+0x105/0x540 fs/bcachefs/super.c:617
generic_shutdown_super+0x136/0x2d0 fs/super.c:642
bch2_kill_sb+0x41/0x50 fs/bcachefs/fs.c:2052
deactivate_locked_super+0xc4/0x130 fs/super.c:473
cleanup_mnt+0x41f/0x4b0 fs/namespace.c:1267
task_work_run+0x24f/0x310 kernel/task_work.c:180
ptrace_notify+0x2d2/0x380 kernel/signal.c:2402
ptrace_report_syscall include/linux/ptrace.h:415 [inline]
ptrace_report_syscall_exit include/linux/ptrace.h:477 [inline]
syscall_exit_work+0xc6/0x190 kernel/entry/common.c:173
syscall_exit_to_user_mode_prepare kernel/entry/common.c:200 [inline]
__syscall_exit_to_user_mode_work kernel/entry/common.c:205 [inline]
syscall_exit_to_user_mode+0x273/0x360 kernel/entry/common.c:218
do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fa2d3adf307
Code: 08 00 48 83 c4 08 5b 5d c3 66 2e 0f 1f 84 00 00 00 00 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007ffd538a9318 EFLAGS: 00000206 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007fa2d3adf307
RDX: 0000000000000000 RSI: 0000000000000009 RDI: 00007ffd538a93d0
RBP: 00007ffd538a93d0 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000ffffffff R11: 0000000000000206 R12: 00007ffd538aa430
R13: 000055557822e6c0 R14: 0000000000000001 R15: 431bde82d7b634db
</TASK>
---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [syzbot] [PATCH] bcachefs: WARNING in bch2_fs_journal_stop 2024-07-17 4:30 [syzbot] [bcachefs?] WARNING in bch2_fs_journal_stop syzbot @ 2024-07-17 21:33 ` syzbot 2024-08-22 16:59 ` [syzbot] [bcachefs?] " Kent Overstreet 1 sibling, 0 replies; 4+ messages in thread From: syzbot @ 2024-07-17 21:33 UTC (permalink / raw) To: linux-kernel For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org. *** Subject: [PATCH] bcachefs: WARNING in bch2_fs_journal_stop Author: cam.alvarez.i@gmail.com #syz test last_seq and last_empty_seq suffered from an off by one error when the journal has no entries. The indexes were fixed and an assertion is added to check that the last_empty_seq is always kept under the next valid seq number. Signed-off-by: Camila Alvarez <cam.alvarez.i@gmail.com> --- fs/bcachefs/journal.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c index 10b19791ec98..7bbbf4b149e9 100644 --- a/fs/bcachefs/journal.c +++ b/fs/bcachefs/journal.c @@ -1201,7 +1201,7 @@ int bch2_fs_journal_start(struct journal *j, u64 cur_seq) struct journal_replay *i, **_i; struct genradix_iter iter; bool had_entries = false; - u64 last_seq = cur_seq, nr, seq; + u64 last_written_seq = cur_seq - 1, last_seq = cur_seq - 1, nr, seq; genradix_for_each_reverse(&c->journal_entries, iter, _i) { i = *_i; @@ -1209,11 +1209,11 @@ int bch2_fs_journal_start(struct journal *j, u64 cur_seq) if (journal_replay_ignore(i)) continue; - last_seq = le64_to_cpu(i->j.last_seq); + last_written_seq = le64_to_cpu(i->j.last_seq); break; } - nr = cur_seq - last_seq; + nr = cur_seq - last_written_seq; if (nr + 1 > j->pin.size) { free_fifo(&j->pin); @@ -1224,14 +1224,14 @@ int bch2_fs_journal_start(struct journal *j, u64 cur_seq) } } - j->replay_journal_seq = last_seq; + j->replay_journal_seq = last_written_seq; j->replay_journal_seq_end = cur_seq; - j->last_seq_ondisk = last_seq; - j->flushed_seq_ondisk = cur_seq - 1; - j->seq_ondisk = cur_seq - 1; - j->pin.front = last_seq; + j->last_seq_ondisk = last_written_seq; + j->flushed_seq_ondisk = last_seq; + j->seq_ondisk = last_seq; + j->pin.front = last_written_seq; j->pin.back = cur_seq; - atomic64_set(&j->seq, cur_seq - 1); + atomic64_set(&j->seq, last_seq); fifo_for_each_entry_ptr(p, &j->pin, seq) journal_pin_list_init(p, 1); @@ -1261,7 +1261,10 @@ int bch2_fs_journal_start(struct journal *j, u64 cur_seq) } if (!had_entries) - j->last_empty_seq = cur_seq; + j->last_empty_seq = last_seq; + + WARN(j->last_empty_seq >= cur_seq, "journal startup error: last empty seq %llu is higher or equal than the next seq number to be used (%llu)", + j->last_empty_seq, cur_seq); spin_lock(&j->lock); -- 2.34.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [syzbot] [bcachefs?] WARNING in bch2_fs_journal_stop 2024-07-17 4:30 [syzbot] [bcachefs?] WARNING in bch2_fs_journal_stop syzbot 2024-07-17 21:33 ` [syzbot] [PATCH] bcachefs: " syzbot @ 2024-08-22 16:59 ` Kent Overstreet 1 sibling, 0 replies; 4+ messages in thread From: Kent Overstreet @ 2024-08-22 16:59 UTC (permalink / raw) To: syzbot; +Cc: bfoster, linux-bcachefs, linux-kernel, syzkaller-bugs #syz fix: bcachefs: Fix warning in bch2_fs_journal_stop() ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <20240717213200.1245905-1-cam.alvarez.i@gmail.com>]
* Re: [syzbot] [bcachefs?] WARNING in bch2_fs_journal_stop [not found] <20240717213200.1245905-1-cam.alvarez.i@gmail.com> @ 2024-07-17 22:02 ` syzbot 0 siblings, 0 replies; 4+ messages in thread From: syzbot @ 2024-07-17 22:02 UTC (permalink / raw) To: cam.alvarez.i, linux-kernel, syzkaller-bugs Hello, syzbot has tested the proposed patch and the reproducer did not trigger any issue: Reported-by: syzbot+4093905737cf289b6b38@syzkaller.appspotmail.com Tested-by: syzbot+4093905737cf289b6b38@syzkaller.appspotmail.com Tested on: commit: e2f710f9 Merge tag 'ata-6.11-rc1' of git://git.kernel... git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=131258ce980000 kernel config: https://syzkaller.appspot.com/x/.config?x=a2f87f8b8afcec45 dashboard link: https://syzkaller.appspot.com/bug?extid=4093905737cf289b6b38 compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40 patch: https://syzkaller.appspot.com/x/patch.diff?x=168ee43d980000 Note: testing is done by a robot and is best-effort only. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-08-22 16:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-17 4:30 [syzbot] [bcachefs?] WARNING in bch2_fs_journal_stop syzbot
2024-07-17 21:33 ` [syzbot] [PATCH] bcachefs: " syzbot
2024-08-22 16:59 ` [syzbot] [bcachefs?] " Kent Overstreet
[not found] <20240717213200.1245905-1-cam.alvarez.i@gmail.com>
2024-07-17 22:02 ` syzbot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox