Message ID | 1461699396-33000-12-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 D2472BF29F for <patchwork-selinux@patchwork.kernel.org>; Tue, 26 Apr 2016 20:13:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2ACDB2014A for <patchwork-selinux@patchwork.kernel.org>; Tue, 26 Apr 2016 20:13:04 +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 4E90520138 for <patchwork-selinux@patchwork.kernel.org>; Tue, 26 Apr 2016 20:13:03 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.24,538,1454976000"; d="scan'208";a="15644105" IronPort-PHdr: =?us-ascii?q?9a23=3AWmx+8BCgzQeq4laKZyV3UyQJP3N1i/DPJgcQr6Af?= =?us-ascii?q?oPdwSP7ypcbcNUDSrc9gkEXOFd2CrakU26yJ4uu5AjJIyK3CmU5BWaQEbwUCh8?= =?us-ascii?q?QSkl5oK+++Imq/EsTXaTcnFt9JTl5v8iLzG0FUHMHjew+a+SXqvnYsExnyfTB4?= =?us-ascii?q?Ov7yUtaLyZ/nh6btqtaKOFsArQH+SI0xBS3+lR/WuMgSjNkqAYcK4TyNnEF1ff?= =?us-ascii?q?9Lz3hjP1OZkkW0zM6x+Jl+73YY4Kp5pIZoGJ/3dKUgTLFeEC9ucyVsvJWq5lH/?= =?us-ascii?q?Sl7Fy2EdWS0p1FJiAgXJ4Qv/V5G7+n/3vOtw1CSAOOXmSLEvQjWl6eFgTxq+2w?= =?us-ascii?q?kdMDtsy2zLioRei7hAoB+s70hkzpLUJo+SLuF+c671dtocQmxAVc9VESdGB9Xv?= =?us-ascii?q?PMM0E+MdMLMA/MHGrFwUoE77XFH0CQ=3D=3D?= X-IPAS-Result: =?us-ascii?q?A2EPBQBzyh9X/wHyM5BeHYJwK4FQtVWGHyKBdoVFTAEBAQE?= =?us-ascii?q?BAQICYieCLX1bPQEBAQMBAg8VEwYBAQwgCwECAwkBARcpCAgDAS0DAQUBCxEGC?= =?us-ascii?q?AsFGAQBiAgBpVWBMT4xik+FKAEEjEYMGAYKhA2CCohaEQGFdAGOTIlIgVWMRIk?= =?us-ascii?q?qJYVARY0tMIEOYoQJTgGHeIE1AQEB?= 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:02 +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 u3QKCxP7021952; Tue, 26 Apr 2016 16:13:00 -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 u3QJb5J4172312 for <selinux@prometheus.infosec.tycho.ncsc.mil>; Tue, 26 Apr 2016 15:37:05 -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 u3QJak00011587 for <selinux@tycho.nsa.gov>; Tue, 26 Apr 2016 15:37:05 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BABQD9wR9X/yQp0Apegw0rgVC1V4IZhBGGDwKBQEwBAQEBAQFmJ4RCAQEBAxIVGQEBNwEPUTQBBQEcBhMiiAgBpVeBMT4xik+FKAEEjEoBAQEBBgIBFwYKhA2CCo5gjk2JSIFVjESJKoVlRY0tMIEOYoF4ghFOAYktAQEB X-IPAS-Result: A0BABQD9wR9X/yQp0Apegw0rgVC1V4IZhBGGDwKBQEwBAQEBAQFmJ4RCAQEBAxIVGQEBNwEPUTQBBQEcBhMiiAgBpVeBMT4xik+FKAEEjEoBAQEBBgIBFwYKhA2CCo5gjk2JSIFVjESJKoVlRY0tMIEOYoF4ghFOAYktAQEB X-IronPort-AV: E=Sophos;i="5.24,537,1454994000"; d="scan'208";a="5410386" 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:05 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3AGFIp5RyHVcD+jCLXCy+O+j09IxM/srCxBDY+r6Qd?= =?us-ascii?q?0eMUIJqq85mqBkHD//Il1AaPBtWLra0VwLON6+jJYi8p39WoiDg6aptCVhsI24?= =?us-ascii?q?09vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6kO74TNaIBjjLw09?= =?us-ascii?q?fr2zQd6CyZvmnLnpo9X6WEZhunmUWftKNhK4rAHc5IE9oLBJDeIP8CbPuWZCYO?= =?us-ascii?q?9MxGlldhq5lhf44dqsrtY4q3wD89pozcNLUL37cqIkVvQYSW1+ayFmrPHs4FPu?= =?us-ascii?q?VwqErkRaGk8XnxZFGQ3M6luyCpr7syb2u/B48DmfPNbtTLcyHz+l6vE4ZgXvjX?= =?us-ascii?q?I8OiI5uE/QkNdwga8T9Amsuxw5zYnOe4GYOdJ1d6Xae9IRTG4HVcFUAX8SSrig?= =?us-ascii?q?ZpcCWrJSdd1TqJPw8h5X9UOz?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0HzAAC5wh9Xj6zVVdFegw2Be7VXghmEE?= =?us-ascii?q?YINhAICgUBMAQEBAQEBAgIPAQEBAQcLCwkhL4ItfVs9AQEBAxIVGQEBNwEPUTQ?= =?us-ascii?q?BBQEcBhMiiAgBpVeBMT4xik+FKAEEjEoBAQEBBgIBFwYKhA2CCo5gjk2JSIFVj?= =?us-ascii?q?ESJKoVlRY0tMIEOgloegXNOAYktAQEB?= X-IPAS-Result: =?us-ascii?q?A0HzAAC5wh9Xj6zVVdFegw2Be7VXghmEEYINhAICgUBMAQE?= =?us-ascii?q?BAQEBAgIPAQEBAQcLCwkhL4ItfVs9AQEBAxIVGQEBNwEPUTQBBQEcBhMiiAgBp?= =?us-ascii?q?VeBMT4xik+FKAEEjEoBAQEBBgIBFwYKhA2CCo5gjk2JSIFVjESJKoVlRY0tMIE?= =?us-ascii?q?OgloegXNOAYktAQEB?= X-IronPort-AV: E=Sophos;i="5.24,537,1454976000"; d="scan'208";a="13051016" Received: from mail-ig0-f172.google.com ([209.85.213.172]) by emsm-gh1-uea10.nsa.gov with ESMTP/TLS/AES128-GCM-SHA256; 26 Apr 2016 19:37:04 +0000 Received: by mail-ig0-f172.google.com with SMTP id c3so9847545igl.0 for <selinux@tycho.nsa.gov>; Tue, 26 Apr 2016 12:37:04 -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=Lo5iDM9zOZrtGAL6ADxgGtKcisaTOotUC/Wi0eo0ick=; b=hq3y5nkEE07FBHvEIenezdBWbg2OxjuJsKUBaZmravKXF5GOYm7v4XlO3qcZ0SrNx5 WTbPJzxF0NA5H42jKruazM3pizXc/fzdSBgZKgGPNLs5Y+ZgTgUPaZxAcru3A6OPymq3 ZwS0W5ypsKKsatDarhSyJvQvdnOmdE8FW5cTPVf+Ry/VUIWN3Br7yM1QGf/RgFXxYA++ n3VwUCZg839UYYfb8SxyuHILl3nj46c92fIkvLraY0ZlklrqyCqk1gOJxUZb4itxTZ8L ZyJTmJmrybtIrJASKRwi8XWXiPedBvMPkGw38de+TPxXMUM4BeT313Pcx+ZRVQEdJxez PKoQ== 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=Lo5iDM9zOZrtGAL6ADxgGtKcisaTOotUC/Wi0eo0ick=; b=ECwKmFUSVAHlZJkHPGL6ud6ytHEDy724qrXxyiDCqufLivE38orCcXIQf6rwvxsw6i o8+yjPCgaWmQTzRM+cWJ6ykp4tEnigjMxMgY3q5Fa1FeajfcnHMXTzJ7FiN+9knCKrp5 /LUXKc7BLVLns87GPSn8vhfJPQy4Dk6aHfwFWp3SOWk11zgYPcR0JpiLEzKSaRDiSOe+ 2WSlhpggqbebT6pVOMqOEB1gCpkrPC6MWeLWOU4Stq+ZqP1NGZUgczxrzAQ636QjMsuQ Q/3drMXnIdXzEK+6Q2EvKaaiEFjtJQlKzUFhdpxMWnVVzMfqqFzBjEjUZxnuMXXENG5o L8vw== X-Gm-Message-State: AOPr4FWHsU8E4rxXnqWSisFv/+PW8ZfciLdYo3edg2M7iD36uWVY4MBVy7kc2y3SCTDBEp05 X-Received: by 10.50.50.143 with SMTP id c15mr20781827igo.44.1461699424078; Tue, 26 Apr 2016 12:37:04 -0700 (PDT) Received: from localhost ([2605:a601:aab:f920:39a1:5bcf:aa:5b00]) by smtp.gmail.com with ESMTPSA id k3sm9850064igz.2.2016.04.26.12.37.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Apr 2016 12:37:03 -0700 (PDT) From: Seth Forshee <seth.forshee@canonical.com> To: "Eric W. Biederman" <ebiederm@xmission.com> Subject: [PATCH v4 11/21] cred: Reject inodes with invalid ids in set_create_file_as() Date: Tue, 26 Apr 2016 14:36:24 -0500 Message-Id: <1461699396-33000-12-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, Alexander Viro <viro@zeniv.linux.org.uk>, 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/kernel/cred.c b/kernel/cred.c index 0c0cd8a62285..5f264fb5737d 100644 --- a/kernel/cred.c +++ b/kernel/cred.c @@ -689,6 +689,8 @@ EXPORT_SYMBOL(set_security_override_from_ctx); */ int set_create_files_as(struct cred *new, struct inode *inode) { + if (!uid_valid(inode->i_uid) || !gid_valid(inode->i_gid)) + return -EINVAL; new->fsuid = inode->i_uid; new->fsgid = inode->i_gid; return security_kernel_create_files_as(new, inode);