]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
proc: prevent stacking filesystems on top
authorJann Horn <jannh@google.com>
Wed, 1 Jun 2016 09:55:05 +0000 (11:55 +0200)
committerChuck Anderson <chuck.anderson@oracle.com>
Mon, 31 Oct 2016 22:49:45 +0000 (15:49 -0700)
Orabug: 24971905
CVE: CVE-2016-1583

This prevents stacking filesystems (ecryptfs and overlayfs) from using
procfs as lower filesystem.  There is too much magic going on inside
procfs, and there is no good reason to stack stuff on top of procfs.

(For example, procfs does access checks in VFS open handlers, and
ecryptfs by design calls open handlers from a kernel thread that doesn't
drop privileges or so.)

Signed-off-by: Jann Horn <jannh@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit e54ad7f1ee263ffa5a2de9c609d58dfa27b21cd9)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
fs/proc/root.c

index b7fa4bfe896a2c17f05dd97add756bed889fd2b6..37016735b57fcf6b9849b0fc527ced4f5f726f85 100644 (file)
@@ -124,6 +124,13 @@ static struct dentry *proc_mount(struct file_system_type *fs_type,
        if (IS_ERR(sb))
                return ERR_CAST(sb);
 
+       /*
+        * procfs isn't actually a stacking filesystem; however, there is
+        * too much magic going on inside it to permit stacking things on
+        * top of it
+        */
+       sb->s_stack_depth = FILESYSTEM_MAX_STACK_DEPTH;
+
        if (!proc_parse_options(options, ns)) {
                deactivate_locked_super(sb);
                return ERR_PTR(-EINVAL);