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:   Fri, 8 Oct 2021 17:02:36 +0800
From:   Zhang Yi <yi.zhang@...wei.com>
To:     Theodore Ts'o <tytso@....edu>
CC:     <linux-ext4@...r.kernel.org>, <adilger.kernel@...ger.ca>,
        <jack@...e.cz>, <yukuai3@...wei.com>
Subject: Re: [RFC PATCH 2/3] ext4: check for inconsistent extents between
 index and leaf block

On 2021/10/8 0:37, Theodore Ts'o wrote:
> On Wed, Sep 08, 2021 at 08:08:49PM +0800, Zhang Yi wrote:
>> Now that we can check out overlapping extents in leaf block and
>> out-of-order index extents in index block. But the .ee_block in the
>> first extent of one leaf block should equal to the .ei_block in it's
>> parent index extent entry.
> 
> I don't believe this is always guaranteed.
> 
> The punch hole operation can remove some or part of the first entry in
> the leaf block, and it won't update the parent index.  So it's OK for
> the first entry of the leaf block to be greater than entry in the
> parent block.  However, if the first entry of the leaf block is less
> than the entry in the parent block, that's definitely going to be a
> problem.
> 

Hi, Ted.

ext4_punch_hole()->ext4_ext_remove_space()->ext4_ext_rm_leaf() call
ext4_ext_correct_indexes() or ext4_ext_rm_idx() to update the parent index
if the removing extent entry is the first entry of the leaf block.

static int
ext4_ext_rm_leaf(handle_t *handle, struct inode *inode,
                 struct ext4_ext_path *path,
                 struct partial_cluster *partial,
                 ext4_lblk_t start, ext4_lblk_t end)
{
...
                if (ex == EXT_FIRST_EXTENT(eh)) {
                        correct_index = 1;
...
        if (correct_index && eh->eh_entries)
                err = ext4_ext_correct_indexes(handle, inode, path);
...
}

static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode,
                        struct ext4_ext_path *path, int depth)
{
...
        while (--depth >= 0) {
...
                path->p_idx->ei_block = (path+1)->p_idx->ei_block;
...
        }
...
}

And the fsck does also check the mismatch case in scan_extent_node(), am I
missing something?

Thanks,
Yi.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ