Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp609025imu; Mon, 26 Nov 2018 15:45:15 -0800 (PST) X-Google-Smtp-Source: AFSGD/VOh/KU7h/9qACFEMZ0CtRfzgJPd/5Th3i/mf1OSn29lPMgJ9BrR1FE51uYUOkPucXZZPU4 X-Received: by 2002:a63:1321:: with SMTP id i33mr27382138pgl.380.1543275915427; Mon, 26 Nov 2018 15:45:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543275915; cv=none; d=google.com; s=arc-20160816; b=e7LxKMCQ0Fsw5lzwYitO3yAYWw4OF5chaYjv2v3HZHMzRhLnFnF9Dy1Y1gXAFZ77Es 5gndaP79/1xfGW9nVOYCX8aB6UOfu+GN/2fk/HfIGcPE7UYkRWK4+1OECcr8DlaLOFxk LXT7EZwiEQsCHzjEf5wsk+y2CCZr+KkS9y/Dmv0j0sRUiDyHlSLaHtE7g/UPV/PQq6K+ Gju+xtBIKEb4MH/M6MrIV04RG3WIq+sg6ZPU6jDTL3kCIskMQnlbGOLrQfeuy75zOzbh OzG6L6Zj/EJvFjeunHDZvq61fMwiTii2FOPJ3xCXBTD9qo9xJF+kE/PC6su5c1B5UJc/ oi4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=yzS41n1rCVRHChOBSSjNfES4FV7tKjQHrZu9+D9erQU=; b=CJOVVz8lFG4fzkxNx14WNCUihD8ZLV7FREQJ5W+VJ1Xd7CZdlelWXQtJZ+AjKyRJ03 WLttCzphsVzK3yDTySnaKi0ED0Rwb897lSeozPnnMjhUP0Oh0Hu+SLXqiPomv8jFp9kq DFbLFOprB3c5xxZaSiOTU5vTjgD0Lfp6jYIA03zaKeflijM3pPvfAUJu7sysuXXJdCk/ Tqq8uDzz1rHwCnQOfbgel7GWyrzm6Ta+9FeyPAJMs7OjB4b4mGOwvsZEaogwp5Wm1A1I rkBMothtzInvla9CcPXRW2KuMzNhprBhqigZQqa2B8Gfe0EsAi9Rz2VoF5ieAy+3Uxci 5Kfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=OhPKPqKy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g13si1719369pgk.165.2018.11.26.15.44.59; Mon, 26 Nov 2018 15:45:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=OhPKPqKy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727695AbeK0KkL (ORCPT + 99 others); Tue, 27 Nov 2018 05:40:11 -0500 Received: from sonic315-27.consmr.mail.ne1.yahoo.com ([66.163.190.153]:43739 "EHLO sonic315-27.consmr.mail.ne1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727456AbeK0KkL (ORCPT ); Tue, 27 Nov 2018 05:40:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1543275860; bh=yzS41n1rCVRHChOBSSjNfES4FV7tKjQHrZu9+D9erQU=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=OhPKPqKyYgBsuAWX9RQsB0x9lSngT5tTyMx6j6bRU5yPG2GCt9sbbR+mn0bngaFsezZ7lkzVsU2EgtSj8PyWFO/+xpfCztFSRSkONgzmz3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sbItL2 I4aqNLRrxfa41UdYTS3QQs_d06tR14a7DPXUCWqD1PF16mcrT1G5RgnSJQ4PWqm5OdMDkZ9p2mv4 PLqaoLhVPnL.FpGlXsVKL58s_pkWXXslDpWPq9IxpRDdm9JxayA2dh5XRUVAv2jSzV4gJ1p8Qv0Z rScnTJXPYpHmhk8Iz7LmJpBdpbRAaFi6QVP2.ewfVgNyQBUQZfVnqpXUQPcvnEcffwDXOoGyqru1 Ncz3NbgkGkSGBbWopCJwnJzgCxgzZES6ERx9IUzr6qGHsIJsoRnM7jq16wdH823i5aCn99cEOyDv Ye8YB9tjC5ufaw9uaFI5xqMlN2ew0W8dslwEfpw-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.ne1.yahoo.com with HTTP; Mon, 26 Nov 2018 23:44:20 +0000 Received: from c-67-169-65-224.hsd1.ca.comcast.net (EHLO [192.168.0.105]) ([67.169.65.224]) by smtp402.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 20db7ce71dffaa24efe91d4689b48987; Mon, 26 Nov 2018 23:44:19 +0000 (UTC) Subject: [PATCH v5 23/38] SELinux: Remove cred security blob poisoning To: James Morris , LSM , LKLM , SE Linux Cc: John Johansen , Kees Cook , Tetsuo Handa , Paul Moore , "linux-fsdevel@vger.kernel.org" , Stephen Smalley , Alexey Dobriyan , =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= , Salvatore Mesoraca References: <50db058a-7dde-441b-a7f9-f6837fe8b69f@schaufler-ca.com> From: Casey Schaufler Message-ID: <80666d37-ea25-1b25-5108-426ebbc384ce@schaufler-ca.com> Date: Mon, 26 Nov 2018 15:44:17 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <50db058a-7dde-441b-a7f9-f6837fe8b69f@schaufler-ca.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The SELinux specific credential poisioning only makes sense if SELinux is managing the credentials. As the intent of this patch set is to move the blob management out of the modules and into the infrastructure, the SELinux specific code has to go. The poisioning could be introduced into the infrastructure at some later date. Signed-off-by: Casey Schaufler Reviewed-by: Kees Cook Signed-off-by: Kees Cook --- kernel/cred.c | 13 ------------- security/selinux/hooks.c | 6 ------ 2 files changed, 19 deletions(-) diff --git a/kernel/cred.c b/kernel/cred.c index ecf03657e71c..fa2061ee4955 100644 --- a/kernel/cred.c +++ b/kernel/cred.c @@ -704,19 +704,6 @@ bool creds_are_invalid(const struct cred *cred) { if (cred->magic != CRED_MAGIC) return true; -#ifdef CONFIG_SECURITY_SELINUX - /* - * cred->security == NULL if security_cred_alloc_blank() or - * security_prepare_creds() returned an error. - */ - if (selinux_is_enabled() && cred->security) { - if ((unsigned long) cred->security < PAGE_SIZE) - return true; - if ((*(u32 *)cred->security & 0xffffff00) == - (POISON_FREE << 24 | POISON_FREE << 16 | POISON_FREE << 8)) - return true; - } -#endif return false; } EXPORT_SYMBOL(creds_are_invalid); diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 24b6b459fa2a..41b230d459a6 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -3922,12 +3922,6 @@ static void selinux_cred_free(struct cred *cred) { struct task_security_struct *tsec = selinux_cred(cred); - /* - * cred->security == NULL if security_cred_alloc_blank() or - * security_prepare_creds() returned an error. - */ - BUG_ON(cred->security && (unsigned long) cred->security < PAGE_SIZE); - cred->security = (void *) 0x7UL; kfree(tsec); } -- 2.14.5