[PATCH v2 0/2] btrfs: fix the length of reserved qgroup to free

iamhswang@gmail.com posted 2 patches 1 month ago
fs/btrfs/inode.c | 32 ++++++++++++++------------------
1 file changed, 14 insertions(+), 18 deletions(-)
[PATCH v2 0/2] btrfs: fix the length of reserved qgroup to free
Posted by iamhswang@gmail.com 1 month ago
From: Haisu Wang <haisuwang@tencent.com>

This patch set fixes the inconsistent region size of qgroup data.

The first patch ("btrfs: fix the length of reserved qgroup to free")
is enough to work together with the fix of CVE-2024-46733 to port
to all effected stable release branches.
The second patch is aim to make the reserved/alloced region more clear
to ease the error handling clean up. The start mark no longer advanced
in error handling, also the cur_alloc_size can represent the ram size
and dealloc area.

I am able to run fstest generic/475 for hundred times with quota enabled,
half of the tests modified by removing sleep time. About one tenth of
the tests are enter to the error handling process due to fail to reserve
extent. Though I didin't find a proper reproducer to enter all possible
error conditions to simulate alloc/checksum failure.

[CHANGELOG]
V2:
- Clear the alloc and error handling path and keep the start unchanged
- Patch ("btrfs: fix the length of reserved qgroup to free") unchanged
  to make CVE-2024-46733 related fix as simple as possible

V1:
Adjust the length of untouch region to free.
https://lore.kernel.org/linux-btrfs/20241008064849.1814829-1-haisuwang@tencent.com/T/#u

Haisu Wang (2):
  btrfs: fix the length of reserved qgroup to free
  btrfs: simplify regions mark and keep start unchanged in err handling

 fs/btrfs/inode.c | 32 ++++++++++++++------------------
 1 file changed, 14 insertions(+), 18 deletions(-)

-- 
2.43.5
Re: [PATCH v2 0/2] btrfs: fix the length of reserved qgroup to free
Posted by David Sterba 3 weeks, 5 days ago
On Fri, Oct 25, 2024 at 02:54:39PM +0800, iamhswang@gmail.com wrote:
> From: Haisu Wang <haisuwang@tencent.com>
> 
> This patch set fixes the inconsistent region size of qgroup data.
> 
> The first patch ("btrfs: fix the length of reserved qgroup to free")
> is enough to work together with the fix of CVE-2024-46733 to port
> to all effected stable release branches.
> The second patch is aim to make the reserved/alloced region more clear
> to ease the error handling clean up. The start mark no longer advanced
> in error handling, also the cur_alloc_size can represent the ram size
> and dealloc area.
> 
> I am able to run fstest generic/475 for hundred times with quota enabled,
> half of the tests modified by removing sleep time. About one tenth of
> the tests are enter to the error handling process due to fail to reserve
> extent. Though I didin't find a proper reproducer to enter all possible
> error conditions to simulate alloc/checksum failure.
> 
> [CHANGELOG]
> V2:
> - Clear the alloc and error handling path and keep the start unchanged
> - Patch ("btrfs: fix the length of reserved qgroup to free") unchanged
>   to make CVE-2024-46733 related fix as simple as possible
> 
> V1:
> Adjust the length of untouch region to free.
> https://lore.kernel.org/linux-btrfs/20241008064849.1814829-1-haisuwang@tencent.com/T/#u
> 
> Haisu Wang (2):
>   btrfs: fix the length of reserved qgroup to free
>   btrfs: simplify regions mark and keep start unchanged in err handling

Thanks, patches added to for-next, with some minor adjustments.