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.25882.1683615913017191949 for ; Tue, 09 May 2023 00:05:13 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bbnNhCGW; 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=1683615912; 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=KIKlbgRGQWvmtrA/2DNtnn7g1uD6kP9nBUmYaLCPZU0=; b=bbnNhCGW5FETmYGtGwGzbs+Avd9UZa4uiCB1roLdvR1aivsQtWAaPXkvFDcgpN7NF3sybn M2zLOSSwQuG/y6cRUQu1wfIQklHcz0QWR/RviWpucpKDhJRCF2tbO1TH8FCprMx+XPlW/X breZhFbeV3SYyi0b2EGNJocelm64noU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-35-P29oh7nQMCC8V1qBf37veQ-1; Tue, 09 May 2023 03:05:09 -0400 X-MC-Unique: P29oh7nQMCC8V1qBf37veQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8AF4F870830; Tue, 9 May 2023 07:05:08 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.221]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 52168C15BA0; Tue, 9 May 2023 07:05:08 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id A816D1801081; Tue, 9 May 2023 09:05:06 +0200 (CEST) Date: Tue, 9 May 2023 09:05:06 +0200 From: "Gerd Hoffmann" To: Michael Brown Cc: devel@edk2.groups.io, Laszlo Ersek , Oliver Steffen , Pawel Polawski , Jiewen Yao , Ard Biesheuvel , Jordan Justen Subject: Re: [PATCH 0/2] OvmfPkg: Relax assertion that interrupts do not occur at TPL_HIGH_LEVEL Message-ID: References: <476bbc17-6484-9afd-9be9-08de14d1d72e@redhat.com> <01020187fd46b80f-a69b4ae5-545f-45ae-ab0d-a48f725c7a40-000000@eu-west-1.amazonses.com> MIME-Version: 1.0 In-Reply-To: <01020187fd46b80f-a69b4ae5-545f-45ae-ab0d-a48f725c7a40-000000@eu-west-1.amazonses.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, May 08, 2023 at 09:31:23PM +0000, Michael Brown wrote: > At TPL_HIGH_LEVEL, CPU interrupts are disabled (as per the UEFI > specification) and so we should never encounter a situation in which > an interrupt occurs at TPL_HIGH_LEVEL. The specification also > restricts usage of TPL_HIGH_LEVEL to the firmware itself. > > However, nothing prevents a rogue UEFI application from illegally > calling gBS->RaiseTPL(TPL_HIGH_LEVEL) and then deliberately violating > the invariant by enabling interrupts via the STI or equivalent > instruction. Some versions of the Microsoft Windows bootloader are > known to do this. > > NestedInterruptTplLib maintains the invariant that interrupts are > disabled at TPL_HIGH_LEVEL (even when performing the dark art of > deliberately manipulating the stack so that IRET will return with > interrupts still disabled), but does not itself rely on external code > maintaining this invariant. > > Relax the assertion that the interrupted TPL is below TPL_HIGH_LEVEL > to an error message, to allow rogue UEFI applications such as the > Microsoft Windows bootloader to continue to function. > > Ref: https://bugzilla.redhat.com/show_bug.cgi?id=2189136 > Cc: Laszlo Ersek > Cc: Gerd Hoffmann > Cc: Oliver Steffen > Cc: Pawel Polawski > Cc: Jiewen Yao > Cc: Ard Biesheuvel > Cc: Jordan Justen > > Michael Brown (2): > OvmfPkg: Clarify invariants for NestedInterruptTplLib > OvmfPkg: Relax assertion that interrupts do not occur at > TPL_HIGH_LEVEL Reviewed-by: Gerd Hoffmann take care, Gerd