Received: by 10.192.165.148 with SMTP id m20csp2452224imm; Sun, 22 Apr 2018 07:20:37 -0700 (PDT) X-Google-Smtp-Source: AIpwx49K35v2h7RepgbYrfPgdC6ga+lqsDEDuy9hp6Ks3yl/CTap8woOQGTRLZfkUBZkIeEe0ar8 X-Received: by 10.98.190.2 with SMTP id l2mr16773206pff.224.1524406837677; Sun, 22 Apr 2018 07:20:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524406837; cv=none; d=google.com; s=arc-20160816; b=b1SuCqDGxfGctmn2EhTQXHC3L2iaF2sXAqreJjhsmo4bKsDCWYKnPDHVSb5A0ffg3q YLywjRW6gaRl58+FM8BzywUxtSnv56oK5ovpxU7/lAW6z2OdoF6kLsTCn0XjQbqHrRCG CRVaymarY53HQqCsDjPyBTTR4wiig/5hEO5f1D0hfA91ajREHy1+GgUxVM0o0CdFjamP 2iqG9kOZPOiJyiLji6HEeLW/s0pPKzXRq62BeUBWrckSePRP8CRsSU4+SuMYdmISiMcQ 9k0mbMl9Id5EMTJp/E4yAq0xIZXg9fJWcAMNoAZF/9M6WV5eSfMwElv/S6Cb8yxdAZP3 BjtQ== 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=x2cbkc7NXgOTuxBRXMsloOdbBoV35L/Za+jGuv43ByE=; b=NkFGKwXFpkwk6JiVXgbA1zreQEooPie5aogjpRmswmO53xS50nUaoB//+NHNjr0fnb dby86PgPo5gIUIKRNGtyUtklghsUwwzU5SCIBmZDc+7vdbxumfeovq+qGt3iYEZn+34g uysQ8bjzm2lEhinRtkdk5uAVfBx+5O/k3ZFbFncOHfp3i3UCfE0yo0c+WXA+WNQe+Tky qbc5OeLfuimsfq+/eGJ5SqVjhwXY2jOh4+V3DhkBrXfGC4hBsUtTy4JJxDEUxmddrTNq ETeMDAEAsGHOi6t/O9MByi5iPBCad6Hbu9wgjFBegIQ1W6dr4ecG3+16iMe4PW2u9rKf slsA== 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 j2-v6si9073738pli.501.2018.04.22.07.20.23; Sun, 22 Apr 2018 07:20:37 -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 S1757275AbeDVOT2 (ORCPT + 99 others); Sun, 22 Apr 2018 10:19:28 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59526 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932584AbeDVOTO (ORCPT ); Sun, 22 Apr 2018 10:19:14 -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 C610A486; Sun, 22 Apr 2018 14:19:13 +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.4 91/97] Dont leak MNT_INTERNAL away from internal mounts Date: Sun, 22 Apr 2018 15:54:09 +0200 Message-Id: <20180422135310.157855356@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135304.577223025@linuxfoundation.org> References: <20180422135304.577223025@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.4-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 @@ -1018,7 +1018,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;