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:   Tue, 17 Apr 2018 23:14:09 -0600
From:   Andreas Dilger <adilger@...ger.ca>
To:     Wang Shilong <wangshilong1991@...il.com>
Cc:     Ext4 Developers List <linux-ext4@...r.kernel.org>,
        Liu Bo <bo.liu@...ux.alibaba.com>,
        Wang Shilong <wshilong@....com>,
        Shuichi Ihara <sihara@....com>, tytso@....edu
Subject: Re: [PATCH 4/4] ext4: mark block bitmap corrupted when found

On Apr 17, 2018, at 6:08 PM, Wang Shilong <wangshilong1991@...il.com> wrote:
> 
> From: Wang Shilong <wshilong@....com>
> 
> There are still some cases that we missed to set
> block bitmaps corrupted bit properly:
> 
> 1) block bitmap number is wrong.
> 2) failed to read block bitmap due to disk errors.
> 3) double free block bitmaps..
> 4) some mismatch check with bitmaps vs buddy information.
> 
> Suggested-by: Theodore Y. Ts'o <tytso@....edu>
> Signed-off-by: Liu Bo <bo.liu@...ux.alibaba.com>
> Signed-off-by: Wang Shilong <wshilong@....com>

Reviewed-by: Andreas Dilger <adilger@...ger.ca>

> ---
> fs/ext4/balloc.c  | 4 ++++
> fs/ext4/mballoc.c | 6 ++++++
> 2 files changed, 10 insertions(+)
> 
> diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
> index 0ac442aff7b8..8ef65251d019 100644
> --- a/fs/ext4/balloc.c
> +++ b/fs/ext4/balloc.c
> @@ -420,6 +420,8 @@ ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group)
> 	    (bitmap_blk >= ext4_blocks_count(sbi->s_es))) {
> 		ext4_error(sb, "Invalid block bitmap block %llu in "
> 			   "block_group %u", bitmap_blk, block_group);
> +		ext4_mark_group_bitmap_corrupted(sb, block_group,
> +					EXT4_GROUP_INFO_BBITMAP_CORRUPT);
> 		return ERR_PTR(-EFSCORRUPTED);
> 	}
> 	bh = sb_getblk(sb, bitmap_blk);
> @@ -498,6 +500,8 @@ int ext4_wait_block_bitmap(struct super_block *sb, ext4_group_t block_group,
> 		ext4_error(sb, "Cannot read block bitmap - "
> 			   "block_group = %u, block_bitmap = %llu",
> 			   block_group, (unsigned long long) bh->b_blocknr);
> +		ext4_mark_group_bitmap_corrupted(sb, block_group,
> +					EXT4_GROUP_INFO_BBITMAP_CORRUPT);
> 		return -EIO;
> 	}
> 	clear_buffer_new(bh);
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index bc2d1eb9fd5d..0d473991eebd 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -470,6 +470,8 @@ static void mb_free_blocks_double(struct inode *inode, struct ext4_buddy *e4b,
> 					      "freeing block already freed "
> 					      "(bit %u)",
> 					      first + i);
> +			ext4_mark_group_bitmap_corrupted(sb, e4b->bd_group,
> +					EXT4_GROUP_INFO_BBITMAP_CORRUPT);
> 		}
> 		mb_clear_bit(first + i, e4b->bd_info->bb_bitmap);
> 	}
> @@ -1950,6 +1952,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac,
> 					"%d free clusters as per "
> 					"group info. But bitmap says 0",
> 					free);
> +			ext4_mark_group_bitmap_corrupted(sb, e4b->bd_group,
> +					EXT4_GROUP_INFO_BBITMAP_CORRUPT);
> 			break;
> 		}
> 
> @@ -1960,6 +1964,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac,
> 					"%d free clusters as per "
> 					"group info. But got %d blocks",
> 					free, ex.fe_len);
> +			ext4_mark_group_bitmap_corrupted(sb, e4b->bd_group,
> +					EXT4_GROUP_INFO_BBITMAP_CORRUPT);
> 			/*
> 			 * The number of free blocks differs. This mostly
> 			 * indicate that the bitmap is corrupt. So exit
> --
> 2.14.3
> 


Cheers, Andreas






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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ