Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp105827ybh; Mon, 20 Jul 2020 11:28:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHorcPzwnvtt79i8/gmz6bcNfkvcT3LruVcqYQCOrQ7Vyz50u+GflzpOEROWcpBue9IBZA X-Received: by 2002:a05:6402:542:: with SMTP id i2mr23299277edx.318.1595269700691; Mon, 20 Jul 2020 11:28:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595269700; cv=none; d=google.com; s=arc-20160816; b=Y6KXIsFy5nBwXNZTvUkHENMvM/4AQ0FnJMRiR4smKvQztI21LZjXkTxY3DbD9Shp0C /GQiqgUYxAnv60nGdtKqlAYfg3zzsEyu78LSMTtSLGZQsOTOVc1QGTGt9lble16de8/o much0VD7eupIPwUKcLi29fjNKyRsSYFo+Z6BzBGcIE2hmc/MABYDbOueT75khrf9PIPz hCStDHrC3r4VwgxmZ7qDGmi8bLnrBAJlc4acMScPbuA4JF5XIpTHLZYkk5eerJqZItvq /jNUTWcUqbetZ62j/MqvtHIaSTSYQqV5zSG9ztMcUlVAIkzylAv8MhQ07u0SxaBfqcOJ 1AEg== 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=vZFIrBIdJyC5Xb5S8CJMRXERS/PRPgBtWmfiWFbXNiU=; b=hNOUJFeAlXIVSBzaNGJ/C3IvkzfnvFL970MnyG8bHYDrxcInGfHGDw3Plf64wfct76 JZF76IN1Zp8YgzF2DWi1U/0rDT/8j14y4IMMijbhNql1/3JFehX/heN4P4ZL/F6S5Esn 9SFXql1xpuz2rhx+If369o+fPIKN4Fh0XBPdbLoLnBWH8S+RcXuuZJXkaaMQMcF0OSFJ zxbnVyH/5aR22nQkAd/P2Fvtc10eIJUNx2yB5zKqEnvFMnDaYDD86kaxNrAMh8+IvxzK tV+JW40bIOUlA7baaGsYEE6G2qSCpD+PlmDj16+U93I4WJaSPeofVR/L8gPiwNOqsHC7 RKNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=PhuaUfn3; 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 de19si10991199edb.285.2020.07.20.11.27.57; Mon, 20 Jul 2020 11:28:20 -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=PhuaUfn3; 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 S1729926AbgGTS1S (ORCPT + 99 others); Mon, 20 Jul 2020 14:27:18 -0400 Received: from linux.microsoft.com ([13.77.154.182]:43702 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726506AbgGTS1Q (ORCPT ); Mon, 20 Jul 2020 14:27:16 -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 5B9C220B4909; Mon, 20 Jul 2020 11:27:16 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5B9C220B4909 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1595269636; bh=vZFIrBIdJyC5Xb5S8CJMRXERS/PRPgBtWmfiWFbXNiU=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=PhuaUfn3PsD00nHkSKO/079qirBPkHdG2rtXca5M72Kg0znz8z9Ivs1zLHeO3VRhN jPmx/HOaTMH+qDcujRuG/dZfTK9fUGB7hkYFrQxQ+uuqEcoVnc379ESsf3GJohUl0M cmWjplFOWLBrsI6Gu1BCwYmGbVsp5Rdk0zaqgARc= 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: Date: Mon, 20 Jul 2020 11:27:15 -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 10:49 AM, Stephen Smalley wrote: >>> >>> Looks like the template used is ima-ng which doesn't include the >>> measured buffer. Please set template to "ima-buf" in the policy. >>> >>> For example, >>> measure func=LSM_STATE template=ima-buf >> >> It seems like one shouldn't need to manually specify it if it is the >> only template that yields a useful result for the LSM_STATE function? > > 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? > And we only need to use ima-buf for the selinux-state if we want the > measurement list to include the string value that > was hashed; if we just want to compare against a known-good, it would > suffice to use ima-ng for it as well, right? > -lakshmi