From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4867C433E0 for ; Tue, 9 Jun 2020 15:58:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8CEF62072F for ; Tue, 9 Jun 2020 15:58:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="FCzHnhd2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731015AbgFIP6E (ORCPT ); Tue, 9 Jun 2020 11:58:04 -0400 Received: from linux.microsoft.com ([13.77.154.182]:53034 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730640AbgFIP6D (ORCPT ); Tue, 9 Jun 2020 11:58:03 -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 B053620B717B; Tue, 9 Jun 2020 08:58:02 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B053620B717B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1591718282; bh=WkMSWOBEMcZxCr/lBlsLlRkLTBokiJBDduFX5I7V3BE=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=FCzHnhd2K9TkZSTHvhIULaVL/CIXp/M9Cz+mcJlcIDvHz1yKNqHML4uG+5BsQVbMo 9tEEprfz663FYe5ivH9HowLfjACAJEkC0vyZfj0lZYoPoqb/PMUQHdq0InTZhUbN5c hE1nDELVH9dr+dHBRBElhv8WfzJbWlCe/Rxa8Rfc= Subject: Re: [PATCH v3] IMA: Add audit log for failure conditions To: Steve Grubb , linux-audit@redhat.com Cc: zohar@linux.ibm.com, paul@paul-moore.com, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200608215343.4491-1-nramas@linux.microsoft.com> <27448076.Og45N0Lxmj@x2> From: Lakshmi Ramasubramanian Message-ID: Date: Tue, 9 Jun 2020 08:58:02 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <27448076.Og45N0Lxmj@x2> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org On 6/9/20 8:40 AM, Steve Grubb wrote: > On Monday, June 8, 2020 5:53:43 PM EDT Lakshmi Ramasubramanian wrote: >> The final log statement in process_buffer_measurement() for failure >> condition is at debug level. This does not log the message unless >> the system log level is raised which would significantly increase >> the messages in the system log. Change this log message to an audit >> message for better triaging failures in the function. >> >> ima_alloc_key_entry() does not log a message for failure condition. >> Add an audit message for failure condition in this function. >> >> Sample audit messages: > > Wouldn't it be better to have an IMA_ERROR record type? type "1804" is AUDIT_INTEGRITY_PCR which is used for failures to add to the measurement list. > >> [ 8.051937] audit: type=1804 audit(1591633422.365:8): pid=1 uid=0 >> auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 >> op=measuring_keys cause=hashing_error(-22) > > The audit system uses a name=value scheme to express information. This last > field has something in parenthesis that may need to be interpreted. In its > current form, we can't do this. It would require writing code to special case > this event, go to this field, find the first parenthesis, find the second, > extract what's between, and look it up. > > It would be better if that number in parenthesis was normalized to the > expected way we do audit events so nothing special has to be made. The number in parenthesis is the error code (such as ENOMEM, EINVAL, etc.) IMA uses this format for reporting TPM errors in one of the audit messages (In ima_add_template_entry()). I followed the same pattern. Would it be better if the value for "cause" is formatted as cause=hashing_error_-22 cause=alloc_entry_-12 thanks, -lakshmi