Received: by 10.192.165.148 with SMTP id m20csp2478765imm; Sun, 22 Apr 2018 07:54:19 -0700 (PDT) X-Google-Smtp-Source: AIpwx48r8nyEBxZGuTtOXF/+yFU1qVIyqOvZAWIILSFDfLeAgch0fELY1uKVMsHIaXBaq/nS2ioH X-Received: by 2002:a17:902:a50d:: with SMTP id s13-v6mr17357281plq.228.1524408859673; Sun, 22 Apr 2018 07:54:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524408859; cv=none; d=google.com; s=arc-20160816; b=WwZRKQXJTuZSnsd9QP2Xjl4g/Crrkeq19AyrCsYloyXpRCZxM8TJrHyE+hKMcaaH1G iEOJGSuuV9IkvdR/Ys8AjJ5bv3Q0gID070PLi5D7Gs3jgDBVGr3txRAzdNa79dcdraqR hbuqWaFlYRk8cSXhOu5lUltPkXIG6KMD4La7djjvc6nsb7fxUWTexUA/PLp5nDOg06gL ZN6C8PjuTiS+JeNlch2VC9BxHztUPhjAJY/mNH1BD81MjJZ9sTOH95b2cObfEckajVda 7aY0pPOdtYlfcM0FNWrx+OcVCQ9oWLdXUESdqVOFYhCYTsIbVfPZrGSnkAEUB+W+vBGO lxvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=AZ3EAJ+mm4Slf4PGRtHY7aNvemc3f4zK53iVPXnfeYc=; b=F9RXifVAkWPlZjjCVPfRVgjyhnsgc33SNKOpi3Ld9nGxws+iMO+kFnSlZ2DjHWeHZr u3DetGOth0h3nr4LreHb9exGEfxTAYBu1LMAqwHbWjKPJkfis7m7P6KVxbbufgYqgwrE mlwia6HrJ4erRU+YJ9nw1sN6V6w+SFpL8oaVehe/OJzm131jX1C9KzmxDvEmdi/Mmz89 Jdnxk7/ryunKZs0ZB04HFHnK5mccDben6NSJK/AkzgeqvJpw5qREZy+3lvFcndH/BX1i SQoNSZLarcEMf6AbhIsqOVPkuQO6kNqKm94QIkcY0zTyYQWrKomBLYRuTiafIdSlfogs TzAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i12si3012562pgp.119.2018.04.22.07.54.05; Sun, 22 Apr 2018 07:54:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757366AbeDVOwV (ORCPT + 99 others); Sun, 22 Apr 2018 10:52:21 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56586 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932079AbeDVOOw (ORCPT ); Sun, 22 Apr 2018 10:14:52 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A31A484B; Sun, 22 Apr 2018 14:14:51 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Alexander Aring , Kirill Tkhai , Al Viro Subject: [PATCH 4.9 90/95] Dont leak MNT_INTERNAL away from internal mounts Date: Sun, 22 Apr 2018 15:53:59 +0200 Message-Id: <20180422135214.109430105@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135210.432103639@linuxfoundation.org> References: <20180422135210.432103639@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Al Viro commit 16a34adb9392b2fe4195267475ab5b472e55292c upstream. We want it only for the stuff created by SB_KERNMOUNT mounts, *not* for their copies. As it is, creating a deep stack of bindings of /proc/*/ns/* somewhere in a new namespace and exiting yields a stack overflow. Cc: stable@kernel.org Reported-by: Alexander Aring Bisected-by: Kirill Tkhai Tested-by: Kirill Tkhai Tested-by: Alexander Aring Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman --- fs/namespace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1033,7 +1033,8 @@ static struct mount *clone_mnt(struct mo goto out_free; } - mnt->mnt.mnt_flags = old->mnt.mnt_flags & ~(MNT_WRITE_HOLD|MNT_MARKED); + mnt->mnt.mnt_flags = old->mnt.mnt_flags; + mnt->mnt.mnt_flags &= ~(MNT_WRITE_HOLD|MNT_MARKED|MNT_INTERNAL); /* Don't allow unprivileged users to change mount flags */ if (flag & CL_UNPRIVILEGED) { mnt->mnt.mnt_flags |= MNT_LOCK_ATIME;