Message ID | 1461699396-33000-13-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 84F40BF440 for <patchwork-selinux@patchwork.kernel.org>; Tue, 26 Apr 2016 20:13:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CCDF220138 for <patchwork-selinux@patchwork.kernel.org>; Tue, 26 Apr 2016 20:13:41 +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 2EED6201EF for <patchwork-selinux@patchwork.kernel.org>; Tue, 26 Apr 2016 20:13:40 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.24,538,1454976000"; d="scan'208";a="15644115" IronPort-PHdr: =?us-ascii?q?9a23=3AHwIapRSnwE1NnXhjh7tJns3c69psv+yvbD5Q0YIu?= =?us-ascii?q?jvd0So/mwa65ZxCN2/xhgRfzUJnB7Loc0qyN4/CmBj1LuM3f+Fk5M7VyFDY9wf?= =?us-ascii?q?0MmAIhBMPXQWbaF9XNKxIAIcJZSVV+9Gu6O0UGUOz3ZlnVv2HgpWVKQka3CwN5?= =?us-ascii?q?K6zPF5LIiIzvjqbpq82VPFQD3WHjKZpJbzyI7izp/vEMhoVjLqtjgjDomVBvP9?= =?us-ascii?q?ps+GVzOFiIlAz97MrjtLRq8iBXpu5zv5UYCfayV+0CQLdZFDUrNXwurI2u7EGb?= =?us-ascii?q?DFjH2nxJGEgMkxEAPE6NxhD3UprrtyL8/KIp1SObMMH7V7UcSTGj9LxqTxmugy?= =?us-ascii?q?ACYXpx2WXamsV2gK9B6CygvRs3l5DVeoa9Jvd4f72bedIcWHoHWdxeETFCVNCS?= =?us-ascii?q?dYwKWtEMIeYQgY7nvFsDoFPqHgSwBKXhzSVThnL79aYz1eMnEArP2EorGNdY4y?= =?us-ascii?q?ecl8n8KKpHCbP996LP1ziWKqoOgTo=3D?= X-IPAS-Result: =?us-ascii?q?A2EJBQBiyx9X/wHyM5BeHAGCcCuBULt0IoF2hUVMAQEBAQE?= =?us-ascii?q?BAgJiJ4ItfVs9AQEBAwECDxUTBgEBDCALAQIDCQEBFykICAMBLQMBBQELEQYBB?= =?us-ascii?q?wsFGAQBiAgBpVGBMT4xik+FKAEEjEcBCgEBARYGCoQNggqIWhEBhXQBjkyJSIF?= =?us-ascii?q?VjESJKiWFQEWNLTCBDmKCBRuBaU4Bh3iBNQEBAQ?= 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:05 +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 u3QKD41G022118; Tue, 26 Apr 2016 16:13:04 -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 u3QJb7w7172315 for <selinux@prometheus.infosec.tycho.ncsc.mil>; Tue, 26 Apr 2016 15:37:07 -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 u3QJak01011587 for <selinux@tycho.nsa.gov>; Tue, 26 Apr 2016 15:37:06 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0A+BQD9wR9X/yUp0ApeHYJwK4FQt3CEEYYPAoFATAEBAQEBAWYnhEIBAQEDEhUZAQE3AQ9RNAEFARwGARIiiAgBpVeBMT4xik+FKAEEjEoBAQEBAQUCARcGCoQNggqOYI5NiUiBVYxEiSqFZUWNLTCBDmKBeA0bgWlOAYktAQEB X-IPAS-Result: A0A+BQD9wR9X/yUp0ApeHYJwK4FQt3CEEYYPAoFATAEBAQEBAWYnhEIBAQEDEhUZAQE3AQ9RNAEFARwGARIiiAgBpVeBMT4xik+FKAEEjEoBAQEBAQUCARcGCoQNggqOYI5NiUiBVYxEiSqFZUWNLTCBDmKBeA0bgWlOAYktAQEB X-IronPort-AV: E=Sophos;i="5.24,537,1454994000"; d="scan'208";a="5410387" Received: from emsm-gh1-uea11.corp.nsa.gov (HELO emsm-gh1-uea11.nsa.gov) ([10.208.41.37]) by goalie.tycho.ncsc.mil with ESMTP; 26 Apr 2016 15:37:07 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3A4ZOQIBVmtRedd2NFjXUns5y6UwbV8LGtZVwlr6E/?= =?us-ascii?q?grcLSJyIuqrYZxeDt8tkgFKBZ4jH8fUM07OQ6PCwHzNRqs/a6DgrS99laVwssY?= =?us-ascii?q?0uhQsuAcqIWwXQDcXBSGgEJvlET0Jv5HqhMEJYS47UblzWpWCuv3ZJQk2sfTR8?= =?us-ascii?q?Kum9IIPOlcP/j7n0oM2DJVoZz2PmOftbF1afk0b4joEum4xsK6I8mFPig0BjXK?= =?us-ascii?q?Bo/15uPk+ZhB3m5829r9ZJ+iVUvO89pYYbCf2pN4xxd7FTDSwnPmYp/4Wr8ECb?= =?us-ascii?q?FUrcrkcbBy87iBtDSzeDpDv7U5v8qC7zsKA1jCSQPMD6QKoxcSSn7rxwSRjuzi?= =?us-ascii?q?wAMmh9uEjTh9x5iq5WulqfpgZ4i9rKYZuSHOhzeKLDO9cbQ3dRGMFLWGpcAdXv?= =?us-ascii?q?QZEICr86MPpY56f6vUAOoBb2URKhGOOpxDhSnX/70IUx2uImFwDN1QhmFNUL5i?= =?us-ascii?q?eH5O7pPbsfBLjmhJLDyi/OOrYPgW/w?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0HzAAD9wR9Xj67fVdFeHYJwgXu3cIQRg?= =?us-ascii?q?g2EAgKBQEwBAQEBAQECAg8BAQEBBwsLCSEvgi19Wz0BAQEDEhUZAQE3AQ9RNAE?= =?us-ascii?q?FARwGARIiiAgBpVeBMT4xik+FKAEEjEoBAQEBAQUCARcGCoQNggqOYI5NiUiBV?= =?us-ascii?q?YxEiSqFZUWNLTCBDoJaDREKgWlOAYktAQEB?= X-IPAS-Result: =?us-ascii?q?A0HzAAD9wR9Xj67fVdFeHYJwgXu3cIQRgg2EAgKBQEwBAQE?= =?us-ascii?q?BAQECAg8BAQEBBwsLCSEvgi19Wz0BAQEDEhUZAQE3AQ9RNAEFARwGARIiiAgBp?= =?us-ascii?q?VeBMT4xik+FKAEEjEoBAQEBAQUCARcGCoQNggqOYI5NiUiBVYxEiSqFZUWNLTC?= =?us-ascii?q?BDoJaDREKgWlOAYktAQEB?= X-IronPort-AV: E=Sophos;i="5.24,537,1454976000"; d="scan'208";a="15642558" Received: from mail-io0-f174.google.com ([209.85.223.174]) by emsm-gh1-uea11.nsa.gov with ESMTP/TLS/AES128-GCM-SHA256; 26 Apr 2016 19:37:05 +0000 Received: by mail-io0-f174.google.com with SMTP id 190so20531378iow.1 for <selinux@tycho.nsa.gov>; Tue, 26 Apr 2016 12:37:05 -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=LUhYzISw0G2DIz5rM62jeSXUgZ+pb/C+JtO97YPul0s=; b=vj5Okaz9tbyq2oHLCOjdgQXWsFryTqR7MUMXMxBh6wncx+5xkmQ53N/Rx22G3gF2O1 dvd1TXwZAccy42iV3GLnS0LkGcbD3TRuSlu2jp+6QlnJzHbm9oUkLa5qYcxaME/484WO Dcps6NK2HRH2maQf22afWEDZbrvZQcJBsF/qF0BkIKSAP8dGS6qOFJm9gBofvte5a/L8 nRydmcHquVwc5SkeiUy7hsGfL/Ah2obEhoJKBhQ1bLpmWrXxn6xsuSWk9v9b/Jy6ibz0 Wqpio/1begSJkPyeBT8TaJA/PieIC73XMii/alJLtYNIRUaJt82Igd4cpWLGDfgbEqvq 8yQA== 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=LUhYzISw0G2DIz5rM62jeSXUgZ+pb/C+JtO97YPul0s=; b=RjBj5XCEZSnVjct/S4py/uM2P/5TMp+16QbENstKb1Id00YQXr1jwpVcEfI2CuC+OV L8QDUF5v9v7QSc5GM9kzINbG7mtqJ1GEzn0DXIoyfQdJu0Pcdzj2JXovr49YDtwxFwR8 Gx4IlSF1ppvdUcXFOmLI/HQa4fUw9I9afVNgRP3x2orQxKudcPuI5rL9etd8ux1AytN7 TsnDduJdQu9idFwtvbxvSfiQeIfUqqT6SCJhEyAu5GRVjw3blvow/T2FrD6OeyIjykhB 6ReKNKqZkwQ4YVGBYM3mO2z7ppNvS2ENlUioKmCYKmt3laH1AGVbbQ4neM7l1Qln0JLI HXhg== X-Gm-Message-State: AOPr4FU0OC3N+lDd+2J9FhZmIlgWbmv6VG5wgr/dcc/qlkU08AuYlvQ+gmoTm0Wtrm/vA/I7 X-Received: by 10.107.148.210 with SMTP id w201mr5749463iod.63.1461699425371; Tue, 26 Apr 2016 12:37:05 -0700 (PDT) Received: from localhost ([2605:a601:aab:f920:39a1:5bcf:aa:5b00]) by smtp.gmail.com with ESMTPSA id 69sm2384297ioo.20.2016.04.26.12.37.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Apr 2016 12:37:04 -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 12/21] fs: Refuse uid/gid changes which don't map into s_user_ns Date: Tue, 26 Apr 2016 14:36:25 -0500 Message-Id: <1461699396-33000-13-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:01 -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/attr.c b/fs/attr.c index 25b24d0f6c88..3cfaaac4a18e 100644 --- a/fs/attr.c +++ b/fs/attr.c @@ -42,6 +42,17 @@ int inode_change_ok(const struct inode *inode, struct iattr *attr) return error; } + /* + * Verify that uid/gid changes are valid in the target namespace + * of the superblock. This cannot be overriden using ATTR_FORCE. + */ + if (ia_valid & ATTR_UID && + from_kuid(inode->i_sb->s_user_ns, attr->ia_uid) == (uid_t)-1) + return -EOVERFLOW; + if (ia_valid & ATTR_GID && + from_kgid(inode->i_sb->s_user_ns, attr->ia_gid) == (gid_t)-1) + return -EOVERFLOW; + /* If force is set do it anyway. */ if (ia_valid & ATTR_FORCE) return 0;