Message ID | 1451930639-94331-9-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 5DA479F7B5 for <patchwork-selinux@patchwork.kernel.org>; Mon, 4 Jan 2016 18:32:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 90F172034A for <patchwork-selinux@patchwork.kernel.org>; Mon, 4 Jan 2016 18:32:24 +0000 (UTC) Received: from emvm-gh1-uea08.nsa.gov (emvm-gh1-uea08.nsa.gov [63.239.67.9]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2AAB3202FE for <patchwork-selinux@patchwork.kernel.org>; Mon, 4 Jan 2016 18:32:23 +0000 (UTC) X-TM-IMSS-Message-ID: <75cea89800103fd3@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 75cea89800103fd3 ; Mon, 4 Jan 2016 13:30:26 -0500 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 u04ITXW0016070; Mon, 4 Jan 2016 13:29:35 -0500 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 u04I4PO6225753 for <selinux@prometheus.infosec.tycho.ncsc.mil>; Mon, 4 Jan 2016 13:04:25 -0500 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 u04I4Beh013312 for <selinux@tycho.nsa.gov>; Mon, 4 Jan 2016 13:04:25 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1DxAAAys4pWlKrVVdFeGQEBAQEPAQEBAYRJiFm1aIYPAoFoAQEBAQEBEgEBAQEHCwsJH4RlAQEBAxIVGQEBNwEPUTQBBQEcBhMiiA2iToExPjGKV4VUAQWMHgEBAQEGAgEaBgqEO4IRjjuONYhWlmqFYkSMKjWBF4JoIiSBX1MBhQ8BAQE X-IPAS-Result: A1DxAAAys4pWlKrVVdFeGQEBAQEPAQEBAYRJiFm1aIYPAoFoAQEBAQEBEgEBAQEHCwsJH4RlAQEBAxIVGQEBNwEPUTQBBQEcBhMiiA2iToExPjGKV4VUAQWMHgEBAQEGAgEaBgqEO4IRjjuONYhWlmqFYkSMKjWBF4JoIiSBX1MBhQ8BAQE X-IronPort-AV: E=Sophos;i="5.20,521,1444708800"; d="scan'208";a="5070753" Received: from emvm-gh1-uea08.nsa.gov ([10.208.42.193]) by goalie.tycho.ncsc.mil with ESMTP; 04 Jan 2016 13:04:25 -0500 X-TM-IMSS-Message-ID: <75b676520010347d@nsa.gov> Received: from mail-ig0-f170.google.com (mail-ig0-f170.google.com [209.85.213.170]) by nsa.gov ([10.208.42.193]) with ESMTP (TREND IMSS SMTP Service 7.1; TLSv1/SSLv3 AES128-SHA (128/128)) id 75b676520010347d ; Mon, 4 Jan 2016 13:04:00 -0500 Received: by mail-ig0-f170.google.com with SMTP id to4so248917999igc.0 for <selinux@tycho.nsa.gov>; Mon, 04 Jan 2016 10:04:24 -0800 (PST) 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=lNMozmbm7pfdxKvWpPZNWPjG7CuFlV9btFcGtcgM/0U=; b=pK/XBCguYZ8eemrHygcQb6hiUJR9t5LBmi7/cluKbd8rSJfMW8dkdkTwSTfBBb5YTD GVyPIz0os1x/UCPCugQQtamunieJdAY9SV919m2LwgKm3VQJuSpp1jrATUWyH7GXbSoY ajvT6wP61e/ncMRoUe8FR12oEnBYDKCMubyK0I2pmoyVei0VB5RGohVTOVfB30DJC0oh o6i4hyJIMjNnVfbRTrnxHfCPBTG9X7lCtDJM7pKkS3Bg3150oOdD0ycVhGT9+iiD25bk Bjx6s2fb6VCthYRxdDUdt+ipZLmFsmDJqDFhNUiXWysI1S0lXvbgmssOM11XzcNJT3Vs jcSg== 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=lNMozmbm7pfdxKvWpPZNWPjG7CuFlV9btFcGtcgM/0U=; b=kAQrjBnbQw1LfVwsP5N9Wj6HiWwyEiYYWiVkQinqZqaFjwSrDHihdPTk+6fmeW6emQ qPN0UgiSrFa27pt8RQvBxPYiLjTh+3LH8P6r0v5DwO7NzZUND5Z8DSLDXOVGX0yip41h yo18wfdkG8ySNvAh8HktqSU7Q5zpyQ8/0nhqdadfhTuxabsF7HvVWYU9LybffYnSfWRA +NWxWJ+R7o/dnFKgFo8opnU1Z6jShcVe4xIBZMDfeqoFqrDQP5CYXDAlG6t52AH3KGPk r3bsKL08+flCfh0TZKiEdHh3MOZQztdsyEBE+1mbuS9A6LFWnQuVZZNJtx2mP/1KXm4+ va9g== X-Gm-Message-State: ALoCoQmWIW5lqdKCHpTQ092OD0geY0wH1LSN+keoWvRYy8b+U10vG8PiZaHDKCtM0V1JC5e/Cknq2uyi58uSiKW+3KzH9JVvgA== X-Received: by 10.50.60.100 with SMTP id g4mr29066157igr.78.1451930664281; Mon, 04 Jan 2016 10:04:24 -0800 (PST) Received: from localhost ([66.64.121.229]) by smtp.gmail.com with ESMTPSA id qr1sm30611540igb.21.2016.01.04.10.04.23 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 04 Jan 2016 10:04:23 -0800 (PST) From: Seth Forshee <seth.forshee@canonical.com> To: "Eric W. Biederman" <ebiederm@xmission.com> Subject: [PATCH RESEND v2 08/18] cred: Reject inodes with invalid ids in set_create_file_as() Date: Mon, 4 Jan 2016 12:03:47 -0600 Message-Id: <1451930639-94331-9-git-send-email-seth.forshee@canonical.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1451930639-94331-1-git-send-email-seth.forshee@canonical.com> References: <1451930639-94331-1-git-send-email-seth.forshee@canonical.com> X-TM-AS-MML: disable X-Mailman-Approved-At: Mon, 04 Jan 2016 13:14:22 -0500 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 <miklos@szeredi.hu>, 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 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=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 71179a09c1d6..ff8606f77d90 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);