Message ID | 1461699046-30485-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@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 90C039F1D3 for <patchwork-selinux@patchwork.kernel.org>; Tue, 26 Apr 2016 19:38:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EDB4D2015A for <patchwork-selinux@patchwork.kernel.org>; Tue, 26 Apr 2016 19:38:36 +0000 (UTC) Received: from emsm-gh1-uea11.nsa.gov (emsm-gh1-uea11.nsa.gov [8.44.101.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1E4B32014A for <patchwork-selinux@patchwork.kernel.org>; Tue, 26 Apr 2016 19:38:36 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.24,537,1454976000"; d="scan'208";a="15642597" IronPort-PHdr: =?us-ascii?q?9a23=3A7CnodRPLu1kpozAGQEYl6mtUPXoX/o7sNwtQ0KIM?= =?us-ascii?q?zox0KPX5rarrMEGX3/hxlliBBdydsKIUzbWH+Pm7ASQp2tWojjMrSNR0TRgLiM?= =?us-ascii?q?EbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpQAbFhi3Dwdp?= =?us-ascii?q?POO9QteU1JTnkb/jsMSIO01hv3mUX/BbFF2OtwLft80b08NJC50a7V/3mEZOYP?= =?us-ascii?q?lc3mhyJFiezF7W78a0+4N/oWwL46pyv+YJa6jxfrw5QLpEF3xmdjltvIy4/SXE?= =?us-ascii?q?GEGi/HoXGlpQ2jBJDgTI9hTzWN255ibwt+dx1TOfFd3zTKsvWDOkqaxsTUm7pj?= =?us-ascii?q?0AMmsC/X3XwuJ3lrlbrR/p8wdy346SboaPL/pzc4vWdNUdQ2tKV8IXXCtEVNDv?= =?us-ascii?q?J7ATBvYMaL4L57L2oEED+F7nXVGh?= X-IPAS-Result: =?us-ascii?q?A2EKBQBXwx9X/wHyM5BeHYMbgVC1VYYfIoc6TAEBAQEBAQI?= =?us-ascii?q?CYieCLYIVAQEEAQIkExQgCwMDCQEBFykICAMBKAUVEQYICwUYBIgJxGSGIYhaE?= =?us-ascii?q?QGFdAWOSIlIgVWMRIlPhUBFjmtihAlOh3mBNQEBAQ?= 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 19:38:10 +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 u3QJc6cs012013; Tue, 26 Apr 2016 15:38:07 -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 u3QJUrO1172217 for <selinux@prometheus.infosec.tycho.ncsc.mil>; Tue, 26 Apr 2016 15:30:53 -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 u3QJUoHM010214 for <selinux@tycho.nsa.gov>; Tue, 26 Apr 2016 15:30:53 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BBBQAQwR9X/yUp0ApegziBUIJzsmSCGYtiTAEBAQEBAWYnhEIBBSdSEAhJLCsGE4gqxGeGIY5gBY5IiUiBVYxEiU+FQEWOa2KBNgELgkceMIkuAQEB X-IPAS-Result: A0BBBQAQwR9X/yUp0ApegziBUIJzsmSCGYtiTAEBAQEBAWYnhEIBBSdSEAhJLCsGE4gqxGeGIY5gBY5IiUiBVYxEiU+FQEWOa2KBNgELgkceMIkuAQEB X-IronPort-AV: E=Sophos;i="5.24,537,1454994000"; d="scan'208";a="5410355" 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:30:53 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3ADVN+QRTTlwo0J8ud3sodGeVMNtpsv+yvbD5Q0YIu?= =?us-ascii?q?jvd0So/mwa64bRaN2/xhgRfzUJnB7Loc0qyN4/CmBj1LuM3Z+Fk5M7VyFDY9wf?= =?us-ascii?q?0MmAIhBMPXQWbaF9XNKxIAIcJZSVV+9Gu6O0UGUOz3ZlnVv2HgpWVKQka3CwN5?= =?us-ascii?q?K6zPF5LIiIzvjqbpq82VPFQD3WHlKZpJbzyI7izp/vEMhoVjLqtjgjDomVBvP9?= =?us-ascii?q?ps+GVzOFiIlAz97MrjtLRq8iBXpu5zv5UYCfayV+0CQLdZFDUrNXwurI2u7EGb?= =?us-ascii?q?DFjH2nxJGEgMkxEAPE6NxhD3UprrtyL8/KIp1SObMMH7V7UcSTGj9LxqTxmugy?= =?us-ascii?q?ACYW0X6mbS3/d9kKITjhW7vBxyzsaAe4yJNLxwebnGfd4XbWFIWMFXVidIBsW3?= =?us-ascii?q?aI5ZXLlJBvpRs4So/whGlhC5HwT5Qbq3kjI=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0FPBQDdwB9X/3/oP4hegziBUIJzsmSCG?= =?us-ascii?q?YtiTAEBAQEBAQICYieCLYIVAQUnUhAIEDksKwYTiCrEZ4YhjmAFjkiJSIFVjES?= =?us-ascii?q?JT4VARY5rYoE2AQuCRx4wiS4BAQE?= X-IPAS-Result: =?us-ascii?q?A0FPBQDdwB9X/3/oP4hegziBUIJzsmSCGYtiTAEBAQEBAQI?= =?us-ascii?q?CYieCLYIVAQUnUhAIEDksKwYTiCrEZ4YhjmAFjkiJSIFVjESJT4VARY5rYoE2A?= =?us-ascii?q?QuCRx4wiS4BAQE?= X-IronPort-AV: E=Sophos;i="5.24,537,1454976000"; d="scan'208";a="15642333" Received: from unknown (HELO ubuntu-hedt) ([136.63.232.127]) by emsm-gh1-uea11.nsa.gov with ESMTP; 26 Apr 2016 19:30:52 +0000 Received: by ubuntu-hedt (Postfix, from userid 1000) id 097DE30239F; Tue, 26 Apr 2016 14:30:52 -0500 (CDT) 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:30:34 -0500 Message-Id: <1461699046-30485-12-git-send-email-seth.forshee@canonical.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1461699046-30485-1-git-send-email-seth.forshee@canonical.com> References: <1461699046-30485-1-git-send-email-seth.forshee@canonical.com> X-Mailman-Approved-At: Tue, 26 Apr 2016 15:34:29 -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.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, 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);