Received: by 10.192.165.148 with SMTP id m20csp2522352imm; Sun, 22 Apr 2018 08:47:16 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+ziU09rT07ZbiDsG9RGnCyZ0hGg7etK/qjFJrP0rSLkWUAZKocQJeRljZ6lUMJEnL7TaW0 X-Received: by 2002:a17:902:9042:: with SMTP id w2-v6mr17613000plz.34.1524412036131; Sun, 22 Apr 2018 08:47:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524412036; cv=none; d=google.com; s=arc-20160816; b=wajI/mokHdhAudEP396YX9UIW09LWzyqwJSIgWwwqjRJomprKHI/UqLCcw65JESWv9 h43vQ7FnyZeoZn6SwS5Gjdh6Ds47FfhhxKOsXm3DIPvl6anv3K8Dwu/oV9edmvTufXrt HXEfe8vpv0StPluCv0RqhQmVfsiCFEaC4bv71s9GyVimcMXVU8r5yaVG61ccIVlA2VC5 5s0Gzsx+6+tHBYl4pJ0dPI4MiKhgHSuy4hKH7q4O6xXNdhBeZG9KI4tMwk6i4rJ/OO2Z 7DRcgFBa0nMt+VIo7k1BMa7CyiN2/JcTBbvya7y+O3ApUndybBZghOQZdQqh4RMVO7b1 tbkw== 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=9zAQwv+nFxvjEHIaSbVRSBKbaUya/XWV8JrCJVjfmcI=; b=rbhvlaRsKGF5tesmUTt1AlWyUkI+R12aIAxSgYeOue+o6ziCmy+WwtMBxqb/WMjsVb WtaTNEBD6Zy9973yx3a8iCqQsRqL6trFKjp7HCzwGcRC4/KxvnF/ZH0qtR5PnBm+ibwc xw5UdkfO9yTqCLmayUnJGk2D7p6ouYcP6VhgZKhWG4KbzqiT3meERnfoL2aTZslb1DwQ Is/zfg8fZIvqtvJm/co8GCyfBWGRgvLZiIEefsMbxSr6DsigUvnZTA1yFo1cJTfaouT+ iAQq21/PWU3wPI1KXjavn4Wsg0+YSkgEXUQz3Olzyow7lp8jonGeLT48ZGulbBkagF8H tTMw== 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 i64si8337803pgc.323.2018.04.22.08.47.01; Sun, 22 Apr 2018 08:47:16 -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 S1755115AbeDVPoY (ORCPT + 99 others); Sun, 22 Apr 2018 11:44:24 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48886 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754941AbeDVOCz (ORCPT ); Sun, 22 Apr 2018 10:02:55 -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 AF7009C; Sun, 22 Apr 2018 14:02:54 +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.16 189/196] Dont leak MNT_INTERNAL away from internal mounts Date: Sun, 22 Apr 2018 15:53:29 +0200 Message-Id: <20180422135114.027763644@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135104.278511750@linuxfoundation.org> References: <20180422135104.278511750@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.16-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 @@ -1089,7 +1089,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;