All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: Al Viro <viro@ftp.linux.org.uk>
Cc: Linda Walsh <lkml@tlinx.org>,
	Linux-Kernel <linux-kernel@vger.kernel.org>,
	linux-fsdevel@vger.kernel.org
Subject: Re: max symlink = 5? ?bug? ?feature deficit?
Date: Sun, 12 Feb 2006 12:36:37 -0700	[thread overview]
Message-ID: <20060212193637.GI12822@parisc-linux.org> (raw)
In-Reply-To: <20060212180601.GU27946@ftp.linux.org.uk>

On Sun, Feb 12, 2006 at 06:06:01PM +0000, Al Viro wrote:
> On Fri, Feb 10, 2006 at 07:31:07PM -0800, Linda Walsh wrote:
> > The maximum number of followed symlinks seems to be set to 5.
> > 
> > This seems small when compared to other filesystem limits.
> > Is there some objection to it being raised?  Should it be
> > something like Glib's '20' or '255'?

Just a note (which Al probably considered too obvious to point out), but
MAX_NESTED_LINKS isn't the maximum number of followed symlinks.  It's
the number of recursions we're limited to.  The maximum number of
symlinks followed is 40 (see fs/namei.c:do_follow_link).

Al, would it be worth making 40 an enumerated constant in the same
enumeration as MAX_NESTED_LINKS?  Something like this:

Index: include/linux/namei.h
===================================================================
RCS file: /var/cvs/linux-2.6/include/linux/namei.h,v
retrieving revision 1.4
diff -u -p -r1.4 namei.h
--- include/linux/namei.h       12 Nov 2005 04:09:17 -0000      1.4
+++ include/linux/namei.h       12 Feb 2006 19:35:31 -0000
@@ -11,7 +11,10 @@ struct open_intent {
        struct file *file;
 };
 
-enum { MAX_NESTED_LINKS = 5 };
+enum {
+       MAX_NESTED_LINKS = 5,
+       MAX_FOLLOW_SYMLINKS = 40,
+};
 
 struct nameidata {
        struct dentry   *dentry;
Index: fs/namei.c
===================================================================
RCS file: /var/cvs/linux-2.6/fs/namei.c,v
retrieving revision 1.31
diff -u -p -r1.31 namei.c
--- fs/namei.c  12 Nov 2005 04:08:32 -0000      1.31
+++ fs/namei.c  12 Feb 2006 19:35:31 -0000
@@ -598,7 +598,7 @@ static inline int do_follow_link(struct 
        int err = -ELOOP;
        if (current->link_count >= MAX_NESTED_LINKS)
                goto loop;
-       if (current->total_link_count >= 40)
+       if (current->total_link_count >= MAX_FOLLOW_SYMLINKS)
                goto loop;
        BUG_ON(nd->depth >= MAX_NESTED_LINKS);
        cond_resched();


  parent reply	other threads:[~2006-02-12 19:36 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-11  3:31 max symlink = 5? ?bug? ?feature deficit? Linda Walsh
2006-02-12 10:27 ` Jan Engelhardt
2006-02-12 20:46   ` [PATCH] Use one constant to control MAX SYMLINKS in a name Linda Walsh
2006-02-12 21:16     ` Al Viro
2006-02-12 18:06 ` max symlink = 5? ?bug? ?feature deficit? Al Viro
2006-02-12 19:19   ` Dave Jones
2006-02-12 19:36   ` Matthew Wilcox [this message]
2006-02-12 19:48     ` Al Viro
2006-02-12 21:18   ` Linda Walsh
2006-02-12 21:25     ` Al Viro
2006-02-12 22:54       ` Linda Walsh
2006-02-13  0:08         ` Al Viro
2006-02-13  0:54           ` Linda Walsh
2006-02-13  7:37             ` Willy Tarreau
2006-02-13  7:48               ` Arjan van de Ven
2006-02-13  8:03                 ` Willy Tarreau
2006-02-13  8:11                   ` Al Viro
2006-02-13 14:10                   ` Olivier Galibert
2006-02-13  8:20               ` Helge Hafting
  -- strict thread matches above, loose matches on Subject: below --
2006-02-12 15:16 linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060212193637.GI12822@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkml@tlinx.org \
    --cc=viro@ftp.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.