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]
Date:   Wed, 31 Jul 2019 21:11:15 +0200
From:   Pavel Machek <pavel@...x.de>
To:     pavel@....cz
Cc:     linux-kernel@...r.kernel.org, Ocean Chen <oceanchen@...gle.com>,
        Chao Yu <yuchao0@...wei.com>, Jaegeuk Kim <jaegeuk@...nel.org>,
        Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 4.19 077/113] f2fs: avoid out-of-range memory access

Hi!

> [ Upstream commit 56f3ce675103e3fb9e631cfb4131fc768bc23e9a ]
> 
> blkoff_off might over 512 due to fs corrupt or security
> vulnerability. That should be checked before being using.
> 
> Use ENTRIES_IN_SUM to protect invalid value in cur_data_blkoff.
> 
> Signed-off-by: Ocean Chen <oceanchen@...gle.com>
> Reviewed-by: Chao Yu <yuchao0@...wei.com>
> Signed-off-by: Jaegeuk Kim <jaegeuk@...nel.org>
> Signed-off-by: Sasha Levin <sashal@...nel.org>
> ---
>  fs/f2fs/segment.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 8fc3edb6760c..92f72bb5aff4 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -3261,6 +3261,11 @@ static int read_compacted_summaries(struct f2fs_sb_info *sbi)
>  		seg_i = CURSEG_I(sbi, i);
>  		segno = le32_to_cpu(ckpt->cur_data_segno[i]);
>  		blk_off = le16_to_cpu(ckpt->cur_data_blkoff[i]);
> +		if (blk_off > ENTRIES_IN_SUM) {
> +			f2fs_bug_on(sbi, 1);
> +			f2fs_put_page(page, 1);
> +			return -EFAULT;
> +		}
>  		seg_i->next_segno = segno;

We normally use -EUCLEAN to signal filesystem corruption. Plus, it is
good idea to report it to the syslog and mark filesystem as "needing
fsck" if filesystem can do that.

Thanks,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ