lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1305329059-2017-2-git-send-email-andi@firstfloor.org>
Date:	Fri, 13 May 2011 16:24:15 -0700
From:	Andi Kleen <andi@...stfloor.org>
To:	linux-kernel@...r.kernel.org
Cc:	libc-alpha@...rceware.org, Andi Kleen <ak@...ux.intel.com>
Subject: [PATCH 1/5] VFS: Make symlink nesting limit a define

From: Andi Kleen <ak@...ux.intel.com>

Use a SYMLOOP_MAX define for the total symlink nesting limit instead
of a hardcoded 40. No behaviour change.

Used in a followon patch

Signed-off-by: Andi Kleen <ak@...ux.intel.com>
---
 fs/namei.c             |    6 +++---
 include/linux/limits.h |    1 +
 include/linux/namei.h  |    1 +
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 54fc993..9d0a92e 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -763,7 +763,7 @@ follow_link(struct path *link, struct nameidata *nd, void **p)
 	if (link->mnt == nd->path.mnt)
 		mntget(link->mnt);
 
-	if (unlikely(current->total_link_count >= 40)) {
+	if (unlikely(current->total_link_count >= SYMLOOP_MAX)) {
 		*p = ERR_PTR(-ELOOP); /* no ->put_link(), please */
 		path_put(&nd->path);
 		return -ELOOP;
@@ -871,7 +871,7 @@ static int follow_automount(struct path *path, unsigned flags,
 		return -EISDIR;
 
 	current->total_link_count++;
-	if (current->total_link_count >= 40)
+	if (current->total_link_count >= SYMLOOP_MAX)
 		return -ELOOP;
 
 	mnt = path->dentry->d_op->d_automount(path);
@@ -1369,7 +1369,7 @@ static inline int walk_component(struct nameidata *nd, struct path *path,
 
 /*
  * This limits recursive symlink follows to 8, while
- * limiting consecutive symlinks to 40.
+ * limiting consecutive symlinks to 40 (SYMLOOP_MAX)
  *
  * Without that kind of total limit, nasty chains of consecutive
  * symlinks can cause almost arbitrarily long lookups.
diff --git a/include/linux/limits.h b/include/linux/limits.h
index 2d0f941..2f39657 100644
--- a/include/linux/limits.h
+++ b/include/linux/limits.h
@@ -14,6 +14,7 @@
 #define XATTR_NAME_MAX   255	/* # chars in an extended attribute name */
 #define XATTR_SIZE_MAX 65536	/* size of an extended attribute value (64k) */
 #define XATTR_LIST_MAX 65536	/* size of extended attribute namelist (64k) */
+#define SYMLOOP_MAX	  40	/* max number of total symlink nests */
 
 #define RTSIG_MAX	  32
 
diff --git a/include/linux/namei.h b/include/linux/namei.h
index eba45ea..403e39c 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -4,6 +4,7 @@
 #include <linux/dcache.h>
 #include <linux/linkage.h>
 #include <linux/path.h>
+#include <linux/limits.h>
 
 struct vfsmount;
 
-- 
1.7.4.4

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ