This is the mail archive of the
libc-hacker@cygnus.com
mailing list for the glibc project.
Re: Should we have MAXSYMLINKS?
- To: Roland McGrath <roland@frob.com>
- Subject: Re: Should we have MAXSYMLINKS?
- From: Alexander Viro <viro@math.psu.edu>
- Date: Wed, 13 Jan 1999 02:44:09 -0500 (EST)
- cc: "H.J. Lu" <hjl@lucon.org>, linux kernel <linux-kernel@vger.rutgers.edu>, GNU C Library <libc-hacker@cygnus.com>
On Wed, 13 Jan 1999, Roland McGrath wrote:
> There has always been an explicit check in BSD for following more than
> MAXSYMLINKS links. It is not expressing an implementation limit. The
> limit is there to catch infinite recursions (ln -s foo foo).
> This is what the ELOOP error exists to report.
Yes, indeed. I wrote that:
a) We have similar (see below) limit (5).
b) It is enforced in a single place.
c) It's low due to our implementation of namei() (recursive vs.
iterative).
My fault, I didn't check the actual code before posting. Yes, 4.4 counts
total amount of symlinks (kern/vfs_lookup.c::namei()), but IMHO it is not
clear that we should do the same. Counting nested symlinks is enough for
loop detection. Anyway, if we want to enforce such limit we can do it in
do_follow_link() and lookup_dentry().