Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2749934imm; Mon, 24 Sep 2018 09:18:03 -0700 (PDT) X-Google-Smtp-Source: ACcGV60pvS5vSUF/1b9gmPGvm8LrK9IRu811DeGdzQM4NDvfUdv7WDqwYvYO+D6Bu02r5qrzyqli X-Received: by 2002:a65:6109:: with SMTP id z9-v6mr10300607pgu.243.1537805883540; Mon, 24 Sep 2018 09:18:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537805883; cv=none; d=google.com; s=arc-20160816; b=euQqrv+ghM78R8NXqa7TFuRhfJ9/slnouizB0I6qR9ymXMBnGR8ahZW+E8QSxuOoQO iN2Ao9k4xhajWH/WAYmbNYr539FyqASaVcaqLUpFWKdt4p3BgvTqWF7v6Ksae8rCSOdc oLJgMHFkb3DrjDnYyeKePIuvqdyFieQkQq2+mH+bRCzWbHDOjf+IYdM+6Jwo+jH6N+aX dFBEU1Df+xmIl86paeMC8mqSi/V85xoQN2agsw87iM3eWoSl3s6uKelg0WtZaUmG2dAB Em4r2jT2NE3uu0qXRVJe2GWGHELNSSQLoVAzHTe7uI1a/r7xJl6I+EO8tsadcPUL5Vr2 +Sag== 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=b1IbP26AyjGXRDRHJnau4Ocgfyp60c4xpkDPN8AIZgQ=; b=JMy8qeRqX8D9ziJApFNJp5V8wgz94SsgwlOTGbL/UWGVyd4FgB5qGMmydrMOC7vx/3 fwQnpgMKn/6KyACKE41lKjWE4M/ZRmVC+CBCgWot/Y8ubIJLF9hIq4LRjbekqm7XiJQZ hxJdD7KW4YPqXJcibgCD1iUlZzSrb0jZZpNyoL83lTyUQi4DxjlWVmsEuQ0GyoXSLcis pwUlOMVKJ+g91kbCcDYnMmd5oRl3wxmHt2hklhMzygxnlMix+tn1x55zoEQ6K75KHiru 067CKEOAviYBZK/KUwVyIU6YNacK5wh677keXUQQjLT2HJ0ChJ5Im73JJKjTHuS3bItt aVJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=Na0AxsKz; 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 k25-v6si7629998pgn.375.2018.09.24.09.17.48; Mon, 24 Sep 2018 09:18:03 -0700 (PDT) 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=Na0AxsKz; 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 S1731956AbeIXWSE (ORCPT + 99 others); Mon, 24 Sep 2018 18:18:04 -0400 Received: from sonic312-28.consmr.mail.gq1.yahoo.com ([98.137.69.209]:36974 "EHLO sonic312-28.consmr.mail.gq1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729008AbeIXWSE (ORCPT ); Mon, 24 Sep 2018 18:18:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1537805710; bh=b1IbP26AyjGXRDRHJnau4Ocgfyp60c4xpkDPN8AIZgQ=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=Na0AxsKz7Bt6kaODaZoh3zuC2YV9ZAQt6n5vDxoaoKilVuG7tHXOCBFNSjp5Em711IALQcCGaOmdwblw+Kn0X4zj+wO67CZz970ctdXiskEyPKQZq/l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J609y6diBteX0LC0t1EWRLnZ5HAJAvtlC_8E5uOKCHwrv0eBXW1rCGn_9W0ZeQ7kDBBeD 2tyl8rvP6yboxEvfhXoQanYWtvpVGdthOJzmJkW0kM500wz2jEnavNtUElyZq5EpALtSQmq.Z4.U tEzoQaHNNEHR4selheeQMGyYYG8d_mSqliKfddPCtidDDgR2R5uDad2rNywLEskRXCgkCn5jn0GN 6iQeSSqn0lTz.GRRLGs0- Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.gq1.yahoo.com with HTTP; Mon, 24 Sep 2018 16:15:10 +0000 Received: from c-67-169-65-224.hsd1.ca.comcast.net (EHLO [192.168.0.102]) ([67.169.65.224]) by smtp404.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID ac3248efb071c077a43390f9cff1f36e; Mon, 24 Sep 2018 16:15:07 +0000 (UTC) Subject: Re: [PATCH v4 00/19] LSM: Module stacking for SARA and Landlock To: Stephen Smalley , Tetsuo Handa , Kees Cook Cc: LSM , James Morris , SE Linux , LKLM , John Johansen , Paul Moore , "linux-fsdevel@vger.kernel.org" , Alexey Dobriyan , =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= , Salvatore Mesoraca References: <680e6e16-0890-8304-0e8e-6c58966813b5@schaufler-ca.com> <39457e79-3816-824b-6b4d-89d21b03f9ce@i-love.sakura.ne.jp> From: Casey Schaufler Message-ID: <2a1ceb8c-0288-47ff-a763-d620e904b5b2@schaufler-ca.com> Date: Mon, 24 Sep 2018 09:15:06 -0700 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: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/24/2018 8:01 AM, Stephen Smalley wrote: > On 09/23/2018 01:09 PM, Casey Schaufler wrote: >> On 9/23/2018 8:59 AM, Tetsuo Handa wrote: >>> On 2018/09/23 11:43, Kees Cook wrote: >>>>>> I'm excited about getting this landed! >>>>> Soon. Real soon. I hope. I would very much like for >>>>> someone from the SELinux camp to chime in, especially on >>>>> the selinux_is_enabled() removal. >>>> Agreed. >>>> >>> This patchset from Casey lands before the patchset from Kees, doesn't it? >> >> That is up for negotiation. We may end up combining them. >> >>> OK, a few comments (if I didn't overlook something). >>> >>>    lsm_early_cred()/lsm_early_task() are called from only __init functions. >> >> True. >> >>>    lsm_cred_alloc()/lsm_file_alloc() are called from only security/security.c . >> >> Also true. >> >>>    lsm_early_inode() should be avoided because it is not appropriate to >>>    call panic() when lsm_early_inode() is called after __init phase. >> >> You're correct. In fact, lsm_early_inode() isn't needed at all >> until multiple inode using modules are supported. >> >>>    Since all free hooks are called when one of init hooks failed, each >>>    free hook needs to check whether init hook was called. An example is >>>    inode_free_security() in security/selinux/hooks.c (but not addressed in >>>    this patch). >> >> I *think* that selinux_inode_free_security() is safe in this >> case because the blob will be zeroed, hence isec->list will >> be NULL. > > That's not safe - look more closely at what list_empty_careful() tests, and then think about what happens when list_del_init() gets called on that isec->list.  selinux_inode_free_security() presumes that selinux_inode_alloc_security() has been called already.  If you are breaking that assumption, you have to fix it. Yup. I misread the macro my first time around. Easy fix. > Is there a reason you can't make inode_alloc_security() return void since you moved the allocation to the framework? No reason with any of the existing modules, But I could see someone doing unnatural things during allocation that might result in a failure. > Unfortunate that inode_init_security name is already in use for another purpose since essentially you have reduced these hooks to initialization only. I considered that but decided that it makes more sense for the module hook names to match the infrastructure name. Having security_inode_alloc() call selinux_inode_setup_security() starts to get confusing.