Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp734405img; Fri, 22 Mar 2019 07:30:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqy3OHPKpSt5hFmx9XO/oubpYUwRh3nN8P1eqw3HUsl1JZyoMp2Qpk0AcSRL8USTqccnYejt X-Received: by 2002:aa7:8243:: with SMTP id e3mr9692885pfn.40.1553265037129; Fri, 22 Mar 2019 07:30:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553265037; cv=none; d=google.com; s=arc-20160816; b=TXGyIr38vrNilRTgV1wLP7wV2RTmY9NW/ja5GN6GTWLfk3irJP9WqgGNxGZM8PbV3I J0ztguSImO2bMhvkXpeQ3t5lNU/feJg0IkT/tcY5Y3eTmWJwRxMveVCjLwPdUutuWIRw Omzajud6D9Kcjt1/Uc03tNCKeqlnUShsonQETTfrw50efdrh2WEaRCZCIHoKAHl4rtve uTwGib0wD8Xzbf0mRb8YsXkj3+FNW0udpDhZxKuRajmmx2QOilAEYcrWNfpHyybp6PBq EUn6kEqEISNcASEFXoA4qX+Rs6jLV0fol0C8flc2qYhbrN+RLu4cczMqXZM+zYbzAxe3 0gMQ== 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=VCXkqtJXweMtT7tkjAU9aokE2Llx9dELHbkDZghxZuc=; b=Uh9ftE2P/0cTwNRnIR2sRcuVDwtbpTG74vpn1VnIBZ5MIh9/SRnurctvcHet/wOzgQ YERca9aJ/Fl4KUSiIm2H0epOG09DTyG6J+nTOmdr/ffLtqc5+LEer/oX2HyYw7DhaFqO 0Xx2LOW8t8B4ugqQQM6G/lAkfB1rKIMMWIhpbupbyrzLutBF/LzxbN/KhiO59in6wLti XcvgxHfw85GJn5UshZOvYDap4SGgTUYROYIOtX3pI8lF0q4FjJRKvRO1qGwF8gyWyK24 4Qlp7WIELd1Nat+0FeRUlD29/4m8H/MrCkQUKclpp85hEc6ku6c+IFcVEfJNlYY7O1s3 HRiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NEdJMIK9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 16si1842355pfr.26.2019.03.22.07.30.19; Fri, 22 Mar 2019 07:30:37 -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; dkim=pass header.i=@linaro.org header.s=google header.b=NEdJMIK9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728736AbfCVO16 (ORCPT + 99 others); Fri, 22 Mar 2019 10:27:58 -0400 Received: from mail-it1-f195.google.com ([209.85.166.195]:35849 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727996AbfCVO16 (ORCPT ); Fri, 22 Mar 2019 10:27:58 -0400 Received: by mail-it1-f195.google.com with SMTP id h9so3547733itl.1 for ; Fri, 22 Mar 2019 07:27:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VCXkqtJXweMtT7tkjAU9aokE2Llx9dELHbkDZghxZuc=; b=NEdJMIK9h2iWW4z/4DLDds0gdjLAJfcSG3gwWS4GiCWbhHKUQIw79yK8oSdAGIhDeK 1raJXetJfp6kF94+UUB0srpLPbwGjekNgmFDlB6KgIty68/w/6/NLVcBpr+16x7u7nsb g0WCuYfXcivGP5WlTrH9iGAnxzRKZr7TIBgnkNp9ghvSryFQLeT87o12BVYrFeKK3Q6L 2ukOqNOquDy52Q7drG2QLI3NNZgwnnmn1hkF3wpMKz4A1kVNN0vHDLUS0TiHLOFcwBv/ PjQMrcqTgH6Q7iSOyRXS5y6Ki3qduxfM6RiTqkn08KwJ7p0sKykAxkGDVn/uqU4jrlZZ n6JA== 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=VCXkqtJXweMtT7tkjAU9aokE2Llx9dELHbkDZghxZuc=; b=DrpRZWhvO3OJh4LXhfb7300lpfgTf1110vCXFu+vtwexOs3CqIXoMDkQG7TLd8YSzb eoWs1+vE8rO95ZD5h49l295Urr8NPNmDMVrzKU48pV/23Dt0y47avcP5SBTQOdxUSc3w omTUwdUlZV/SQr4edqUwXbTvJN+3KqiB0AMZr7g/xIc/veEsD1AAMz0oGEIDqix/pNue vYWU+D1QL+ruHvIjGhO4Tota688xBT8hUCn+WnEIS96fG4bNdzKxA+i94tUV/OBklXO5 OGryzU29lySYd/tI2GSQ+AGrwHZ+wUZ0j+Ecocp3rsQYz6ROWGdSrzV+9We7batTvBnT 51xA== X-Gm-Message-State: APjAAAUH+qI+AnWo2fqYS9TG1j6rOmVlmCBtaYWMc99r3pB8/pzItIdf aiC3cT1G1vQP/+AOZ7uuBfzYCK0mPCWMz9YFwBVBOQ== X-Received: by 2002:a02:ac14:: with SMTP id a20mr7591159jao.130.1553264877146; Fri, 22 Mar 2019 07:27:57 -0700 (PDT) MIME-Version: 1.0 References: <20190322103350.27764-1-jlee@suse.com> <20190322103350.27764-2-jlee@suse.com> In-Reply-To: <20190322103350.27764-2-jlee@suse.com> From: Ard Biesheuvel Date: Fri, 22 Mar 2019 15:27:46 +0100 Message-ID: Subject: Re: [PATCH 2/2] efi: print appropriate status message when loading certificates To: "Lee, Chun-Yi" Cc: James Morris , "Serge E . Hallyn" , David Howells , Josh Boyer , Nayna Jain , Mimi Zohar , linux-efi , linux-security-module , Linux Kernel Mailing List , "Lee, Chun-Yi" 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, 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? > 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 >