Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2389987ybg; Fri, 5 Jun 2020 12:40:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNFZqg5ZPeYbF9WP1zUePxbBRqBICtBKOZF3VWJO01xz8KVgE+z7IiOVV+7aX4+DZIele+ X-Received: by 2002:aa7:d388:: with SMTP id x8mr11159206edq.380.1591386021436; Fri, 05 Jun 2020 12:40:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591386021; cv=none; d=google.com; s=arc-20160816; b=ZzXBynHxpT31GQKcC2DYj/mP5PMHDbIoZ7BWKq5R3P4ZKJhnsqE4Ujdm/a3jcso2Ur B/zuGJEt1ogmNZp3UeaQKXeUMj7wI65AH/6Nzfbq+HsMLT6lXg0gVE2U3Bh4txt+3IFF RhuBcsYP92NAoL/O2t27WmkiYWxXzIJiJgtb2JwmQU73DtIYycqFYguhjn76jIimMRU6 3LXpB1SdyyRena9Sv/eLD33yKF1+rOmJo6JwUSVAOao+pr5cw481Pky3ckXhIWy1EdwE ZkDlKghE6Y0nSgzT0nCbqOfbJIlEEVLXzkcxj/FjoS1SfhArQt8IMUEhjmJAIVQudf7X c6Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=eOF1BRH3hqUoMNIFRgJb8qWo4oAn8/8kkqpSwUrcV0E=; b=oERDr18M3VPuGmYBJDwy89fgBcqmS/5MmsH6qpHtX9auVAZHfQ+kQ7IDvHOSMw7YfJ 6mGEDqBKM0VqzdtlCH4toO0avu20ap04fXGJ2gQWqgdPOwvuDudS+zVh6U4KxDEQcw5E dMeRJ72ztvnOurXG/w7ClqDug+x0aQsZ7xS21AqrIs3CWqWyoQyTeFQq9gCnSOtlq2Ca g78WAyKIS4ffR8xCg2BxuMFlvMI2rRsUEubwb4q53zbmM/Mf9aF1z5prsqh9fyECBZsy 6u47k46TaXREA5K04U9mNrrjjbv2dEvtHDqsi/nsE35Tnq67/3D8OIdkeZPdse40dsoY tKTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=yLfHIAag; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dr16si5589425ejc.320.2020.06.05.12.39.58; Fri, 05 Jun 2020 12:40:21 -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=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=yLfHIAag; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727877AbgFETiF (ORCPT + 99 others); Fri, 5 Jun 2020 15:38:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727087AbgFETiF (ORCPT ); Fri, 5 Jun 2020 15:38:05 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 926B2C08C5C2 for ; Fri, 5 Jun 2020 12:38:04 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id o15so11320833ejm.12 for ; Fri, 05 Jun 2020 12:38:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=eOF1BRH3hqUoMNIFRgJb8qWo4oAn8/8kkqpSwUrcV0E=; b=yLfHIAagpugDB4geFiVAXJJTQZXB+jW2HjJpn1vVvldz+/22CHGCzrUNeAIPsbbOvS Vj0WWKVboNAgnySpxH8lKz1enjBLbx+U5WnUNrph8o3tPLdFlnq4xLjeFaiD7zPvZ1HI E8vYm7qpO0BZDhJ5aa3p4Z+TUaHWun5mYVXiUYGP08452NKK4T0k3te3woXIIPw9YBVE a0T4s5ywxePv/JEhyEsXaKRaDhNAcQU2hG19R8cToaq5nYYP1zWYwiHczsHKzCW6EgA9 q6UTJD57gk60CAfMC6sMGWtxCUx2KdpUpGUH6a4iVzNYkxQ8OyDLll7pBr07DdJfQFZI X9LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eOF1BRH3hqUoMNIFRgJb8qWo4oAn8/8kkqpSwUrcV0E=; b=s4EZnWP9vU6I7Q2lL45PUaeVTqgFg5FOqR0r3ZUSFR+kFncLzbuUBO9JAlx0kHfdLz IHaWBkzR8x24xZtxyykJgEh6SziV+POJbQZpa8flD9jgyTXDYi8wwTds1SvIsg6usCwk vyxxs2oMhupvWzCaLyRX6qQh3GshXO3KGYIHkL+OekCbCTbq/thB4eCn1vMo/NlpwTJl AFUbSYw9BnqsC7OVPF1ZtFD60IL+gM5xKS54Q2VvgyyxoeTB2DJv9PeMWqKRm2HYeggZ xZ8KFLIAjN67GUx/mwfeYF+HoqqNuC2CYaCrhKU81u8R0JexmWdTTRpZBA/PlApl0/aZ SKMQ== X-Gm-Message-State: AOAM533f4vSynyO0pUD7DQpqHQSkXko8zNGXD+HFXWgyNopNqhB/Tc7K snApl6f1zh7Ko0C+G/KmiEq/MuerG8zTkL8DXFb88xQ= X-Received: by 2002:a17:906:e257:: with SMTP id gq23mr9631120ejb.398.1591385882972; Fri, 05 Jun 2020 12:38:02 -0700 (PDT) MIME-Version: 1.0 References: <20200604163243.2575-1-nramas@linux.microsoft.com> <1591382782.5816.36.camel@linux.ibm.com> In-Reply-To: <1591382782.5816.36.camel@linux.ibm.com> From: Paul Moore Date: Fri, 5 Jun 2020 15:37:52 -0400 Message-ID: Subject: Re: [PATCH] IMA: Add log statements for failure conditions To: Mimi Zohar Cc: Lakshmi Ramasubramanian , linux-integrity@vger.kernel.org, tusharsu@linux.microsoft.com, linux-kernel@vger.kernel.org, linux-audit@redhat.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 5, 2020 at 2:46 PM Mimi Zohar wrote: > > [Cc'ing Paul Moore] If it's audit related, it's generally best to CC the linux-audit list, not just me (fixed). It's not clear to me what this pr_err() is trying to indicate other than *something* failed. Can someone provide some more background on this message? > Hi Lakshmi, > > On Thu, 2020-06-04 at 09:32 -0700, 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 error level, > > and add eventname and ima_hooks enum to the message for better triaging > > failures in the function. > > > > ima_alloc_key_entry() does not log a message for failure condition. > > Add an error message for failure condition in this function. > > > > Signed-off-by: Lakshmi Ramasubramanian > > These messages should probably be turned into audit messages. Look at > integerity_audit_msg(). > > Mimi > > > --- > > security/integrity/ima/ima_main.c | 3 ++- > > security/integrity/ima/ima_queue_keys.c | 2 ++ > > 2 files changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c > > index 9d0abedeae77..3b371f31597b 100644 > > --- a/security/integrity/ima/ima_main.c > > +++ b/security/integrity/ima/ima_main.c > > @@ -756,7 +756,8 @@ void process_buffer_measurement(const void *buf, int size, > > > > out: > > if (ret < 0) > > - pr_devel("%s: failed, result: %d\n", __func__, ret); > > + pr_err("%s failed. eventname: %s, func: %d, result: %d\n", > > + __func__, eventname, func, ret); > > > > return; > > } > > diff --git a/security/integrity/ima/ima_queue_keys.c b/security/integrity/ima/ima_queue_keys.c > > index cb3e3f501593..e51d0eb08d8a 100644 > > --- a/security/integrity/ima/ima_queue_keys.c > > +++ b/security/integrity/ima/ima_queue_keys.c > > @@ -88,6 +88,8 @@ static struct ima_key_entry *ima_alloc_key_entry(struct key *keyring, > > > > out: > > if (rc) { > > + pr_err("%s failed. keyring: %s, result: %d\n", > > + __func__, keyring->description, rc); > > ima_free_key_entry(entry); > > entry = NULL; > > } > -- paul moore www.paul-moore.com