From: Jann Horn To: security@kernel.org Cc: Jann Horn Subject: [PATCH 1/3] proc: prevent stacking filesystems on top Date: Wed, 1 Jun 2016 11:55:05 +0200 Message-Id: <1464774907-7753-1-git-send-email-jannh@google.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: References: X-Spam-Status: No, hits=-5.1 required=5 tests=DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VERIFIED X-Spam-Checker-Version: SpamAssassin 3.4.0-outflux_revision__1.66__ X-Virus-Scanned: ClamAV using ClamSMTP Envelope-To: kees@outflux.net X-MIMEDefang-Filter: outflux$Revision: 1.316 $ X-HELO: www.outflux.net X-Scanned-By: MIMEDefang 2.73 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 Cc: stable@vger.kernel.org --- fs/proc/root.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/proc/root.c b/fs/proc/root.c index 55bc7d6..0670278 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c @@ -121,6 +121,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); -- 2.8.0.rc3.226.g39d4020