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: <apj4zcnnq5nwcly4mnl76uiuwibkzayqd3beeum3p436kycksf@co4yrhzxo7kl>
Date: Tue, 30 Jul 2024 20:52:49 -0400
From: Kent Overstreet <kent.overstreet@...ux.dev>
To: Edward Adam Davis <eadavis@...com>
Cc: syzbot+05d7520be047c9be86e0@...kaller.appspotmail.com, 
	linux-bcachefs@...r.kernel.org, linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com
Subject: Re: [PATCH] bcachefs: Add checks for entry's _data bytes

On Tue, Jul 30, 2024 at 12:10:19PM GMT, Edward Adam Davis wrote:
> syzbot report slab-out-of-bounds in journal_entry_dev_usage_to_text,
> it because vstruct_bytes(entry) smaller than sizeof(struct 
> jset_entry_dev_usage), overflow occurs when calculating the difference in
> jset_entry_dev_usage_nr_types(u).
> 
> Reported-by: syzbot+05d7520be047c9be86e0@...kaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=05d7520be047c9be86e0
> Signed-off-by: Edward Adam Davis <eadavis@...com>
> ---
>  fs/bcachefs/sb-clean.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/bcachefs/sb-clean.c b/fs/bcachefs/sb-clean.c
> index 47f10ab57f40..278e1a25159a 100644
> --- a/fs/bcachefs/sb-clean.c
> +++ b/fs/bcachefs/sb-clean.c
> @@ -310,6 +310,9 @@ static void bch2_sb_clean_to_text(struct printbuf *out, struct bch_sb *sb,
>  		    !entry->u64s)
>  			continue;
>  
> +		if (vstruct_bytes(entry) < sizeof(struct jset_entry_dev_usage))
> +			continue;

This is wrong: you haven't checked the entry type and you're assuming
it's a dev_usage entry.

The check should go in journal_entry_dev_usage_to_text().

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ