Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp126111ybh; Mon, 20 Jul 2020 12:02:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0n4qzIqIFdoVS1hjG1TLqCgr/wcP6onMyxK4myfI0uO36Muv62gummbmc29w9fKk71N3n X-Received: by 2002:a17:906:2a5b:: with SMTP id k27mr21578020eje.82.1595271755057; Mon, 20 Jul 2020 12:02:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595271755; cv=none; d=google.com; s=arc-20160816; b=P2pVAQva+qiECdcUrcAf2GMGXuIXbRp+njEm8TBIFBPJeRqmZjB/KKK8cLsF1GR0sr +iP8rMBkpxnDfwNcDymPzaABSUHmlwfc+caYOHyIzQiKjsIFeKv57lfyPcXaGYanEqE8 LRkjkXRNHeToWGZwsGqIwozwWdpx5+z6yE0bGyNMENuGnJYPbRceJUcof3L8+Ri545x9 bl2/RJrGpDFWk1Jl8c0CtMt6A/9YDsp+Zd4TXYnoIadpspWYBUIgyFPaEChBMPiUOBBP xrHBOkLzR0FEGMtvBNIw36C7mnpX7npwEZW6YO5hsXGyCw0xoAEsPtIX6vk3YBgC23yu 0GYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature:dkim-filter; bh=TwTCyPsy3rMqXVnjk9ggTK+QxuipwRRnBBIqMLIAfHU=; b=Dg2m3TwNg6nMcjSPeDWw16pxIttqzc5hIPKQZWVUm6lkNtq0MPRUhXGvLmrIJuX2qS ZpeC1LORKjG13nzOquQDz6V/iTq9ToR4ddDrmRbIE33kVefZdXotPHxF2I8GLNg2cXq0 ypJqWE12E8LozxoYNWelaFyV+ZJKcqMy/Klmk3SN00klBJVH/cMcBOQ6GCEcdCmfDYmV kdMVkQ09RU1ou2SUpJQZphv44whflDDXi60UNGCrF5XHnqorDKjA+ljHhW63tZsXieuR ATFZAh++JGrJuOkNCVm5zFoHKOw3Wr42LRybSdAfWQ74tdL99C+/n7zI+q4TRqJ4FSA5 RyMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=CsOM1OTA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m10si10506418eja.377.2020.07.20.12.02.10; Mon, 20 Jul 2020 12:02:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=CsOM1OTA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730385AbgGTS7x (ORCPT + 99 others); Mon, 20 Jul 2020 14:59:53 -0400 Received: from linux.microsoft.com ([13.77.154.182]:48720 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728139AbgGTS7x (ORCPT ); Mon, 20 Jul 2020 14:59:53 -0400 Received: from [192.168.0.104] (c-73-42-176-67.hsd1.wa.comcast.net [73.42.176.67]) by linux.microsoft.com (Postfix) with ESMTPSA id 3F13620B4909; Mon, 20 Jul 2020 11:59:52 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3F13620B4909 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1595271592; bh=TwTCyPsy3rMqXVnjk9ggTK+QxuipwRRnBBIqMLIAfHU=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=CsOM1OTASiRenjavduL6Z/OSbM8MSJRuka+oE3SfwFiUtblFWSKQjh5MKwzLlONqQ L9RuvB8oP0n36cCAFMasvJSqJEWnB0peLm1olX3WYO0JyVLF/C+tGQC7wVF/rAxplY +dcGkrf8Uf0UBYjE2diJjx3YEiuc6RRJ0IglDe3Q= Subject: Re: [PATCH v3 4/5] LSM: Define SELinux function to measure security state To: Stephen Smalley Cc: Mimi Zohar , Casey Schaufler , James Morris , linux-integrity@vger.kernel.org, SElinux list , LSM List , linux-kernel References: <20200717222819.26198-1-nramas@linux.microsoft.com> <20200717222819.26198-5-nramas@linux.microsoft.com> From: Lakshmi Ramasubramanian Message-ID: <72af0630-dce0-12af-0977-b4e81c2f99ac@linux.microsoft.com> Date: Mon, 20 Jul 2020 11:59:51 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/20/20 11:44 AM, Stephen Smalley wrote: >>> >>> Actually, if we used ima-ng template for selinux-policy-hash, then >>> instead of needing to hash the policy >>> first and passing the hash to IMA, we could just pass the policy as >>> the buffer and IMA would take care of the hashing, right? >> >> That is correct. >> >> The IMA hook I've added to measure LSM structures is a generic one that >> can be used by any security module (SM). I feel it would be better to >> not have policy or state or any such SM specific logic in IMA, but leave >> that to the individual SM to handle. >> >> What do you think? > > It is correct to remain security module agnostic. However, I think > you can remain LSM-neutral while still avoiding the double hashing of > the policy here. Can't you just pass in the policy itself as the > buffer and let IMA hash it? Yes - that is an option. If I do that then, as you have stated below, we'll need to two funcs - one that will only add the hash but not the entire data payload in the IMA log (i.e., "ima-ng") and, the other that handles hashing and including date payload (i.e., "ima-buf"). Then you can let the policy author decide > on the template to be used (ima-buf versus ima-ng). If you want to > support the use of different templates for different "kinds" of LSM > state (e.g. state versus policy) you could either provide two funcs > (LSM_STATE, LSM_POLICY) or otherwise support selection based on some > other attribute. > I can do the above. -lakshmi