Re: symlinks.

C. Scott Ananian (cananian@lcs.mit.edu)
Tue, 14 Apr 1998 00:38:14 -0400 (EDT)


On Tue, 14 Apr 1998, C. Scott Ananian wrote:

> Regarding the hullaballo about stack usage on follow_symlink depth limits:
> From my reading of the code, it does not seem as if do_follow_symlink is
> recursive at all. It is called in an for(ever) loop in lookup_dentry()
> in fs/namei.c; it only goes down one link per invocation, and pushes
> nothing onto the stack.

OK, I was wrong. The calls are recursive: lookup_dentry() calls
do_follow_link() which (in the filesystem-dependent code) calls
lookup_dentry again, which will call do_follow_link() again. So it is
recursive. BUT IT DOESN'T HAVE TO BE.

I'm like to change the semantics so that the filesystem-dependant
follow_symlink() function calls lookup_dentry with follow=0.
We could then replace the recursion with a loop in do_follow_symlink().
We could then use Tarjan's algorithm to accurately detect loops without
false-positives.

I hope I haven't screwed anything up this time. Comments?
--Scott
@ @
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-oOO-(_)-OOo-=-=-=-=-=
C. Scott Ananian: cananian@lcs.mit.edu / Declare the Truth boldly and
Laboratory for Computer Science/Crypto / without hindrance.
Massachusetts Institute of Technology /META-PARRESIAS AKOLUTOS:Acts 28:31
-.-. .-.. .. ..-. ..-. --- .-. -.. ... -.-. --- - - .- -. .- -. .. .- -.
PGP key available via finger and from http://www.pdos.lcs.mit.edu/~cananian

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu