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  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 9 Apr 2021 01:54:08 -0500
From:   "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To:     "Darrick J. Wong" <djwong@...nel.org>
Cc:     "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        Dave Chinner <david@...morbit.com>, linux-xfs@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v3][next] xfs: Replace one-element arrays with
 flexible-array members


Hi!

I think I might have caught the issue:

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index e5e0713bebcd8..9231457371100 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1937,17 +1937,17 @@ xfs_init_zones(void)
 		goto out_destroy_trans_zone;

 	xfs_efd_zone = kmem_cache_create("xfs_efd_item",
-					(sizeof(struct xfs_efd_log_item) +
-					(XFS_EFD_MAX_FAST_EXTENTS - 1) *
-					sizeof(struct xfs_extent)),
-					0, 0, NULL);
+					 struct_size((struct xfs_efd_log_item *)0,
+					 efd_format.efd_extents,
+					 XFS_EFD_MAX_FAST_EXTENTS),
+					 0, 0, NULL);
 	if (!xfs_efd_zone)
 		goto out_destroy_buf_item_zone;

 	xfs_efi_zone = kmem_cache_create("xfs_efi_item",
-					 (sizeof(struct xfs_efi_log_item) +
-					 (XFS_EFI_MAX_FAST_EXTENTS - 1) *
-					 sizeof(struct xfs_extent)),
+					 struct_size((struct xfs_efi_log_item *)0,
+					 efi_format.efi_extents,
+					 XFS_EFI_MAX_FAST_EXTENTS),
 					 0, 0, NULL);
 	if (!xfs_efi_zone)
 		goto out_destroy_efd_zone;

I'm currently testing the patch with the fix above:

https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?h=testing/xfs-fixed

--
Gustavo

On 3/20/21 16:48, Darrick J. Wong wrote:
> On Sat, Mar 20, 2021 at 03:20:55PM -0500, Gustavo A. R. Silva wrote:
>>
>>
>> On 3/20/21 15:17, Darrick J. Wong wrote:
>>>>>> Below are the results of running xfstests for groups shutdown and log
>>>>>> with the following configuration in local.config:
>>>>>>
>>>>>> export TEST_DEV=/dev/sda3
>>>>>> export TEST_DIR=/mnt/test
>>>>>> export SCRATCH_DEV=/dev/sda4
>>>>>> export SCRATCH_MNT=/mnt/scratch
>>>>>>
>>>>>> The size for both partitions /dev/sda3 and /dev/sda4 is 25GB.
>>>>>
>>>>> Looks good to me, will toss it at my fstests cloud and see if anything
>>>>> shakes out.  Thanks for cleaning up this goofy thorn-pile!
>>>>
>>>> Great. It's been fun to work on this. :p
>>>
>>> Did you run the /entire/ fstests suite?  With this patch applied to
>>> 5.12-rc2, I keep seeing list corruption assertions about an hour into
>>
>> Nope; I run xfstests 'shutdown' and 'log' groups on 5.11.0, only.
>>
>> How do you run the entire fstests?
>> Could you give me some pointers?
> 
> ./check -g all
> 
> (instead of "./check -g shutdown")
> 
>>> the test run, and usually on some test that heavily exercises allocating
>>> and deleting file extents.  I'll try to look at this patch more closely
>>> next week, but I figured I should let you know early, on the off chance
>>> something sticks out to you.
>>
>> OK. I'll go run my tests on 5.12-rc2.
>>
>> Should I run the entire xfstests, too?
> 
> Yes, please.
> 
> --D
> 
>> Thanks
>> --
>> Gustavo

Powered by blists - more mailing lists