Bug 71670 - Max symlink depth too low
Summary: Max symlink depth too low
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kernel   
(Show other bugs)
Version: 8.0
Hardware: All Linux
medium
medium
Target Milestone: ---
Assignee: Arjan van de Ven
QA Contact: Brian Brock
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-08-16 15:26 UTC by Jos Vos
Modified: 2007-04-18 16:45 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-08-29 08:34:09 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Perl script that tests the depth of sequential links supported Perl script that tests the depth of sequential links supported by a given kernel/OS (359 bytes, text/plain)
2003-08-29 22:20 UTC, Howard Owen
no flags Details

Description Jos Vos 2002-08-16 15:26:37 UTC
The maximum depth of symlinks is now 5 (fs/namei.c, line 338).  This causes
problems on systems that also use symlinks for system directories in combination
with the "alternatives" system.  The /usr/bin/mailq utility, for example,
already uses the depth of 5 on a standard RH distribution, and if for example
/usr is a symlink on your system it already breaks. In my situation, I had a
count of 11, as /usr/bin and /etc/alternatives were both symlinks.

To test the number of symlinks, use this shell command line

i=0; while [ $i -lt 30 ]; do j=$((i + 1)); ln -s file$j file$i; i=$j; done;
touch file$j

and see what files are usable.

Comment 1 Howard Owen 2003-08-29 00:41:39 UTC
This bug is in 7.3, 9 and Severn as well. The code in the current Linus
kernel looks similar, but I haven't been able to test it, yet.

The problem appears to be that consecutive links are being treated as recursive
ones in fs/namei.c.

I would change the severity of this bug to "high" if I could. My Fortune 1000
client uses many levels of symlinks to share common tools across different
architectures. This bug prevents them from using stock kernels in their
production machines.

Comment 2 Arjan van de Ven 2003-08-29 08:34:09 UTC
there's a kernel commandline option added that allows you to bump it to 8.

Comment 3 Jos Vos 2003-08-29 21:06:53 UTC
As I explained in my initial bug description, 8 is still too low.  If both /usr
and /etc/alternatives are symlinks, you already come to a depth of 11 with
existing symlinks in the standard RHL distribution.

Comment 4 Howard Owen 2003-08-29 22:18:09 UTC
The code in fs/namei.c is correct. If do_follow_link is called recursively more
than five times, it returns -ELOOP. The question is, why is that function being 
called recursively? If you have 6->5->4->3->2->1->0, why are these recursive 
links? 

Other Intel Osen, are a lot more generous. The attached perl script tests the
limit of consecutive symlinks. Here are some results:

hbo@gate> uname -sr
OpenBSD 3.3
hbo@gate> perl mklinks 50
Trying 50 links
This system can support 32 sequential links

hbo@sol|503> uname -sr
SunOS 5.9
hbo@sol|504> perl mklinks 40
Trying 40 links
This system can support 20 sequential links

root(root)@dell:/root|1013# uname -sr
Linux 2.4.20-19.7
root(root)@dell:/root|1014# perl mklinks 40
Trying 40 links
This system can support 5 sequential links

hbo@owen|1002> cat /etc/issue
Red Hat Linux release 9 (Shrike)
Kernel \r on an \m
hbo@owen|1003> uname -sr
Linux 2.4.20-20.9
hbo@owen|1004> perl mklinks 40
Trying 40 links
This system can support 5 sequential links

hbo@mycop|1001> cat /etc/issue
Red Hat Linux release 9.0.93 (Severn)
Kernel \r on an \m

hbo@mycop|1002> uname -sr
Linux 2.4.21-20.1.2024.2.1.nptlsmp
hbo@mycop|1003> perl mklinks 40
Trying 40 links
This system can support 5 sequential links




Comment 5 Howard Owen 2003-08-29 22:20:21 UTC
Created attachment 94079 [details]
Perl script that tests the depth of sequential links supported
Perl script that tests the depth of sequential links supported by a given kernel/OS


Note You need to log in before you can comment on or make changes to this bug.