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] [day] [month] [year] [list]
Date:	Fri, 10 Apr 2009 16:13:32 +0200
From:	Jan Kara <jack@...e.cz>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	linux-ext4@...r.kernel.org, ronny.pretzsch@....de, hare@...e.de
Subject: Re: [PATCH] ext2: Do not update mtime of a move directory when
	parent has not changed

On Thu 09-04-09 13:20:44, Andrew Morton wrote:
> On Thu, 9 Apr 2009 21:15:15 +0200
> Jan Kara <jack@...e.cz> wrote:
> 
> > On Thu 09-04-09 11:51:32, Andrew Morton wrote:
> > > On Thu,  9 Apr 2009 20:41:32 +0200
> > > Jan Kara <jack@...e.cz> wrote:
> > > 
> > > > If the parent of the moved directory has not changed, there's no real
> > > > reason to change mtime. Specs doesn't seem to say anything about this
> > > > particular case and e.g. ext3 does not change mtime in this case.
> > > > So we become a tiny bit more consistent.
> > > > 
> > > > Spotted by ronny.pretzsch@....de, initial fix by J__rn Engel <joern@...fs.org>.
> > > > 
> > > > CC: ronny.pretzsch@....de
> > > > CC: hare@...e.de
> > > > Acked-by: J__rn Engel <joern@...fs.org>
> > > > Signed-off-by: Jan Kara <jack@...e.cz>
> > > > ---
> > > >  fs/ext2/namei.c |    5 ++++-
> > > >  1 files changed, 4 insertions(+), 1 deletions(-)
> > > > 
> > > > diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
> > > > index 90ea179..556f258 100644
> > > > --- a/fs/ext2/namei.c
> > > > +++ b/fs/ext2/namei.c
> > > > @@ -352,7 +352,10 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
> > > >  	inode_dec_link_count(old_inode);
> > > >  
> > > >  	if (dir_de) {
> > > > -		ext2_set_link(old_inode, dir_de, dir_page, new_dir);
> > > > +		/* Set link only if parent has changed and thus avoid setting
> > > > +		 * of mtime of the moved directory on a pure rename. */
> > > > +		if (old_dir != new_dir)
> > > > +			ext2_set_link(old_inode, dir_de, dir_page, new_dir);
> > > >  		inode_dec_link_count(old_dir);
> > > >  	}
> > > >  	return 0;
> > > 
> > > hm, what do other filesystems do?  We risk breaking things in either case.
> > > Probably changing ext2 is safer than changing ext3/4, given that ext2 is
> > > used less.
> >   Yes, I think so as well. Looking more into what other filesystems do, it
> > seems that FAT, UDF, reiserfs, ext3, ext4 actually never update mtime of
> > the moved directory, even if the parent has changed. So maybe it would make
> > more sence to change ext2 in this way as well. What do you think?
> 
> urgh, stop asking difficult questions.
> 
> Given that our behaviour here is basically random, I guess that nobody
> is depending on it much.
  Well, one of our users is complaining that his backup tool is upset on
ext2 (while it's happy on ext3, xfs, ...) because of the mtime change. So
there are some programs checking this. But I don't believe anybody relies
on *ext2* behavior these days...

> Probably bringing everything into line with ext3 behaviour is safest. 
> otoh we want the behaviour to a) be standards compiant and b) make
> sense.
  Definitely.

> What _is_ the behaviour?
> 
> mkdir ./foo
> mv ./foo ./bar
> 
> will update .'s mtime?  If so, that seems correct?
  Yes, it will. The problem is:

mkdir foo
mkdir bar
mkdir foo/a

Now under ext2:
mv foo/a foo/b

changes mtime of 'foo/a' (foo/b after the move). That does not really make
sence and it does not happen under any other filesystem I've seen.

More complicated is:
mv foo/a bar/a

This changes mtime of foo/a (bar/a after the move) and it makes some sence
since we had to update parent directory pointer of foo/a. But again, no
other filesystem does this. So after some thoughts I'd vote for consistency
and change ext2 to behave the same as other filesystems. Patch attached.

								Honza
-- 
Jan Kara <jack@...e.cz>
SUSE Labs, CR

View attachment "0001-ext2-Do-not-update-mtime-of-a-moved-directory.patch" of type "text/x-patch" (3291 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ