Re: Recursion level of symlinks limitted to five?

Cameron Simpson (cs@zip.com.au)
Tue, 9 Mar 1999 00:49:08 +0000


On 9 Mar 1999, in message <m390d7on9x.fsf@muc.de>
Andi Kleen <ak@muc.de> wrote:
| schattev@imb-jena.de (Ruben Schattevoy) writes:
| > So, how many symlinks can be nested? I acctually expected
| > a big number here, at least a number much greater than 5...
|
| 5

This is way way way too low.

| The reason for the small number is that the routine that parses the
| path name in the kernel does actually recurse on symlinks. Kernel
| stack space is very limited (~6K - stack space for interrupt handlers
| on 2.2). To avoid overflowing the kernel stack the maximum nesting
| has to be limited. AFAIK there are no plans to change it.

There are better ways. You could allocate memory for the link
traversal, even a single buffer and iterate, rewriting the path. You
don't need to traverse symlinks recursively.

8 used to be a common default, and that was pretty frustrating
sometimes. 5 is insanely low. 16 or 32 is much more reasonable. There
was discussion (comp.sys.unix? I forget) some years back about
alternatives (like real loop detection and non-linear methods which
used log2(n) instead of n space consumption) as this limit was really
in the (BSD) kernel to serve as a primitive loop detector, not as a
hack to preserve stack space.

Argh. Overuse of symlinks is certainly bad, but a chain limit of 5 is
mega-overly-conservative.

--
Cameron Simpson, DoD#743        cs@zip.com.au        http://www.zip.com.au/~cs/

Consider your origin; you were not born to live like brutes, but to follow virtue and knowledge. - Dante Aligheri

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/