lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_6FF377237A096263A9C4469779777566C805@qq.com>
Date: Sun,  8 Sep 2024 20:59:37 +0800
From: Edward Adam Davis <eadavis@...com>
To: kent.overstreet@...ux.dev
Cc: eadavis@...com,
	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 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)"
> 
> > +		prt_printf(err, "device %u: too many big bitmap shift (got %u, max 64)",
> > +			   i, m.btree_bitmap_shift);
> > +		return -BCH_ERR_invalid_sb_members;
> > +	}
> > +
> >  	return 0;
> >  }
> >
> > @@ -245,8 +251,7 @@ static void member_to_text(struct printbuf *out,
> >  		prt_printf(out, "(none)");
> >  	prt_newline(out);
> >
> > -	prt_printf(out, "Btree allocated bitmap blocksize:\t");
> > -	prt_units_u64(out, 1ULL << m.btree_bitmap_shift);
> > +	prt_printf(out, "Btree allocated bitmap shift: %d\t", m.btree_bitmap_shift);
> >  	prt_newline(out);
> >
> >  	prt_printf(out, "Btree allocated bitmap:\t");

BR,
Edward


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ