From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id F260E21F2AF6E for ; Thu, 28 Sep 2017 00:56:30 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9AD1AC07242E; Thu, 28 Sep 2017 07:59:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9AD1AC07242E Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=lersek@redhat.com Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-73.rdu2.redhat.com [10.10.120.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4B518271A; Thu, 28 Sep 2017 07:59:42 +0000 (UTC) To: Jian J Wang , edk2-devel@lists.01.org Cc: Star Zeng , Eric Dong , Jiewen Yao , Michael Kinney , Jordan Justen , Ayellet Wolman References: <20170928010353.11968-1-jian.j.wang@intel.com> <20170928010353.11968-7-jian.j.wang@intel.com> From: Laszlo Ersek Message-ID: Date: Thu, 28 Sep 2017 09:59:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170928010353.11968-7-jian.j.wang@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 28 Sep 2017 07:59:44 +0000 (UTC) Subject: Re: [PATCH v3 6/6] OvmfPkg/QemuVideoDxe: Bypass NULL pointer detection during VBE SHIM installing X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Sep 2017 07:56:31 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 09/28/17 03:03, Jian J Wang wrote: > QemuVideoDxe driver will link VBE SHIM into page 0. If NULL pointer > detection is enabled, this driver will fail to load. NULL pointer detection > bypassing code is added to prevent such problem during boot. > > Please note that Windows 7 will try to access VBE SHIM during boot if it's > installed, and then cause boot failure. This can be fixed by setting BIT7 > of PcdNullPointerDetectionPropertyMask to disable NULL pointer detection > after EndOfDxe. As far as we know, there's no other OSs has such issue. > >> According to Laszlo, remove the code disabling/enabling the NULL pointer >> detection but just ignore the installing if it's enabled > > Cc: Star Zeng > Cc: Eric Dong > Cc: Laszlo Ersek > Cc: Jiewen Yao > Cc: Michael Kinney > Cc: Jordan Justen > Cc: Ayellet Wolman > Suggested-by: Ayellet Wolman > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Jian J Wang > --- > OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf | 1 + > OvmfPkg/QemuVideoDxe/VbeShim.c | 14 ++++++++++++++ > 2 files changed, 15 insertions(+) > > diff --git a/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf b/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf > index 577e07b0a8..ff68c99e96 100644 > --- a/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf > +++ b/OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf > @@ -77,3 +77,4 @@ > [Pcd] > gOptionRomPkgTokenSpaceGuid.PcdDriverSupportedEfiVersion > gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId > + gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask > diff --git a/OvmfPkg/QemuVideoDxe/VbeShim.c b/OvmfPkg/QemuVideoDxe/VbeShim.c > index e45a08e887..8ba5522cde 100644 > --- a/OvmfPkg/QemuVideoDxe/VbeShim.c > +++ b/OvmfPkg/QemuVideoDxe/VbeShim.c > @@ -75,6 +75,20 @@ InstallVbeShim ( > UINTN Printed; > VBE_MODE_INFO *VbeModeInfo; > > + if ((PcdGet8 (PcdNullPointerDetectionPropertyMask) & (BIT0|BIT7)) == BIT0) { > + DEBUG (( > + DEBUG_WARN, > + "%a: page 0 protected, not installing VBE shim\n", > + __FUNCTION__ > + )); > + DEBUG (( > + DEBUG_WARN, > + "%a: page 0 protection prevents Windows 7 from booting anyway\n", > + __FUNCTION__ > + )); > + return; > + } > + > Segment0 = 0x00000; > SegmentC = 0xC0000; > SegmentF = 0xF0000; > Reviewed-by: Laszlo Ersek