Received: by 10.192.165.148 with SMTP id m20csp2457288imm; Sun, 22 Apr 2018 07:26:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+6IwCqmXAu888mVu8EDibDxGLf+u8q1KwjODZfPzaNxo4jYkR38CNdgP6j+OHo607it7nG X-Received: by 10.98.161.10 with SMTP id b10mr16788206pff.214.1524407199956; Sun, 22 Apr 2018 07:26:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524407199; cv=none; d=google.com; s=arc-20160816; b=UrQ8elKf0kLKb/W8NJ12k8GCgGqmTB9aRJlLV3MrP5MqD21hAadlN/jJnC4+p3iVAJ CRXO2hNDJEsqUhrZm2H7Ql+qna2XGzi//zdryVjMiULhEqH7oS5+E/crjZKh722f0gWh sJ9rze4dnNkT0t9lGrHesMxxD4srPCgCU9J0ygJP3kfx1i4NupU9kShPAADtb2gJFhsu 3a2T6rbWNvsRZfV1KqYrQL7zokgMlOY2BwFqpmzf30TFsTjk1pmyJVXjBnZO9DWqrgQJ N3JMWD6ukpPY3PaAIioRU1XVc3xexI85IP6zfMpuXcXSFuLQ0fkEqPgqzlDpqtsF5mmG jM9w== 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=jVLot0xC8ZBjXWzHyf3SUH+TpCl2/3VjqnJKWY6EQhg=; b=mpd4mBFJNsG8aNMeFqo6N5uk7FrwfvB90tzL0LM0HVKlqE44DrgPIj34pc5X2DfEBq k0YBoTNA4PLGxWpxOGPVQMRuBG90KxzZALnsnLBMab6RcTOKXh7QlIpq+x6abPfFsME2 2BAERejqks9T2WqDde6J6F9s0Wrnw9Np6SLzjyuXZOBgaf8YAqTA7X+iPgL+81vX1dJo ROrr55cu5Qwd4nW6z0pFlF2qDp8VmEXBr9NOaaOmJKh86IEQteqDQkn+DSpmFYRVXqfm ixyoYjuBr2v1AzwqOsDGZ+K7k22w7WfQhq5hNktVOCe9lIbAFmbQJ1ge1WzrnZyQLt2I PvNw== 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 j12si9090682pfh.3.2018.04.22.07.26.25; Sun, 22 Apr 2018 07:26:39 -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 S1757659AbeDVOWB (ORCPT + 99 others); Sun, 22 Apr 2018 10:22:01 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33156 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757642AbeDVOV4 (ORCPT ); Sun, 22 Apr 2018 10:21:56 -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 DB34ED09; Sun, 22 Apr 2018 14:21:55 +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 3.18 50/52] Dont leak MNT_INTERNAL away from internal mounts Date: Sun, 22 Apr 2018 15:54:23 +0200 Message-Id: <20180422135317.637169920@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135315.254787616@linuxfoundation.org> References: <20180422135315.254787616@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 3.18-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 @@ -944,7 +944,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;