Message ID | 1461339521-123191-12-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@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 CB80F9F39A for <patchwork-selinux@patchwork.kernel.org>; Fri, 22 Apr 2016 15:54:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2CB4D2014A for <patchwork-selinux@patchwork.kernel.org>; Fri, 22 Apr 2016 15:54:53 +0000 (UTC) Received: from emvm-gh1-uea08.nsa.gov (emvm-gh1-uea08.nsa.gov [8.44.101.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 24A9120149 for <patchwork-selinux@patchwork.kernel.org>; Fri, 22 Apr 2016 15:54:51 +0000 (UTC) X-TM-IMSS-Message-ID: <61c12c4100000a6e@nsa.gov> Received: from tarius.tycho.ncsc.mil ([144.51.242.1]) by nsa.gov ([10.208.42.193]) with ESMTP (TREND IMSS SMTP Service 7.1) id 61c12c4100000a6e ; Fri, 22 Apr 2016 11:50:45 -0400 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 u3MFpLvJ008612; Fri, 22 Apr 2016 11:51:21 -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 u3MFdlBm105305 for <selinux@prometheus.infosec.tycho.ncsc.mil>; Fri, 22 Apr 2016 11:39:47 -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 u3MFdlDS004476 for <selinux@tycho.nsa.gov>; Fri, 22 Apr 2016 11:39:47 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CsBABlRRpX/yUp0Apegw2Be7VeghmEEIYOAoF0AQEBAQEBZieEQgEBAQMSFRkBATcBD1E0AQUBHAYTIogIAaBwgTE+MYpPhSgBBIxcAQEBAQYCARcGCoQNggqOYAGOS4lIgVWMQYkphWVFjSwwgQ5igXiCEU4BiHoBAQE X-IPAS-Result: A0CsBABlRRpX/yUp0Apegw2Be7VeghmEEIYOAoF0AQEBAQEBZieEQgEBAQMSFRkBATcBD1E0AQUBHAYTIogIAaBwgTE+MYpPhSgBBIxcAQEBAQYCARcGCoQNggqOYAGOS4lIgVWMQYkphWVFjSwwgQ5igXiCEU4BiHoBAQE X-IronPort-AV: E=Sophos;i="5.24,517,1454994000"; d="scan'208";a="5402624" 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; 22 Apr 2016 11:39:23 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3A3ejGNBZDRWafSMWuK7eGek//LSx+4OfEezUN459i?= =?us-ascii?q?sYplN5qZpcW6bnLW6fgltlLVR4KTs6sC0LqG9f+4Ejxcqb+681k8M7V0Hycfjs?= =?us-ascii?q?sXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aJBzzOEJP?= =?us-ascii?q?K/jvHcaK1oLsh7D0pMWYM1kArQH+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-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A1EiAQCfQhpXjzTaVdFegw2Be7VeghmEE?= =?us-ascii?q?IINhAECgXQBAQEBAQECAg8BAQEBBwsLCSGCXH1bPQEBAQMSFRkBATcBD1E0AQU?= =?us-ascii?q?BHAYTIogIAaBsgTE+MYpPhSgBBIxdAQEBAQYCARcGCoQNggqOYI5MiUiBVYxBi?= =?us-ascii?q?SmFZUWNLDCBDoJaHoFzTgGIegEBAQ?= X-IPAS-Result: =?us-ascii?q?A1EiAQCfQhpXjzTaVdFegw2Be7VeghmEEIINhAECgXQBAQE?= =?us-ascii?q?BAQECAg8BAQEBBwsLCSGCXH1bPQEBAQMSFRkBATcBD1E0AQUBHAYTIogIAaBsg?= =?us-ascii?q?TE+MYpPhSgBBIxdAQEBAQYCARcGCoQNggqOYI5MiUiBVYxBiSmFZUWNLDCBDoJ?= =?us-ascii?q?aHoFzTgGIegEBAQ?= X-IronPort-AV: E=Sophos;i="5.24,517,1454976000"; d="scan'208";a="15532487" Received: from emvm-gh1-uea09.nsa.gov ([10.208.42.194]) by emsm-gh1-uea11.nsa.gov with ESMTP/TLS/DHE-RSA-AES256-SHA; 22 Apr 2016 15:39:18 +0000 X-TM-IMSS-Message-ID: <ad947f5c00000636@nsa.gov> Received: from mail-oi0-f52.google.com (mail-oi0-f52.google.com [209.85.218.52]) by nsa.gov ([10.208.42.194]) with ESMTP (TREND IMSS SMTP Service 7.1; TLSv1/SSLv3 AES128-SHA (128/128)) id ad947f5c00000636 ; Fri, 22 Apr 2016 11:38:51 -0400 Received: by mail-oi0-f52.google.com with SMTP id r78so120776181oie.0 for <selinux@tycho.nsa.gov>; Fri, 22 Apr 2016 08:39:17 -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=0m4ffYALMihro6bdklmIe2XMfJSlAnRWQ33d61k9VBs=; b=XGzaWnpz9XTKp+S/HxsnArXw/nLxWb+HvF5BBf1WHRoY7tFSYeAKD5IRSzSEYItaK1 LaKuV8SwtBn31Td2mxb2HajN44tzJEANEbruJLxYsehKMkirCUBg9Akvq6V+DSGthL5J FGVwXckTF1hMHW86i4BjRakr6xvpf9Zw8pRjPPJ4lRq3ykxrd+ULeQSLnPslTVhEvfoe 4y9cSe1ucW96hREF0SnBpUCSU3OqLCHLSTywsBiBNbTcqhalSTXwbuA5mGXsndjlReei FrJPR7kda4faq38zt/pn4PSEi2CrYtH6b8ixK3DBQcR9FKQ+T60fh/Dlu3QxYypSmRRF 5BVQ== 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=0m4ffYALMihro6bdklmIe2XMfJSlAnRWQ33d61k9VBs=; b=LheZbgIkXM1S1NcRgfrumhfqcS12TjQk8YiIMIomwY0osp9wLsKQzQoucM9VyvfYH3 ZWeDvq5zqlV0Loo057N2+ZdS8MnJUAWe/ZbTiLFCa4jAMfKqFZ/pSzkXigs4wR0iOanG 08J1z6cEJC/mmggLARUINo2z98FX5z+04v9aE+MBFSbE3IHfSW6H2e45Ad7/WPCopuqn bMYrdk/3CtAsQwVet3AmBRYIUrDszqOM2adcwS3UJDuPm4/FBtNun/e+v3M26IcezHvC bGy3VBYdN+KBqw553R8Izye8AN/TIwPJ9YNLY0zVO6saoKXM3hXFsF2Q1YSpnT8+/N70 Ro2Q== X-Gm-Message-State: AOPr4FXI1vUX/vtpHxX9elqcxDzxi7GtbV/B1OPvnCxgXbb65Y02o2uqWWnlwEp+TjKZrSyO X-Received: by 10.202.224.70 with SMTP id x67mr9173568oig.124.1461339557039; Fri, 22 Apr 2016 08:39:17 -0700 (PDT) Received: from localhost ([2605:a601:aab:f920:ad1c:41df:dcb1:a4a0]) by smtp.gmail.com with ESMTPSA id e189sm2060939oig.10.2016.04.22.08.39.16 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 22 Apr 2016 08:39:16 -0700 (PDT) From: Seth Forshee <seth.forshee@canonical.com> To: "Eric W. Biederman" <ebiederm@xmission.com> Subject: [PATCH v3 11/21] cred: Reject inodes with invalid ids in set_create_file_as() Date: Fri, 22 Apr 2016 10:38:28 -0500 Message-Id: <1461339521-123191-12-git-send-email-seth.forshee@canonical.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461339521-123191-1-git-send-email-seth.forshee@canonical.com> References: <1461339521-123191-1-git-send-email-seth.forshee@canonical.com> X-TM-AS-MML: disable X-Mailman-Approved-At: Fri, 22 Apr 2016 11:40:27 -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);