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: <5a2uq4p74ilwtgnq47qlceiwceyttx7zqgovn7ph3jyuaf2dlm@2rqzwizdamdc>
Date: Thu, 24 Oct 2024 07:30:12 -0400
From: Kent Overstreet <kent.overstreet@...ux.dev>
To: Hongbo Li <lihongbo22@...wei.com>
Cc: Jeongjun Park <aha310510@...il.com>, mmpgouride@...il.com, 
	linux-bcachefs@...r.kernel.org, linux-kernel@...r.kernel.org, 
	syzbot+7f45fa9805c40db3f108@...kaller.appspotmail.com
Subject: Re: [PATCH v3] bcachefs: fix shift oob in alloc_lru_idx_fragmentation

On Tue, Oct 22, 2024 at 10:26:18AM +0800, Hongbo Li wrote:
> 
> 
> On 2024/10/21 23:43, Jeongjun Park wrote:
> > The size of a.data_type is set abnormally large, causing shift-out-of-bounds.
> > To fix this, we need to add validation on a.data_type in
> > alloc_lru_idx_fragmentation().
> > 
> > Reported-by: syzbot+7f45fa9805c40db3f108@...kaller.appspotmail.com
> > Fixes: 260af1562ec1 ("bcachefs: Kill alloc_v4.fragmentation_lru")
> > Signed-off-by: Jeongjun Park <aha310510@...il.com>
> > ---
> >   fs/bcachefs/alloc_background.h | 3 +++
> >   1 file changed, 3 insertions(+)
> > 
> > diff --git a/fs/bcachefs/alloc_background.h b/fs/bcachefs/alloc_background.h
> > index f8e87c6721b1..163a67b97a40 100644
> > --- a/fs/bcachefs/alloc_background.h
> > +++ b/fs/bcachefs/alloc_background.h
> > @@ -168,6 +168,9 @@ static inline bool data_type_movable(enum bch_data_type type)
> >   static inline u64 alloc_lru_idx_fragmentation(struct bch_alloc_v4 a,
> >   					      struct bch_dev *ca)
> >   {
> > +	if (a.data_type >= BCH_DATA_NR)
> > +		return 0;
> > +
> 
> oh, I found I have done the same thing in [1]("Re: [syzbot] [bcachefs?]
> UBSAN: shift-out-of-bounds in bch2_alloc_to_text"). But in my humble
> opinion, the validation changes also should be added. And in addition, move
> the condition about a.data_type into data_type_movable will be better. Just
> my personal opinion.:)

Unknown data types (and key types, btree IDs, etc.) are allowed for
forwards compatibility - they should just be ignored

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ