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=-7.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED, URIBL_SBL,URIBL_SBL_A,USER_AGENT_MUTT autolearn=ham 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 2618DC43381 for ; Sat, 23 Mar 2019 02:57:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F026E218D3 for ; Sat, 23 Mar 2019 02:57:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728227AbfCWC5Q (ORCPT ); Fri, 22 Mar 2019 22:57:16 -0400 Received: from smtp.nue.novell.com ([195.135.221.5]:35134 "EHLO smtp.nue.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727363AbfCWC5Q (ORCPT ); Fri, 22 Mar 2019 22:57:16 -0400 Received: from emea4-mta.ukb.novell.com ([10.120.13.87]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Sat, 23 Mar 2019 03:57:14 +0100 Received: from localhost (nwb-a10-snat.microfocus.com [10.120.13.202]) by emea4-mta.ukb.novell.com with ESMTP (TLS encrypted); Sat, 23 Mar 2019 02:56:32 +0000 Date: Sat, 23 Mar 2019 10:56:13 +0800 From: jlee@suse.com To: Ard Biesheuvel Cc: "Lee, Chun-Yi" , James Morris , "Serge E . Hallyn" , David Howells , Josh Boyer , Nayna Jain , Mimi Zohar , linux-efi , linux-security-module , Linux Kernel Mailing List Subject: Re: [PATCH 2/2] efi: print appropriate status message when loading certificates Message-ID: <20190323025613.GA7196@localhost> References: <20190322103350.27764-1-jlee@suse.com> <20190322103350.27764-2-jlee@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.2 (2019-01-07) Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: Hi Ard, On Fri, Mar 22, 2019 at 03:27:46PM +0100, Ard Biesheuvel wrote: > On Fri, 22 Mar 2019 at 11:34, Lee, Chun-Yi wrote: > > > > When loading certificates list from UEFI variable, the original error > > message direct shows the efi status code from UEFI firmware. It looks > > ugly: > > > > [ 2.335031] Couldn't get size: 0x800000000000000e > > [ 2.335032] Couldn't get UEFI MokListRT > > [ 2.339985] Couldn't get size: 0x800000000000000e > > [ 2.339987] Couldn't get UEFI dbx list > > > > Why is it an error in the first place if these EFI variables do not exist? > As you said, the error message should only be exposed when these EFI variables exist. I will change it in next version of my patch. Thanks a lot! Joey Lee > > > So, this patch shows the status string instead of status code. > > > > On the other hand, the error message of EFI_NOT_FOUND > > (0x800000000000000e) doesn't need to be exposed because kernel > > already prints "Couldn't get UEFI..." message. This patch also > > filtered out it. > > > > Link: https://forums.opensuse.org/showthread.php/535324-MODSIGN-Couldn-t-get-UEFI-db-list?p=2897516#post2897516 > > Cc: James Morris > > Cc: Serge E. Hallyn" > > Cc: David Howells > > Cc: Nayna Jain > > Cc: Josh Boyer > > Cc: Mimi Zohar > > Signed-off-by: "Lee, Chun-Yi" > > --- > > security/integrity/platform_certs/load_uefi.c | 7 +++++-- > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/security/integrity/platform_certs/load_uefi.c b/security/integrity/platform_certs/load_uefi.c > > index 81b19c52832b..fe261166621f 100644 > > --- a/security/integrity/platform_certs/load_uefi.c > > +++ b/security/integrity/platform_certs/load_uefi.c > > @@ -48,7 +48,9 @@ static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid, > > > > status = efi.get_variable(name, guid, NULL, &lsize, &tmpdb); > > if (status != EFI_BUFFER_TOO_SMALL) { > > - pr_err("Couldn't get size: 0x%lx\n", status); > > + if (status != EFI_NOT_FOUND) > > + pr_err("Couldn't get size: %s\n", > > + efi_status_to_str(status)); > > return NULL; > > } > > > > @@ -59,7 +61,8 @@ static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid, > > status = efi.get_variable(name, guid, NULL, &lsize, db); > > if (status != EFI_SUCCESS) { > > kfree(db); > > - pr_err("Error reading db var: 0x%lx\n", status); > > + pr_err("Error reading db var: %s\n", > > + efi_status_to_str(status)); > > return NULL; > > } > > > > -- > > 2.16.4 > >