Message ID | 1461699396-33000-16-git-send-email-seth.forshee@canonical.com (mailing list archive) |
---|---|
State | New, archived |
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 BA2A2BF29F for <patchwork-selinux@patchwork.kernel.org>; Tue, 26 Apr 2016 20:13:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 17F9520138 for <patchwork-selinux@patchwork.kernel.org>; Tue, 26 Apr 2016 20:13:48 +0000 (UTC) Received: from emsm-gh1-uea11.nsa.gov (emsm-gh1-uea11.nsa.gov [8.44.101.9]) by mail.kernel.org (Postfix) with ESMTP id 356AE201EF for <patchwork-selinux@patchwork.kernel.org>; Tue, 26 Apr 2016 20:13:47 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.24,538,1454976000"; d="scan'208";a="15644161" IronPort-PHdr: =?us-ascii?q?9a23=3AcWI+Nxw4gBZtkgbXCy+O+j09IxM/srCxBDY+r6Qd?= =?us-ascii?q?0OkSIJqq85mqBkHD//Il1AaPBtWLra0VwLON7ejJYi8p39WoiDg6aptCVhsI24?= =?us-ascii?q?09vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6kO74TNaIBjjLw09?= =?us-ascii?q?fr2zQd6CyZvmnLnppdX6WEZhunmUWftKNhK4rAHc5IE9oLBJDeIP8CbPuWZCYO?= =?us-ascii?q?9MxGlldhq5lhf44dqsrtY4q3wD89pozcNLUL37cqIkVvQYSW1+ayFmrPHs4FPu?= =?us-ascii?q?VwqErkRaGk8XnxZFGQ3M6luyCpr7syb2u/B48DmfPNbtTLcyHz+l6vEvADbshT?= =?us-ascii?q?cOMTI06inpi9Z3xPZFoQimjw5yxY/KJoWUMuduOKTHcpUHRjwScNxWUnl6D5+8?= =?us-ascii?q?J6UIFfEBMOsQ+5Lwu1tIoxykHgmhCcvkwzlPgH791Kl82OMkR1KVlDc8Fs4D5S?= =?us-ascii?q?yH5O7+M70fBKXslPHF?= X-IPAS-Result: =?us-ascii?q?A2EJBQBiyx9X/wHyM5BeHAGCcCuBULt0IoF2hUVMAQEBAQE?= =?us-ascii?q?BAgJiJ4ItfVs9AQEBAwECDxUTBgEBDCALAQIDCQEBFykICAMBLQMBBQELEQYBB?= =?us-ascii?q?wsFGAQBiAgBpVGBMT4xik+FKAEEjEcBAQgBAQEBFgYKhA2CCohYAhEBhXQBjky?= =?us-ascii?q?JSIFVjESJKiWFQEWNLTCBDmKCBRuBaU4Bh28JF4EeAQEB?= Received: from unknown (HELO tarius.tycho.ncsc.mil) ([144.51.242.1]) by emsm-gh1-uea11.nsa.gov with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Apr 2016 20:13:18 +0000 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 u3QKDH67022235; Tue, 26 Apr 2016 16:13:18 -0400 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 u3QJbBTY172324 for <selinux@prometheus.infosec.tycho.ncsc.mil>; Tue, 26 Apr 2016 15:37:11 -0400 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 u3QJak04011587 for <selinux@tycho.nsa.gov>; Tue, 26 Apr 2016 15:37:11 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0A+BQD9wR9X/yQp0ApeHYJwK4FQt3CEEYYPAoFATAEBAQEBAWYnhEIBAQEDEhUZAQE3AQ9RNAEFARwGARIiiAgBpVeBMT4xik+FKAEEjEoBAQEBAQUCARcGCoQNggqIWIYIjk2JSIFVjESJKoVlRY0tMIEOYoF4DRuBaU4Bh2+BPgEBAQ X-IPAS-Result: A0A+BQD9wR9X/yQp0ApeHYJwK4FQt3CEEYYPAoFATAEBAQEBAWYnhEIBAQEDEhUZAQE3AQ9RNAEFARwGARIiiAgBpVeBMT4xik+FKAEEjEoBAQEBAQUCARcGCoQNggqIWIYIjk2JSIFVjESJKoVlRY0tMIEOYoF4DRuBaU4Bh2+BPgEBAQ X-IronPort-AV: E=Sophos;i="5.24,537,1454994000"; d="scan'208";a="5410390" Received: from emsm-gh1-uea10.corp.nsa.gov (HELO emsm-gh1-uea10.nsa.gov) ([10.208.41.36]) by goalie.tycho.ncsc.mil with ESMTP; 26 Apr 2016 15:37:11 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3AUby4ORaa/Sq3MDGw3bR6sjL/LSx+4OfEezUN459i?= =?us-ascii?q?sYplN5qZpM++bnLW6fgltlLVR4KTs6sC0LqG9f+xEjVbud6oizMrTt9lb1c9k8?= =?us-ascii?q?IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUiv2OQc9?= =?us-ascii?q?HOnpAIma153xjLDivcKCKFwT3HKUWvBbElaflU3prM4YgI9veO4a6yDihT92Qd?= =?us-ascii?q?lQ3n5iPlmJnhzxtY+a9Z9n9DlM6bp6r5YTGY2zRakzTKRZATI6KCh1oZSz7ViQ?= =?us-ascii?q?BTeIszExSGQd2iUOSyLE4R33RJL4tGGy4ud32SSWMNfzZaAxWC+57qBtDhTvjX?= =?us-ascii?q?FDfxc9/XHejMB9luploQim70hhwpTTSJOYMvtgOKfce84KA21bUYBMVHoSLJm7?= =?us-ascii?q?at40AvYBdchftZL9qlZG+QCzGQnqCuT10T9Fi1f91Ks91eUqGAWA1wslSYFd+E?= =?us-ascii?q?/Ipcn4Yf9BGdu+y7PFmHCaN6tb?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0HzAAC5wh9Xj7PVVdFeHYJwgXu3cIQRg?= =?us-ascii?q?g2EAgKBQEwBAQEBAQECAg8BAQEBBwsLCSEvgi19Wz0BAQEDEhUZAQE3AQ9RNAE?= =?us-ascii?q?FARwGARIiiAgBpVeBMT4xik+FKAEEjEoBAQEBAQUCARcGCoQNggqIWIYIjk2JS?= =?us-ascii?q?IFVjESJKoVlRY0tMIEOgloNEQqBaU4Bh2+BPgEBAQ?= X-IPAS-Result: =?us-ascii?q?A0HzAAC5wh9Xj7PVVdFeHYJwgXu3cIQRgg2EAgKBQEwBAQE?= =?us-ascii?q?BAQECAg8BAQEBBwsLCSEvgi19Wz0BAQEDEhUZAQE3AQ9RNAEFARwGARIiiAgBp?= =?us-ascii?q?VeBMT4xik+FKAEEjEoBAQEBAQUCARcGCoQNggqIWIYIjk2JSIFVjESJKoVlRY0?= =?us-ascii?q?tMIEOgloNEQqBaU4Bh2+BPgEBAQ?= X-IronPort-AV: E=Sophos;i="5.24,537,1454976000"; d="scan'208";a="13051021" Received: from mail-ig0-f179.google.com ([209.85.213.179]) by emsm-gh1-uea10.nsa.gov with ESMTP/TLS/AES128-GCM-SHA256; 26 Apr 2016 19:37:10 +0000 Received: by mail-ig0-f179.google.com with SMTP id u10so52245908igr.1 for <selinux@tycho.nsa.gov>; Tue, 26 Apr 2016 12:37:10 -0700 (PDT) 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=6wp+PLaoRzmNmk4QzmosQuFHoGYfjs+oQVk8R8M0s9M=; b=nU6xY84n4EcejeABOJPlpQWzlde2y+gFYrVPYMyDw1oMv+Ckh/I2EHW6oNDifmvrwA F+iPl3QW86jymi1Vp/jPHJ1geMzZUAZ1pa1837hWkqt2UqKq8/XQx0SppP++sV1dGGs2 rLPDifC0r4rxeoUHXQr+AG5Qa0EHjvAkoERETXyCrwFZYuHebrfTNW2t1aPmr/3Lnh8n LXTomFFahH4N9OZyZZO7hr8Ii7XpQsXZESqu7KzGLFS57kaPLjUzfGSmj0Kso8ydAZSw 5EFdNlScxed0nPc31FaQJlonYCM4gC59k/Bu4h4feOLfNcLUTW8AIisgX/HhwcoSzNiT xOvw== 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=6wp+PLaoRzmNmk4QzmosQuFHoGYfjs+oQVk8R8M0s9M=; b=Mg1dTZWun4fLlMTgk37apfYSKzfpdB+fGfJAbHWV5WOBWz14dOrUP5bXqdvkSobMXZ dx04QShDMAt0RuSF8WSSZgLLy/9pg8Z9whmrPWBTEtEH9Dl5W8EPGfHUyU+r1Ola19Bf 1lPuTfH9ikStbzoGaCgQ70HwDeZq44conJC/reJ7OGMfX/sQTft4afYLVvQSVDXJ/pQ5 aUtzHub+Hx/6Pfvetgem6P+P6o5ms2Gmo/3mqEE68OKVW84fUQXZ2sHBQ0KQ3vywZK9g P1LJHVLZCZuq8liwM17ZevklOMjiwimM2szbcgqQZeBafTEC+aaytijHCjSUvIpgbYZg ZlzA== X-Gm-Message-State: AOPr4FXXIR9tZuGmIRFsJvcuFo4qiGnzlAHOOTVzR+8wO0MN+4aFA0ZFN+ESsPFdGro80L1w X-Received: by 10.50.164.165 with SMTP id yr5mr20785114igb.48.1461699429881; Tue, 26 Apr 2016 12:37:09 -0700 (PDT) Received: from localhost ([2605:a601:aab:f920:39a1:5bcf:aa:5b00]) by smtp.gmail.com with ESMTPSA id m143sm2346548ioe.43.2016.04.26.12.37.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Apr 2016 12:37:09 -0700 (PDT) From: Seth Forshee <seth.forshee@canonical.com> To: "Eric W. Biederman" <ebiederm@xmission.com>, Alexander Viro <viro@zeniv.linux.org.uk> Subject: [PATCH v4 15/21] fs: Don't remove suid for CAP_FSETID in s_user_ns Date: Tue, 26 Apr 2016 14:36:28 -0500 Message-Id: <1461699396-33000-16-git-send-email-seth.forshee@canonical.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1461699396-33000-1-git-send-email-seth.forshee@canonical.com> References: <1461699396-33000-1-git-send-email-seth.forshee@canonical.com> X-Mailman-Approved-At: Tue, 26 Apr 2016 16:11:02 -0400 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: linux-bcache@vger.kernel.org, Serge Hallyn <serge.hallyn@canonical.com>, Seth Forshee <seth.forshee@canonical.com>, dm-devel@redhat.com, Miklos Szeredi <mszeredi@redhat.com>, Richard Weinberger <richard.weinberger@gmail.com>, linux-security-module@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, cgroups@vger.kernel.org, Pavel Tikhomirov <ptikhomirov@virtuozzo.com> 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=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, 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 69b8b526c194..cd52170f9117 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -1690,7 +1690,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;