From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.10110.1679306534245683429 for ; Mon, 20 Mar 2023 03:02:14 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TmnUv18y; spf=pass (domain: redhat.com, ip: 170.10.129.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679306533; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8x8VmbBv+hVPVwf47scx2GxKTo/N9cC7091P4mNHNlo=; b=TmnUv18ysWH6geae5HIhdNUQI7NS9v/7BgLMsEc8ZNcso85PJsAA+JBMsWRl9ZUW5EKRHG eVW6+wBT8eAYOJhnyZ6qWPQwArgX7XKvS2IOrA9Zl/EqNtm1eoZpNB4CPTBGld/jg2U9fr cqYhZ0AgvyyoQyZgy6I91fJ9Pd3eMtM= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-63-Iy7mJTe_NsK65R3bFTJkwg-1; Mon, 20 Mar 2023 06:02:10 -0400 X-MC-Unique: Iy7mJTe_NsK65R3bFTJkwg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9F4421C0A58F; Mon, 20 Mar 2023 10:02:09 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.144]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 594CC40C20FA; Mon, 20 Mar 2023 10:02:09 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 18F5C1800081; Mon, 20 Mar 2023 11:02:08 +0100 (CET) Date: Mon, 20 Mar 2023 11:02:08 +0100 From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Pawel Polawski , Jian J Wang , Oliver Steffen , Min Xu , Marvin =?utf-8?Q?H=C3=A4user?= , Jiewen Yao , jmaloy@redhat.com Subject: Re: [PATCH v2 1/1] SecurityPkg/DxeImageVerificationLib: Check result of GetEfiGlobalVariable2 Message-ID: <20230320100208.xhoz7smo5fkhal26@sirius.home.kraxel.org> References: <20230303103553.804781-1-kraxel@redhat.com> MIME-Version: 1.0 In-Reply-To: <20230303103553.804781-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Mar 03, 2023 at 11:35:53AM +0100, Gerd Hoffmann wrote: > Call gRT->GetVariable() directly to read the SecureBoot variable. It is > one byte in size so we can easily place it on the stack instead of > having GetEfiGlobalVariable2() allocate it for us, which avoids a few > possible error cases. > > Skip secure boot checks if (and only if): > > (a) the SecureBoot variable is not present (EFI_NOT_FOUND) according to > the return value, or > (b) the SecureBoot variable was read successfully and is set to > SECURE_BOOT_MODE_DISABLE. > > Previously the code skipped the secure boot checks on *any* > gRT->GetVariable() error (GetEfiGlobalVariable2 sets the variable > value to NULL in that case) and also on memory allocation failures. > > Fixes: CVE-2019-14560 > Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=2167 > Signed-off-by: Gerd Hoffmann Ping. Any comments on this patch? take care, Gerd