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: <AIMAXgAnDv8vtlWxuL6mq4q3.3.1619145657480.Hmail.frank.li@vivo.com>
Date:   Fri, 23 Apr 2021 10:40:57 +0800 (GMT+08:00)
From:   李扬韬 <frank.li@...o.com>
To:     Chao Yu <yuchao0@...wei.com>
Cc:     jaegeuk@...nel.org, chao@...nel.org,
        linux-f2fs-devel@...ts.sourceforge.net,
        linux-kernel@...r.kernel.org
Subject: Re:Re: [f2fs-dev] [PATCH] f2fs: set prefree as free segments after clear prefree segments

HI Chao,
 
>> For now, when do_checkpoint fails, the prefree bitmap is not cleared,
>> but these segments are already in the free state. If these segments
>> are used, the segments in use will be reset to the free state when
>> f2fs_clear_prefree_segments is called next time.
>> 
>> So move set_prefree_as_free_segments after clear_prefree_segments.
>
>That's not correct.
>
>/*
>  * Should call f2fs_clear_prefree_segments after checkpoint is done.
>  */
>static void set_prefree_as_free_segments(struct f2fs_sb_info *sbi)
>
>Comments above set_prefree_as_free_segments() should have told you
>the rule, otherwise if checkpoint failed, valid data in last valid
>checkpoint could be corrupted after segment reuse.

For do_checkpoint sucess:

f2fs_write_checkpoint
->f2fs_flush_sit_entries
    ->set_prefree_as_free_segments
->do_checkpoint
->f2fs_clear_prefree_segments


Calling set_prefree_as_free_segments when do_checkpoint fails,
seems to be incorrect. I think clear free bitmap should be after
clear prefree bitmap.

For do_checkpoint fail:

f2fs_write_checkpoint
->f2fs_flush_sit_entries
    ->set_prefree_as_free_segments
->do_checkpoint
->f2fs_release_discard_addrs

The prefree bitmap is not cleared, but free bitmap is cleared,which means
we can use these segments that are marked as free. When the free segments
is used, the next f2fs_clear_prefree_segments will mark prefree as free again,
causing some problem.

With this patch, for do_checkpoint fail:

f2fs_write_checkpoint
->f2fs_flush_sit_entries
->do_checkpoint
->f2fs_release_discard_addrs

At this time, we did not mark prefree as free segments, so these segments will not be used.

Thx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ