Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp1231293img; Fri, 22 Mar 2019 19:58:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwNtzfB8xyID+ugn22cmV5h1mK6Q7u3rCE/YKbk6MNkwjBURniNjHOhRGYq8QVpoZuT565q X-Received: by 2002:a17:902:b788:: with SMTP id e8mr2621593pls.339.1553309884062; Fri, 22 Mar 2019 19:58:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553309884; cv=none; d=google.com; s=arc-20160816; b=jujkT8e/KXPAQi6Z6bTueqPuXTeh35ddPu3hi46mQ+VgV14TqCZDrdmBehVHbAFpow gpbHIn3NSpAH4OZV88bwV7rxho8KU3lyJm94UCASmtToDRHL1br6Ej7PsUZpOIGgFAGU lvfh6cvP5p1snt3ygEayTh8AegLKVz7U3b3r4D9zjJ1IPjtrshmPWRQ+nCEvpyZFC5k8 fcpmQ7/r+fwO1TxB5z15X5++cONbj6alHxuwgArsBMhGZgEWNVcgnlswWZjARtArQXhM y8azD05MAMqACE5cMgxAQSIDv+2bIuklhDFUyuXTUi6bMD8+L/nAD5SwH+ta+vKjOM3k 6pFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=bQKmS7FjmiEnBT/cBchS4YycOGZbKHcM1vCYI3gu/HI=; b=pB1ROArlNvNFLA65BMxDgOmfH/FEcs6LPEF4s6kPLrC5hayFVS9rlRkEryzqyPiuLR tWFJJwKrD+z5qeji3plM3lEtwdYizgUSdXGbIFGVSqeU0052eKRPDfACvHJOPfxvo/Y6 LFGxNpegcpjlUDmyo70xFIYqkVgqFukRhW2LjteLFwizNzypqPe+N7ZqMF8Ctp1KcQrQ LRQ2QnQGfFvZvCzI3CGeIpoFNEqEqOm+Io2Kd1HTakxYCh0/SDt7WCjpLS98BaaOhtK9 joKQo4eCpcWoI6l7yV0CerPGGU7U8slaT3+DAutyILotlqDvpKQRrAkzMvo/vYF6NNT2 kkUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t192si3788336pgb.124.2019.03.22.19.57.48; Fri, 22 Mar 2019 19:58:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728330AbfCWC5Q (ORCPT + 99 others); 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > >