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: <24ef85453961b830e6ab49ea3f8f81ff7c472875.camel@ibm.com>
Date: Fri, 2 May 2025 00:03:45 +0000
From: Viacheslav Dubeyko <Slava.Dubeyko@....com>
To: "frank.li@...o.com" <frank.li@...o.com>,
        "glaubitz@...sik.fu-berlin.de"
	<glaubitz@...sik.fu-berlin.de>,
        "slava@...eyko.com" <slava@...eyko.com>
CC: "linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re:  [PATCH 2/2] hfs: fix to update ctime after rename

On Tue, 2025-04-29 at 14:15 -0600, Yangtao Li wrote:
> Similar to hfsplus, let's update file ctime after the rename operation
> in hfs_rename().
> 
> Signed-off-by: Yangtao Li <frank.li@...o.com>
> ---
>  fs/hfs/dir.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
> index 86a6b317b474..3b95bafb3f04 100644
> --- a/fs/hfs/dir.c
> +++ b/fs/hfs/dir.c
> @@ -284,6 +284,7 @@ static int hfs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
>  		      struct dentry *old_dentry, struct inode *new_dir,
>  		      struct dentry *new_dentry, unsigned int flags)
>  {
> +	struct inode *inode = d_inode(old_dentry);
>  	int res;
>  
>  	if (flags & ~RENAME_NOREPLACE)
> @@ -299,11 +300,15 @@ static int hfs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
>  	res = hfs_cat_move(d_inode(old_dentry)->i_ino,
>  			   old_dir, &old_dentry->d_name,
>  			   new_dir, &new_dentry->d_name);
> -	if (!res)
> -		hfs_cat_build_key(old_dir->i_sb,
> -				  (btree_key *)&HFS_I(d_inode(old_dentry))->cat_key,
> -				  new_dir->i_ino, &new_dentry->d_name);
> -	return res;
> +	if (res)
> +		return res;
> +
> +	hfs_cat_build_key(old_dir->i_sb,
> +			  (btree_key *)&HFS_I(d_inode(old_dentry))->cat_key,
> +			  new_dir->i_ino, &new_dentry->d_name);
> +	inode_set_ctime_current(inode);
> +	mark_inode_dirty(inode);
> +	return 0;
>  }
>  
>  const struct file_operations hfs_dir_operations = {

BEFORE PATCH:

uname -a
Linux hfsplus-testing-0001 6.15.0-rc4 #7 SMP PREEMPT_DYNAMIC Thu May  1 16:11:49
PDT 2025 x86_64 x86_64 x86_64 GNU/Linux

sudo ./check generic/003
FSTYP         -- hfs
PLATFORM      -- Linux/x86_64 hfsplus-testing-0001 6.15.0-rc4 #7 SMP
PREEMPT_DYNAMIC Thu May  1 16:11:49 PDT 2025
MKFS_OPTIONS  -- /dev/loop51
MOUNT_OPTIONS -- /dev/loop51 /mnt/scratch

generic/003       - output mismatch (see /home/slavad/XFSTESTS-2/xfstests-
dev/results//generic/003.out.bad)
    --- tests/generic/003.out	2025-04-24 12:48:45.886164335 -0700
    +++ /home/slavad/XFSTESTS-2/xfstests-
dev/results//generic/003.out.bad	2025-05-01 16:36:38.608591317 -0700
    @@ -1,2 +1,6 @@
     QA output created by 003
    +ERROR: access time has changed for file1 after remount
    +ERROR: access time has changed after modifying file1
    +ERROR: change time has not been updated after changing file1
    +ERROR: access time has changed for file in read-only filesystem
     Silence is golden
    ...
    (Run 'diff -u /home/slavad/XFSTESTS-2/xfstests-dev/tests/generic/003.out
/home/slavad/XFSTESTS-2/xfstests-dev/results//generic/003.out.bad'  to see the
entire diff)
Ran: generic/003
Failures: generic/003
Failed 1 of 1 tests

WITH APPLIED PATCH:

uname -a
Linux hfsplus-testing-0001 6.15.0-rc4+ #8 SMP PREEMPT_DYNAMIC Thu May  1
16:43:22 PDT 2025 x86_64 x86_64 x86_64 GNU/Linux

sudo ./check generic/003
FSTYP         -- hfs
PLATFORM      -- Linux/x86_64 hfsplus-testing-0001 6.15.0-rc4+ #8 SMP
PREEMPT_DYNAMIC Thu May  1 16:43:22 PDT 2025
MKFS_OPTIONS  -- /dev/loop51
MOUNT_OPTIONS -- /dev/loop51 /mnt/scratch

generic/003       - output mismatch (see /home/slavad/XFSTESTS-2/xfstests-
dev/results//generic/003.out.bad)
    --- tests/generic/003.out	2025-04-24 12:48:45.886164335 -0700
    +++ /home/slavad/XFSTESTS-2/xfstests-
dev/results//generic/003.out.bad	2025-05-01 16:53:56.628734257 -0700
    @@ -1,2 +1,5 @@
     QA output created by 003
    +ERROR: access time has changed for file1 after remount
    +ERROR: access time has changed after modifying file1
    +ERROR: access time has changed for file in read-only filesystem
     Silence is golden
    ...
    (Run 'diff -u /home/slavad/XFSTESTS-2/xfstests-dev/tests/generic/003.out
/home/slavad/XFSTESTS-2/xfstests-dev/results//generic/003.out.bad'  to see the
entire diff)
Ran: generic/003
Failures: generic/003
Failed 1 of 1 tests

It looks like that it is not the whole fix of the issue for HFS case.

Thanks,
Slava.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ