[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <rr2rkewhp7c4fcewi5mlpda44cjikwfuycrgaplpk53vgrp5vp@q7sj5mlnkm5c>
Date: Sun, 8 Sep 2024 10:14:27 -0400
From: Kent Overstreet <kent.overstreet@...ux.dev>
To: Edward Adam Davis <eadavis@...com>
Cc: linux-bcachefs@...r.kernel.org, linux-kernel@...r.kernel.org,
syzbot+064ce437a1ad63d3f6ef@...kaller.appspotmail.com, syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [bcachefs?] UBSAN: shift-out-of-bounds in member_to_text
On Sun, Sep 08, 2024 at 08:59:37PM GMT, Edward Adam Davis wrote:
> On Wed, 4 Sep 2024 15:39:37 -0400, Kent Overstreet wrote:
> > On Tue, Sep 03, 2024 at 10:13:02AM GMT, Edward Adam Davis wrote:
> > > Because the value of m.btree_bitmap_shift is 69 in this case, it cause
> > > shift-out-of-bounds in member_to_text.
> > >
> > > Add a check for btree_bitmap_shift in validate_member, when it bigger than 64
> > > return -BCH_ERR_invalid_sb_members.
> > > Simultaneously adjust the output mode of btree_bitmap_shift in member_to_text.
> > >
> > > #syz test
> > >
> > > diff --git a/fs/bcachefs/sb-members.c b/fs/bcachefs/sb-members.c
> > > index 39196f2a4197..85a4245ea6a3 100644
> > > --- a/fs/bcachefs/sb-members.c
> > > +++ b/fs/bcachefs/sb-members.c
> > > @@ -162,6 +162,12 @@ static int validate_member(struct printbuf *err,
> > > return -BCH_ERR_invalid_sb_members;
> > > }
> > >
> > > + if (m.btree_bitmap_shift > 64) {
> >
> > should be >=, no?
> Yes, you are right, here should be "if (m.btree_bitmap_shift >= 64)"
Send me a proper patch and I'll apply...
Powered by blists - more mailing lists