* [PATCH 1/1] selftests : Adding symbolic link limits test script
@ 2013-12-25 16:23 Fabian Frederick
2013-12-27 22:38 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Fabian Frederick @ 2013-12-25 16:23 UTC (permalink / raw)
To: linux-kernel; +Cc: akpm
This patch adds fs directory in selftests and a script to explain recursive
and consecutive symbolic linking limits who have been debated
so many times.
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
tools/testing/selftests/Makefile | 1 +
tools/testing/selftests/fs/Makefile | 6 ++++
tools/testing/selftests/fs/symlinks.sh | 64 ++++++++++++++++++++++++++++++++++
3 files changed, 71 insertions(+)
create mode 100644 tools/testing/selftests/fs/Makefile
create mode 100755 tools/testing/selftests/fs/symlinks.sh
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 9f3eae2..10e2d80 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -9,6 +9,7 @@ TARGETS += ptrace
TARGETS += timers
TARGETS += vm
TARGETS += powerpc
+TARGETS += fs
all:
for TARGET in $(TARGETS); do \
diff --git a/tools/testing/selftests/fs/Makefile b/tools/testing/selftests/fs/Makefile
new file mode 100644
index 0000000..cf0fc21
--- /dev/null
+++ b/tools/testing/selftests/fs/Makefile
@@ -0,0 +1,6 @@
+all:
+
+run_tests:
+ @/bin/sh ./symlinks.sh || echo "symlinks selftests: [FAIL]"
+
+clean:
diff --git a/tools/testing/selftests/fs/symlinks.sh b/tools/testing/selftests/fs/symlinks.sh
new file mode 100755
index 0000000..5daeb05
--- /dev/null
+++ b/tools/testing/selftests/fs/symlinks.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+#
+# This script hits symbolic link limits.
+
+boldtext=`tput bold`
+normaltext=`tput sgr0`
+run_path=`pwd`
+appl_path="tmp_symlinks"
+mkdir -p $appl_path
+cd $appl_path
+
+function recursive_symbolic_links()
+{
+ path="origpath"`date +'%s'`
+ symlink=`date +'%s'`
+ echo $boldtext"Recursive symbolic link testing (vfs limit : 8)"\
+ $normaltext
+ echo "original_path/1/2/3/4 ... where 1=>original_path 2=>1 ..."
+ echo "Trying 10 steps ..."
+ mkdir $path
+
+ for i in {1..10}
+ do
+ cd $path 2>/dev/null|| break
+ echo "Creating : "$path" =>" " [OK]"
+ if [ $i = 1 ] ;then
+ path="../"$path
+ fi
+ ln -s $path $symlink"_"$i
+ path=$symlink"_"$i
+ done
+ echo $boldtext"Maximum recursive symlink level:" `expr $i - 2 `\
+ $normaltext
+}
+
+function consecutive_symbolic_links()
+{
+ origfile="orig"`date +'%s'`
+ symlink=`date +'%s'`
+ echo $boldtext"Consecutive symbolic link testing (vfs limit : 40)"\
+ $normaltext
+ echo "original_file;1;2;3 ... where 1=>original_file 2=>1 ..."
+ echo "Trying 50 steps ..."
+
+ touch $origfile
+ for i in {1..50}
+ do
+ cat $origfile 2>/dev/null || break;
+ echo -n "[OK] |"
+ ln -s $origfile $symlink"_"$i
+ origfile=$symlink"_"$i
+ echo -n $i
+ done
+ echo -e $boldtext "\nMaximum consecutive symlink level:" `expr $i - 2`\
+ $normaltext
+
+}
+
+recursive_symbolic_links
+echo "------------------------------------------------------"
+sleep 1
+consecutive_symbolic_links
+cd $run_path
+rm -rf $appl_path
--
1.8.1.4
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 1/1] selftests : Adding symbolic link limits test script
2013-12-25 16:23 [PATCH 1/1] selftests : Adding symbolic link limits test script Fabian Frederick
@ 2013-12-27 22:38 ` Andrew Morton
2013-12-28 4:37 ` Fabian Frederick
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2013-12-27 22:38 UTC (permalink / raw)
To: Fabian Frederick; +Cc: linux-kernel
On Wed, 25 Dec 2013 17:23:10 +0100 Fabian Frederick <fabf@skynet.be> wrote:
> This patch adds fs directory in selftests and a script to explain recursive
> and consecutive symbolic linking limits who have been debated
> so many times.
hm, it's a "test" which doesn't really test anything - it always
succeeds.
Why do you think the kernel needs this?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] selftests : Adding symbolic link limits test script
2013-12-27 22:38 ` Andrew Morton
@ 2013-12-28 4:37 ` Fabian Frederick
0 siblings, 0 replies; 3+ messages in thread
From: Fabian Frederick @ 2013-12-28 4:37 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
On Fri, 27 Dec 2013 14:38:22 -0800
Andrew Morton <akpm@linux-foundation.org> wrote:
> On Wed, 25 Dec 2013 17:23:10 +0100 Fabian Frederick <fabf@skynet.be> wrote:
>
> > This patch adds fs directory in selftests and a script to explain recursive
> > and consecutive symbolic linking limits who have been debated
> > so many times.
>
> hm, it's a "test" which doesn't really test anything - it always
> succeeds.
>
> Why do you think the kernel needs this?
Thanks for testing Andrew !
As the script states, first loop is trying 10 recursive links but logically stops at 8.
The second one is trying 50 consecutive links but stops at 40.
Those limits are hardcoded values all over the place in vfs namei.c.
btw people have been asking for global definition, sysctl and so on for
years but nothing has changed AFAICS.
This script tries to show the difference between recursive and consecutive symlinking.
Besides this script could be useful for testing specific FS limitation as well.
If you find it useful, I can add some features to be more self-explanatory ...
If it's still not the case let's forget about it :)
Fabian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-12-28 12:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-25 16:23 [PATCH 1/1] selftests : Adding symbolic link limits test script Fabian Frederick
2013-12-27 22:38 ` Andrew Morton
2013-12-28 4:37 ` Fabian Frederick
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®