Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Oct 1995 06:12:36 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        ville@vlsi.fi
Cc:        current@freebsd.org
Subject:   Re: kern/760: mv foo/ ../.. causes panic
Message-ID:  <199510022012.GAA09018@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>Executing the following commands cause panic:
>descent% mkdir foo
>descent% mv foo/ ../..

>This results:
>panic: relookup: lookup on dot-dot

>It appears that mv tries to rename foo/ to ../../ which would cause bad
>things to happen if succesful.

There seem to be several bugs.  First, /bin/mv is confused by the
trailing slash on "foo/" and attempts to do a rename("foo/", "../../")
when it should do a rename("foo/", "../../foo/").  Second, ufs_rename()
thinks that the target directory (".." here, unless ".." is the root
directory) can never be ".." but this example shows that the assumption
is invalid.  Third, the bug was masked in versions of FreeBSD before
2.1-stable because rename("foo/", "../../") fails earlier for the wrong
reason (because of the trailing slash).  2.0.5 panics for the variant
rename("foo", "../..") but /bin/mv would never generate this.

Fix: in the kernel, it seems best to handle renaming to "../.." the same
as renaming to ".." and return ENOTEMPTY.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199510022012.GAA09018>