Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp434941pxa; Tue, 4 Aug 2020 09:00:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzePEs5oeqhWbVbfL8OpR+snMz4AfWrfjEOlDE3fb1uv5raX9i7ChD7XvPBloG17Le1lD+W X-Received: by 2002:aa7:c1d4:: with SMTP id d20mr13713355edp.81.1596556836333; Tue, 04 Aug 2020 09:00:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596556836; cv=none; d=google.com; s=arc-20160816; b=SMm3jQ5PYennVP2lLrgHBltj20uQemHXkADgxHst6DdiP6Tf2KksULfvbr+4fWSFp7 4nC2HV+TcKx69BkDUSBi5AtsHYAoZ3Wq7/gx/8Bt7H9CU5WpwuvkBt9RRRD/Xpc2/bax gXGbHrTZI2nvm/idJrjQlsQi/IgRpf4an8rlvYVlOLnyUqs5s5eS/Jta+ghfgFbylwgv /d7OFeFBorFeRh+xYa8rIlOuNkbIzDF7pJ/VUsMDGSTWS2w+iZ0vlsDuC7czC+fSYAGF CX9Gv9U+YCr9Jm+TAw4AkWes4cJNa1qNAJoJGgMOQwXxYgSQQtZyY0DlV7LnMd32K8LV A4xQ== 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=VpAp+gwtX80StpLhWTSeWeTMwUZ22EUYNIZ2mT0WBts=; b=rwY5xQ+PWyY8ydZMwk0vL43NnXytWCoPiXvVBHNr+VmSl/HyIhi2ipczp+SJhWp6st fwRi0KMrQEjeVuim2XQEY9FvLbTVSL+KrStu8cZfGIvUtHVuacpIwp6H7RUPu0GPg9MN u2FIiLp71U3vIKGDot9LhFDl7USgNW5sb5KRnATFaDzJQkJsOAfQ7taVt7/C0ynU2ICQ fly7GGNBfwJ4rG20uOlfs4QA7d8bdXLDVBZzcPz6VQCU2dxhKurAELFdEnmSfmIgDavq /RpkghpIX4co3hn0FeZ48z9ZEEvqQ4OBYhvwr2Vioh6N5XWL3I6+gfKo0DPfw0E7eQBx anJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=siiuYorx; 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 y8si13139434edm.463.2020.08.04.09.00.08; Tue, 04 Aug 2020 09:00:36 -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=siiuYorx; 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 S1729211AbgHDP5W (ORCPT + 99 others); Tue, 4 Aug 2020 11:57:22 -0400 Received: from linux.microsoft.com ([13.77.154.182]:54906 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729022AbgHDP5H (ORCPT ); Tue, 4 Aug 2020 11:57:07 -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 3CE6520B4908; Tue, 4 Aug 2020 08:57:06 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3CE6520B4908 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1596556626; bh=VpAp+gwtX80StpLhWTSeWeTMwUZ22EUYNIZ2mT0WBts=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=siiuYorxFApiTutRO1Fq7FQ6URRgVvncZmVb1M/+HCPfxlM1sq1xVO/vR+KyX8BNQ 7JSsbMLQy5Oj0jTbSONyrTgqXXo70xkMqsXXTt+G0HS4sTYu2Hvd+zVu5oSwXNpaIY DGOwjAUXj7JHYqoZw00cWBAMJFnxw5OPqArnMdvY= Subject: Re: [PATCH v5 3/4] LSM: Define SELinux function to measure state and policy To: Stephen Smalley Cc: Mimi Zohar , Casey Schaufler , Tyler Hicks , sashal@kernel.org, James Morris , linux-integrity@vger.kernel.org, SElinux list , LSM List , linux-kernel References: <20200730034724.3298-1-nramas@linux.microsoft.com> <20200730034724.3298-4-nramas@linux.microsoft.com> <6371efa9-5ae6-05ac-c357-3fbe1a5a93d5@linux.microsoft.com> <5c843a3d-713c-e71f-8d4f-c6e5f51422f1@gmail.com> <3e766eed-7a0b-afca-6139-ac43dea053d7@linux.microsoft.com> <0fa0b1f3-6226-c307-0f11-8b3a881a070e@gmail.com> <32da0a4a-252a-67d8-5dc8-173959f6ddb4@gmail.com> From: Lakshmi Ramasubramanian Message-ID: Date: Tue, 4 Aug 2020 08:57:02 -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: <32da0a4a-252a-67d8-5dc8-173959f6ddb4@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/4/20 8:29 AM, Stephen Smalley wrote: >>> Perhaps vmalloc would be better than using kmalloc? If there are >>> better options for such large buffer allocation, please let me know. >> >> kvmalloc() can be used to select whichever one is most appropriate. > > Other option would be for ima to compute and save the hash(es) of the > payload and not the payload itself for later use.  I guess you won't > know at that point which hash algorithm is desired? > I think IMA hash algorithm would be known at that point, but IMA policy is not loaded yet (which is why I need to queue up the buffer and process when policy is loaded). I tried vmalloc and tested it with upto 16MB buffer (just made up a SELinux policy buffer of size 16MB) - that works fine. I will try kvmalloc(). Also, I fixed the issue with LSM data not measured when using the IMA policy you had. Good catch. Will post the updated patches today. thanks, -lakshmi