On Mon, Oct 21, 2024 at 10:18:57PM +0530, Manas via B4 Relay wrote: > From: Manas <[email protected]> > > This reverts commit 60f2b1bcf519416dbffee219132aa949d0c39d0e. > > This syzbot bug[1] is triggered due to the BUG_ON assertions added in > __bch2_dev_btree_bitmap_mark. During runtime, m->btree_bitmap_shift is > 63 '?'. This triggers both the assertions.
The BUG_ON() doesn't need to be deleted; we just need to fix the validation so it doesn't fire (it doesn't particularly matter if it's removed or not, ubsan would catch it without the BUG_ON()). I believe 57 is correct, 64 - (2^6, which is 64, i.e. size of the btree bitmap), but >= 58 would have been better. > > Reverting the commit does not reproduce the said bug. > > [1] https://syzkaller.appspot.com/bug?extid=e8eff054face85d7ea41 > > Signed-off-by: Manas <[email protected]> > Reported-by: [email protected] > Closes: https://syzkaller.appspot.com/bug?extid=e8eff054face85d7ea41 > --- > This syzbot bug[1] is triggered due to the BUG_ON assertions added in > __bch2_dev_btree_bitmap_mark. During runtime, m->btree_bitmap_shift is > 63 '?'. This triggers both the assertions. > > I am unfamiliar with the codebase, and there wasn't a lore discussion > about the assertions in the commit, so I am unsure about the relevance > of these assertions. > > Reverting the commit does not reproduce the said bug. > > [1] https://syzkaller.appspot.com/bug?extid=e8eff054face85d7ea41 > --- > fs/bcachefs/sb-members.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/fs/bcachefs/sb-members.c b/fs/bcachefs/sb-members.c > index > fb08dd680dacf82bca414f424024e4a00bf432de..9790fd47338c46d2af30547e1f41a1e578b71aa4 > 100644 > --- a/fs/bcachefs/sb-members.c > +++ b/fs/bcachefs/sb-members.c > @@ -450,9 +450,6 @@ static void __bch2_dev_btree_bitmap_mark(struct > bch_sb_field_members_v2 *mi, uns > m->btree_bitmap_shift += resize; > } > > - BUG_ON(m->btree_bitmap_shift > 57); > - BUG_ON(end > 64ULL << m->btree_bitmap_shift); > - > for (unsigned bit = start >> m->btree_bitmap_shift; > (u64) bit << m->btree_bitmap_shift < end; > bit++) > > --- > base-commit: 42f7652d3eb527d03665b09edac47f85fb600924 > change-id: 20241021-revert-assert-bch2-25474fe809d1 > > Best regards, > -- > Manas <[email protected]> > >
