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: <dfbd2895-e29a-4e25-bbc6-a83826d14878@gmail.com>
Date: Fri, 31 Jan 2025 18:49:50 +0530
From: "Nirjhar Roy (IBM)" <nirjhar.roy.lists@...il.com>
To: "Darrick J. Wong" <djwong@...nel.org>
Cc: fstests@...r.kernel.org, linux-ext4@...r.kernel.org,
 linux-xfs@...r.kernel.org, ritesh.list@...il.com, ojaswin@...ux.ibm.com,
 zlang@...nel.org
Subject: Re: [PATCH v2] check: Fix fs specfic imports when
 $FSTYPE!=$OLD_FSTYPE


On 1/29/25 21:32, Darrick J. Wong wrote:
> On Wed, Jan 29, 2025 at 04:48:10PM +0530, Nirjhar Roy (IBM) wrote:
>> On 1/28/25 23:39, Darrick J. Wong wrote:
>>> On Tue, Jan 28, 2025 at 05:00:22AM +0000, Nirjhar Roy (IBM) wrote:
>>>> Bug Description:
>>>>
>>>> _test_mount function is failing with the following error:
>>>> ./common/rc: line 4716: _xfs_prepare_for_eio_shutdown: command not found
>>>> check: failed to mount /dev/loop0 on /mnt1/test
>>>>
>>>> when the second section in local.config file is xfs and the first section
>>>> is non-xfs.
>>>>
>>>> It can be easily reproduced with the following local.config file
>>>>
>>>> [s2]
>>>> export FSTYP=ext4
>>>> export TEST_DEV=/dev/loop0
>>>> export TEST_DIR=/mnt1/test
>>>> export SCRATCH_DEV=/dev/loop1
>>>> export SCRATCH_MNT=/mnt1/scratch
>>>>
>>>> [s1]
>>>> export FSTYP=xfs
>>>> export TEST_DEV=/dev/loop0
>>>> export TEST_DIR=/mnt1/test
>>>> export SCRATCH_DEV=/dev/loop1
>>>> export SCRATCH_MNT=/mnt1/scratch
>>>>
>>>> ./check selftest/001
>>>>
>>>> Root cause:
>>>> When _test_mount() is executed for the second section, the FSTYPE has
>>>> already changed but the new fs specific common/$FSTYP has not yet
>>>> been done. Hence _xfs_prepare_for_eio_shutdown() is not found and
>>>> the test run fails.
>>>>
>>>> Fix:
>>>> Remove the additional _test_mount in check file just before ". commom/rc"
>>>> since ". commom/rc" is already sourcing fs specific imports and doing a
>>>> _test_mount.
>>>>
>>>> Fixes: 1a49022fab9b4 ("fstests: always use fail-at-unmount semantics for XFS")
>>>> Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@...il.com>
>>>> ---
>>>>    check | 12 +++---------
>>>>    1 file changed, 3 insertions(+), 9 deletions(-)
>>>>
>>>> diff --git a/check b/check
>>>> index 607d2456..5cb4e7eb 100755
>>>> --- a/check
>>>> +++ b/check
>>>> @@ -784,15 +784,9 @@ function run_section()
>>>>    			status=1
>>>>    			exit
>>>>    		fi
>>>> -		if ! _test_mount
>>> Don't we want to _test_mount the newly created filesystem still?  But
>>> perhaps after sourcing common/rc ?
>>>
>>> --D
>> common/rc calls init_rc() in the end and init_rc() already does a
>> _test_mount. _test_mount after sourcing common/rc will fail, won't it? Does
>> that make sense?
>>
>> init_rc()
>> {
>>      # make some further configuration checks here
>>      if [ "$TEST_DEV" = ""  ]
>>      then
>>          echo "common/rc: Error: \$TEST_DEV is not set"
>>          exit 1
>>      fi
>>
>>      # if $TEST_DEV is not mounted, mount it now as XFS
>>      if [ -z "`_fs_type $TEST_DEV`" ]
>>      then
>>          # $TEST_DEV is not mounted
>>          if ! _test_mount
>>          then
>>              echo "common/rc: retrying test device mount with external set"
>>              [ "$USE_EXTERNAL" != "yes" ] && export USE_EXTERNAL=yes
>>              if ! _test_mount
>>              then
>>                  echo "common/rc: could not mount $TEST_DEV on $TEST_DIR"
>>                  exit 1
>>              fi
>>          fi
>>      fi
>> ...
> ahahahaha yes it does.
>
> /commit message reading comprehension fail, sorry about that.
>
> Though now that you point it out, should check elide the init_rc call
> about 12 lines down if it re-sourced common/rc ?

Yes, it should. init_rc() is getting called twice when common/rc is 
getting re-sourced. Maybe I can do like


if $RECREATE_TEST_DEV || [ "$OLD_FSTYP" != "$FSTYP" ]; then

     <...>

     . common/rc # changes in this patch

     <...>

elif [ "$OLD_TEST_FS_MOUNT_OPTS" != "$TEST_FS_MOUNT_OPTS" ]; then

     ...

     init_rc() # explicitly adding an init_rc() for this condition

else

     init_rc() # # explicitly adding an init_rc() for all other 
conditions. This will prevent init_rc() from getting called twice during 
re-sourcing common/rc

fi

What do you think?


>
> Reviewed-by: "Darrick J. Wong" <djwong@...nel.org>
>
> --D
>
>> ...
>>
>> --NR
>>
>>
>>
>>>> -		then
>>>> -			echo "check: failed to mount $TEST_DEV on $TEST_DIR"
>>>> -			status=1
>>>> -			exit
>>>> -		fi
>>>> -		# TEST_DEV has been recreated, previous FSTYP derived from
>>>> -		# TEST_DEV could be changed, source common/rc again with
>>>> -		# correct FSTYP to get FSTYP specific configs, e.g. common/xfs
>>>> +		# Previous FSTYP derived from TEST_DEV could be changed, source
>>>> +		# common/rc again with correct FSTYP to get FSTYP specific configs,
>>>> +		# e.g. common/xfs
>>>>    		. common/rc
>>>>    		_prepare_test_list
>>>>    	elif [ "$OLD_TEST_FS_MOUNT_OPTS" != "$TEST_FS_MOUNT_OPTS" ]; then
>>>> -- 
>>>> 2.34.1
>>>>
>>>>
>> -- 
>> Nirjhar Roy
>> Linux Kernel Developer
>> IBM, Bangalore
>>
-- 
Nirjhar Roy
Linux Kernel Developer
IBM, Bangalore


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ