Message ID | 1451930639-94331-13-git-send-email-seth.forshee@canonical.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show
Return-Path: <selinux-bounces@tycho.nsa.gov> X-Original-To: patchwork-selinux@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6DF29BEEE5 for <patchwork-selinux@patchwork.kernel.org>; Mon, 4 Jan 2016 18:42:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C241E20306 for <patchwork-selinux@patchwork.kernel.org>; Mon, 4 Jan 2016 18:42:40 +0000 (UTC) Received: from emvm-gh1-uea09.nsa.gov (emvm-gh1-uea09.nsa.gov [63.239.67.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E8C3F20304 for <patchwork-selinux@patchwork.kernel.org>; Mon, 4 Jan 2016 18:42:39 +0000 (UTC) X-TM-IMSS-Message-ID: <517ef571000227a8@nsa.gov> Received: from tarius.tycho.ncsc.mil ([144.51.242.1]) by nsa.gov ([10.208.42.194]) with ESMTP (TREND IMSS SMTP Service 7.1) id 517ef571000227a8 ; Mon, 4 Jan 2016 13:43:14 -0500 Received: from prometheus.infosec.tycho.ncsc.mil (prometheus [192.168.25.40]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u04IdllI017156; Mon, 4 Jan 2016 13:39:47 -0500 Received: from tarius.tycho.ncsc.mil (tarius.infosec.tycho.ncsc.mil [144.51.242.1]) by prometheus.infosec.tycho.ncsc.mil (8.15.2/8.15.2) with ESMTP id u04I4ePs225777 for <selinux@prometheus.infosec.tycho.ncsc.mil>; Mon, 4 Jan 2016 13:04:40 -0500 Received: from goalie.tycho.ncsc.mil (goalie [144.51.242.250]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u04I4dZf013560 for <selinux@tycho.nsa.gov>; Mon, 4 Jan 2016 13:04:40 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1DxAAAys4pWlLLVVdFeGQEBAQEPAQEBAYRJiFm1aIYPAoFoAQEBAQEBEgEBAQEHCwsJH4RlAQEBAxIVGQEBNwEPUTQBBQEcBgESIogNok6BMT4xileFVAEFjB4BAQEBAQUCARoGCoQ7ghGJI4UYjjWIVpZqhWJEjCo1gReCaA0VB4F8UwGDRIFLAQEB X-IPAS-Result: A1DxAAAys4pWlLLVVdFeGQEBAQEPAQEBAYRJiFm1aIYPAoFoAQEBAQEBEgEBAQEHCwsJH4RlAQEBAxIVGQEBNwEPUTQBBQEcBgESIogNok6BMT4xileFVAEFjB4BAQEBAQUCARoGCoQ7ghGJI4UYjjWIVpZqhWJEjCo1gReCaA0VB4F8UwGDRIFLAQEB X-IronPort-AV: E=Sophos;i="5.20,521,1444708800"; d="scan'208";a="5070760" Received: from emvm-gh1-uea08.nsa.gov ([10.208.42.193]) by goalie.tycho.ncsc.mil with ESMTP; 04 Jan 2016 13:04:39 -0500 X-TM-IMSS-Message-ID: <75b6add50010349f@nsa.gov> Received: from mail-ig0-f178.google.com (mail-ig0-f178.google.com [209.85.213.178]) by nsa.gov ([10.208.42.193]) with ESMTP (TREND IMSS SMTP Service 7.1; TLSv1/SSLv3 AES128-SHA (128/128)) id 75b6add50010349f ; Mon, 4 Jan 2016 13:04:14 -0500 Received: by mail-ig0-f178.google.com with SMTP id ik10so192510igb.1 for <selinux@tycho.nsa.gov>; Mon, 04 Jan 2016 10:04:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DCvnLT65nycMpsxA09TDRCyuGx9zvoBgy7rP6HVW8qA=; b=Xo+NygLfh07sGK+1zL3caCDT5EU3JtUweaL+9sX5xNdfmDVe0nIuGT9TvcxFXHLLez Qfe4jUk+GrmyoCzRvSM76WKQGfgfKZ21dTiKewHhvObdc1nsa03avy7eW+Xpv07/pYBO Tc8lQEYYjYULuLnwE1cgZX8IQCACvvX/l8WSSZ01SJ1dCqyUW1HrlDMW0dEpMZ5K+C9H 087XsKKQubVQpc+hFmsIIxa7Md8NJW8xbw8XPKSLc8wDDSpWkxFOjP7vjCP6Snxmdez5 8gI4erP8oHHDRcaSKGLPZwiTm8x7P1aGv5NZulcdoqZhjNGJCJvTl5nXFZYryQGoe2S9 8OIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DCvnLT65nycMpsxA09TDRCyuGx9zvoBgy7rP6HVW8qA=; b=aKDqKQOV2mW7s/NU+DJFI9MaJw6gnaynRNMnEaU6OHQQFWDkSwWoVmuaBcNM5Jd6o7 YhcEIUqkbQAXXB3u5dtwWLej3Zm+txLzvLjxh5mQwK2ljnPk8q3UwBtvKqvn0PoAr0AY 04EDMMBjYifGLZtVMTCmytEPxoTmJtQzhNqjw2KRpQyUO89G9NyI8swvGUks28yVv25w ywQoPkvpePnPVZNhK6k0QlN009kyf1TOfuYNSI7Bd+nzwQWOHjSPaTiwxh39hVb6Zzxh crtBDrl6gMGqBolJfxQfmKz14Pbpz0LGvYjF9OuaIIHYmztomDC4QN3nfPoMWisfILAf ghEw== X-Gm-Message-State: ALoCoQk+tMKIQVuSqt1iRWSibKtv3ZahauMY5tVy0puZ+euKBlgaqRn0bB1+UCBn8St+p06KKuW41zDPXwiitdlQgmuXJPADCg== X-Received: by 10.50.78.101 with SMTP id a5mr79159255igx.42.1451930678507; Mon, 04 Jan 2016 10:04:38 -0800 (PST) Received: from localhost ([66.64.121.229]) by smtp.gmail.com with ESMTPSA id 124sm34809637ioz.10.2016.01.04.10.04.37 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 04 Jan 2016 10:04:37 -0800 (PST) From: Seth Forshee <seth.forshee@canonical.com> To: "Eric W. Biederman" <ebiederm@xmission.com>, Alexander Viro <viro@zeniv.linux.org.uk> Subject: [PATCH RESEND v2 12/18] fs: Don't remove suid for CAP_FSETID in s_user_ns Date: Mon, 4 Jan 2016 12:03:51 -0600 Message-Id: <1451930639-94331-13-git-send-email-seth.forshee@canonical.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1451930639-94331-1-git-send-email-seth.forshee@canonical.com> References: <1451930639-94331-1-git-send-email-seth.forshee@canonical.com> X-TM-AS-MML: disable X-Mailman-Approved-At: Mon, 04 Jan 2016 13:14:22 -0500 X-BeenThere: selinux@tycho.nsa.gov X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" <selinux.tycho.nsa.gov> List-Post: <mailto:selinux@tycho.nsa.gov> List-Help: <mailto:selinux-request@tycho.nsa.gov?subject=help> Cc: Serge Hallyn <serge.hallyn@canonical.com>, Seth Forshee <seth.forshee@canonical.com>, dm-devel@redhat.com, Miklos Szeredi <miklos@szeredi.hu>, Richard Weinberger <richard.weinberger@gmail.com>, linux-security-module@vger.kernel.org, linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, fuse-devel@lists.sourceforge.net, Austin S Hemmelgarn <ahferroin7@gmail.com>, linux-mtd@lists.infradead.org, selinux@tycho.nsa.gov, linux-fsdevel@vger.kernel.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" <selinux-bounces@tycho.nsa.gov> X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/fs/inode.c b/fs/inode.c index 01c036fe1950..3e7c74da9304 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -1684,7 +1684,8 @@ int should_remove_suid(struct dentry *dentry) if (unlikely((mode & S_ISGID) && (mode & S_IXGRP))) kill |= ATTR_KILL_SGID; - if (unlikely(kill && !capable(CAP_FSETID) && S_ISREG(mode))) + if (unlikely(kill && !ns_capable(dentry->d_sb->s_user_ns, CAP_FSETID) && + S_ISREG(mode))) return kill; return 0;