Date: Sat, 11 Nov 1995 14:37:00 -0700 (MST) From: Terry Lambert <terry@lambert.org> To: bde@zeta.org.au (Bruce Evans) Cc: current@FreeBSD.ORG Subject: Re: old bugs in vfs_lookup.c Message-ID: <199511112137.OAA08113@phaeton.artisoft.com> In-Reply-To: <199511110209.NAA01399@godzilla.zeta.org.au> from "Bruce Evans" at Nov 11, 95 01:09:59 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> I've reported these bugs and fixes before but there wasn't enough > discussion. > > 1. The empty pathname is allowed as an alias for ".". This breaks > POSIX conformance for every syscall that involves a pathname. It's because "xxx/" is being handled as "xxx/." instead of as "xxx". Probably the real fix is to handle "xxx/" as "xxx" with the trailing slash implying that the link (if any should be followed). Otherwise ndp->ni_dvp and ndp->ni_vp point to the same location and you have to fight the lock. Probably the trailing slash should be noted, removed, and imply a test of ndp->ni_vp for whether or not it's a directory. > 2. lstat() depletes the namei cache. Thus file system traversals > often blow away the cache entries for everything they look at. This is part of the larger problem of the use ov the cn_pnbuf and abbreviated mutual recursion to traverse multiple links to avoid using stack. It's probably arguable that the namei/lookup interaction is completely broken. Really, cache entry want to take place in the top level path lookup mechanism ("namei") instead of in the per file system lookup code. The damage occurs because traversing a link results in a bogus parent of link directory and link target in the cache because of where the cache entry is made. Disallowing an empty pathname (a "degenerate name") in all cases is really a violation of POSIX because of faulty trailing slash interpretation, and that's done because of the implied "dir-ness" of patsh with trailing slashes for BSD backward compatability. I'm not suggesting abonding this behaviour entirely, only dealing with the parsing of the path components at a slightly different level. It would fix the problem without flagging the program as "bad" when POSIX allows the behaviour. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199511112137.OAA08113>