Subject: kern/1436: msdosfs overwrites "." entries in directories
To: None <firstname.lastname@example.org>
From: John F. Woods <email@example.com>
Date: 09/05/1995 08:22:46
>Synopsis: msdosfs overwrites "." entries in directories
>Responsible: kern-bug-people (Kernel Bug People)
>Arrival-Date: Tue Sep 5 10:50:08 1995
>Originator: John F. Woods
System: NetBSD jfwhome.funhouse.com 1.0A NetBSD 1.0A (JFW) #14: Wed Aug 9 21:35:57 EDT 1995 firstname.lastname@example.org:/usr/src/sys/arch/i386/compile/JFW i386
Whenever the msdosfs code wants to alter a directory's properties,
that directory's "." entry gets smashed with the new copy of the
directory's entry (which should have gone in the parent directory).
It turns out that this is because the msdosfs code stores a copy of
the location of each denode's directory entry -- except that for
directories it regularizes the location to be the first entry in
the directory; i.e. the "." entry. If the denode for the directory
is modified, the entry gets written back in the wrong place.
Take a blank MSDOS filesystem, mount it, create two directories, "one"
and "two". cd to the mounted filesystem.
$ chmod 777 one ; ls -l ; ls -l one
$ mv two twenty ; ls -l ; ls -l two
If there are any other operations possible that alter a directory's
denode, they'll do exactly the same thing.
I have been unable to devote enough time to preparing a patch. I
was able to fix the first partial problem (chmod) by adding extra
pointers that preserved the original location and having the vnode
update code use that, but it turns out the rename code goes around
that code (of course, since it's structured like every other filesystem
and believes that names and identities are separate, sort of). Fixing
that, too, probably wouldn't be much time, but I don't have that time.
If you need a starting point, I can forward the changes I did make.