* [syzbot] [bcachefs?] kernel BUG in bch2_fs_journal_stop
@ 2024-05-13 18:26 syzbot
2024-05-16 1:53 ` [syzbot] [PATCH] bcachefs: fix last_seq and last_empty_seq in bch2_fs_journal_start() syzbot
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: syzbot @ 2024-05-13 18:26 UTC (permalink / raw)
To: bfoster, kent.overstreet, linux-bcachefs, linux-kernel,
syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: 75fa778d74b7 Add linux-next specific files for 20240510
git tree: linux-next
console+strace: https://syzkaller.appspot.com/x/log.txt?x=16f304e0980000
kernel config: https://syzkaller.appspot.com/x/.config?x=ccdd3ebd6715749a
dashboard link: https://syzkaller.appspot.com/bug?extid=10b936c5eaee2819b49b
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=106348cc980000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=129c8d24980000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/ad9391835bcf/disk-75fa778d.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/d827b3da9a26/vmlinux-75fa778d.xz
kernel image: https://storage.googleapis.com/syzbot-assets/8f32f0182388/bzImage-75fa778d.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/0d3a8c7d1a82/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=114323b8980000
final oops: https://syzkaller.appspot.com/x/report.txt?x=134323b8980000
console output: https://syzkaller.appspot.com/x/log.txt?x=154323b8980000
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+10b936c5eaee2819b49b@syzkaller.appspotmail.com
Fixes: f7643bc9749f ("bcachefs: make btree read errors silent during scan")
bcachefs (loop0): finished waiting for writes to stop
bcachefs (loop0): flushing journal and stopping allocators, journal seq 13
bcachefs (loop0): flushing journal and stopping allocators complete, journal seq 13
------------[ cut here ]------------
kernel BUG at fs/bcachefs/journal.c:1186!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
CPU: 1 PID: 5092 Comm: syz-executor214 Not tainted 6.9.0-rc7-next-20240510-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
RIP: 0010:bch2_fs_journal_stop+0x516/0x520 fs/bcachefs/journal.c:1184
Code: f0 fe ff ff 44 89 f9 80 e1 07 38 c1 0f 8c 2f fd ff ff 4c 89 ff e8 6a e0 c6 fd e9 22 fd ff ff e8 d0 89 55 07 e8 4b 28 61 fd 90 <0f> 0b 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90
RSP: 0018:ffffc90002e77700 EFLAGS: 00010293
RAX: ffffffff8434f435 RBX: 000000000000000d RCX: ffff888022765a00
RDX: 0000000000000000 RSI: 000000000000000d RDI: 000000000000000e
RBP: ffffc90002e77840 R08: ffffffff8434f3f6 R09: 1ffff1100eca957f
R10: dffffc0000000000 R11: ffffed100eca9580 R12: ffff88807654a5c0
R13: dffffc0000000000 R14: 000000000000000e R15: 1ffff1100eca94b8
FS: 0000000000000000(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fb5a6b89130 CR3: 000000007abe8000 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:613
generic_shutdown_super+0x136/0x2d0 fs/super.c:642
bch2_kill_sb+0x41/0x50 fs/bcachefs/fs.c:2026
deactivate_locked_super+0xc4/0x130 fs/super.c:473
cleanup_mnt+0x426/0x4c0 fs/namespace.c:1267
task_work_run+0x24f/0x310 kernel/task_work.c:180
exit_task_work include/linux/task_work.h:38 [inline]
do_exit+0xa27/0x27e0 kernel/exit.c:874
do_group_exit+0x207/0x2c0 kernel/exit.c:1023
__do_sys_exit_group kernel/exit.c:1034 [inline]
__se_sys_exit_group kernel/exit.c:1032 [inline]
__x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1032
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fb5a6b00749
Code: Unable to access opcode bytes at 0x7fb5a6b0071f.
RSP: 002b:00007ffc012e1a88 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007fb5a6b00749
RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000001
RBP: 00007fb5a6b8b2b0 R08: ffffffffffffffb8 R09: 000000000000f626
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fb5a6b8b2b0
R13: 0000000000000000 R14: 00007fb5a6b8c020 R15: 00007fb5a6acec80
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:bch2_fs_journal_stop+0x516/0x520 fs/bcachefs/journal.c:1184
Code: f0 fe ff ff 44 89 f9 80 e1 07 38 c1 0f 8c 2f fd ff ff 4c 89 ff e8 6a e0 c6 fd e9 22 fd ff ff e8 d0 89 55 07 e8 4b 28 61 fd 90 <0f> 0b 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90
RSP: 0018:ffffc90002e77700 EFLAGS: 00010293
RAX: ffffffff8434f435 RBX: 000000000000000d RCX: ffff888022765a00
RDX: 0000000000000000 RSI: 000000000000000d RDI: 000000000000000e
RBP: ffffc90002e77840 R08: ffffffff8434f3f6 R09: 1ffff1100eca957f
R10: dffffc0000000000 R11: ffffed100eca9580 R12: ffff88807654a5c0
R13: dffffc0000000000 R14: 000000000000000e R15: 1ffff1100eca94b8
FS: 0000000000000000(0000) GS:ffff8880b9400000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005639ea5a3b68 CR3: 000000007abe8000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
---
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: fix last_seq and last_empty_seq in bch2_fs_journal_start()
2024-05-13 18:26 [syzbot] [bcachefs?] kernel BUG in bch2_fs_journal_stop syzbot
@ 2024-05-16 1:53 ` syzbot
2024-05-20 2:34 ` [syzbot] [PATCH v2] " syzbot
2024-08-22 17:00 ` [syzbot] [bcachefs?] kernel BUG in bch2_fs_journal_stop Kent Overstreet
2 siblings, 0 replies; 4+ messages in thread
From: syzbot @ 2024-05-16 1:53 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: [PATCH] bcachefs: fix last_seq and last_empty_seq in bch2_fs_journal_start()
Author: cam.alvarez.i@gmail.com
#syz test
Values were left as the next possible sequence number when there were no
entries.
The fix involves updating the last_seq initial value and
setting last_empty_seq to cur_seq - 1.
Signed-off-by: Camila Alvarez <cam.alvarez.i@gmail.com>
---
fs/bcachefs/journal.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c
index adec8e1ea73e..3835c458eec9 100644
--- a/fs/bcachefs/journal.c
+++ b/fs/bcachefs/journal.c
@@ -1196,7 +1196,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_seq = cur_seq - 1, nr, seq;
genradix_for_each_reverse(&c->journal_entries, iter, _i) {
i = *_i;
@@ -1256,7 +1256,7 @@ int bch2_fs_journal_start(struct journal *j, u64 cur_seq)
}
if (!had_entries)
- j->last_empty_seq = cur_seq;
+ j->last_empty_seq = cur_seq - 1;
spin_lock(&j->lock);
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [syzbot] [PATCH v2] bcachefs: fix last_seq and last_empty_seq in bch2_fs_journal_start()
2024-05-13 18:26 [syzbot] [bcachefs?] kernel BUG in bch2_fs_journal_stop syzbot
2024-05-16 1:53 ` [syzbot] [PATCH] bcachefs: fix last_seq and last_empty_seq in bch2_fs_journal_start() syzbot
@ 2024-05-20 2:34 ` syzbot
2024-08-22 17:00 ` [syzbot] [bcachefs?] kernel BUG in bch2_fs_journal_stop Kent Overstreet
2 siblings, 0 replies; 4+ messages in thread
From: syzbot @ 2024-05-20 2:34 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: [PATCH v2] bcachefs: fix last_seq and last_empty_seq in bch2_fs_journal_start()
Author: cam.alvarez.i@gmail.com
#syz test
Values were left as the next possible sequence number when there were no
entries.
The fix involves updating the last_seq initial value and
setting last_empty_seq to cur_seq - 1.
Signed-off-by: Camila Alvarez <cam.alvarez.i@gmail.com>
---
fs/bcachefs/journal.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c
index adec8e1ea73e..99fc32f0382d 100644
--- a/fs/bcachefs/journal.c
+++ b/fs/bcachefs/journal.c
@@ -1195,8 +1195,8 @@ int bch2_fs_journal_start(struct journal *j, u64 cur_seq)
struct journal_entry_pin_list *p;
struct journal_replay *i, **_i;
struct genradix_iter iter;
- bool had_entries = false;
- u64 last_seq = cur_seq, nr, seq;
+ bool had_entries = false;
+ 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;
@@ -1204,11 +1204,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);
@@ -1219,14 +1219,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);
@@ -1256,7 +1256,7 @@ 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;
spin_lock(&j->lock);
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [syzbot] [bcachefs?] kernel BUG in bch2_fs_journal_stop
2024-05-13 18:26 [syzbot] [bcachefs?] kernel BUG in bch2_fs_journal_stop syzbot
2024-05-16 1:53 ` [syzbot] [PATCH] bcachefs: fix last_seq and last_empty_seq in bch2_fs_journal_start() syzbot
2024-05-20 2:34 ` [syzbot] [PATCH v2] " syzbot
@ 2024-08-22 17:00 ` Kent Overstreet
2 siblings, 0 replies; 4+ messages in thread
From: Kent Overstreet @ 2024-08-22 17:00 UTC (permalink / raw)
To: syzbot; +Cc: bfoster, linux-bcachefs, linux-kernel, syzkaller-bugs
#syz fix: bcachefs: Change bch2_fs_journal_stop() BUG_ON() to warning
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-08-22 17:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-13 18:26 [syzbot] [bcachefs?] kernel BUG in bch2_fs_journal_stop syzbot
2024-05-16 1:53 ` [syzbot] [PATCH] bcachefs: fix last_seq and last_empty_seq in bch2_fs_journal_start() syzbot
2024-05-20 2:34 ` [syzbot] [PATCH v2] " syzbot
2024-08-22 17:00 ` [syzbot] [bcachefs?] kernel BUG in bch2_fs_journal_stop Kent Overstreet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox