* Re: [edk2-devel] [PATCH v1 1/1] OvmfPkg/QemuVideoDxe: Zero out PixelInformation in QueryMode
2022-06-28 18:48 [PATCH v1 1/1] OvmfPkg/QemuVideoDxe: Zero out PixelInformation in QueryMode Dimitrije Pavlov
@ 2022-06-29 7:05 ` Gerd Hoffmann
2022-07-14 14:28 ` Sunny Wang
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Gerd Hoffmann @ 2022-06-29 7:05 UTC (permalink / raw)
To: devel, Dimitrije.Pavlov
Cc: Ard Biesheuvel, Jiewen Yao, Jordan Justen, Jeff Booher-Kaeding,
Samer El-Haj-Mahmoud, Sunny Wang, Jeremy Linton
On Tue, Jun 28, 2022 at 01:48:16PM -0500, Dimitrije Pavlov wrote:
> Ensure that the PixelInformation field of the
> EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure is zeroed out in
> EFI_GRAPHICS_OUTPUT_PROTOCOL.QueryMode() and
> EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode() when PixelFormat is
> PixelBlueGreenRedReserved8BitPerColor.
>
> According to UEFI 2.9 Section 12.9, PixelInformation field of the
> EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure is valid only if
> PixelFormat is PixelBitMask. This means that firmware is not required
> to fill out the PixelInformation field for other PixelFormat types,
> which implies that the QemuVideoDxe implementation is technically
> correct.
>
> However, not zeroing out those fields will leak the contents of the
> memory returned by the memory allocator, so it is better to explicitly
> set them to zero.
>
> In addition, the SCT test suite relies on PixelInformation always
> having a consistent value, which causes failures.
>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Jeff Booher-Kaeding <Jeff.Booher-Kaeding@arm.com>
> Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
> Cc: Sunny Wang <Sunny.Wang@arm.com>
> Cc: Jeremy Linton <Jeremy.Linton@arm.com>
>
> Signed-off-by: Dimitrije Pavlov <Dimitrije.Pavlov@arm.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1 1/1] OvmfPkg/QemuVideoDxe: Zero out PixelInformation in QueryMode
2022-06-28 18:48 [PATCH v1 1/1] OvmfPkg/QemuVideoDxe: Zero out PixelInformation in QueryMode Dimitrije Pavlov
2022-06-29 7:05 ` [edk2-devel] " Gerd Hoffmann
@ 2022-07-14 14:28 ` Sunny Wang
2022-07-18 16:11 ` Samer El-Haj-Mahmoud
2022-07-27 15:42 ` [edk2-devel] " Ard Biesheuvel
3 siblings, 0 replies; 7+ messages in thread
From: Sunny Wang @ 2022-07-14 14:28 UTC (permalink / raw)
To: Dimitrije Pavlov, devel@edk2.groups.io
Cc: Ard Biesheuvel, Jiewen Yao, Jordan Justen, Gerd Hoffmann,
Jeff Booher-Kaeding, Samer El-Haj-Mahmoud, Jeremy Linton,
Sunny Wang
Looks good to me. Thanks for working on this, Dimitrije.
I had an offline discussion with Dimitrije. Either this patch or the patch for SCT (https://edk2.groups.io/g/devel/topic/92068027) can fix the inconsistent test failure issue mentioned in https://bugzilla.tianocore.org/show_bug.cgi?id=3601
Reviewed-by: Sunny Wang <sunny.wang@arm.com>
-----Original Message-----
From: Dimitrije Pavlov <Dimitrije.Pavlov@arm.com>
Sent: 28 June 2022 19:48
To: devel@edk2.groups.io
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>; Jiewen Yao <jiewen.yao@intel.com>; Jordan Justen <jordan.l.justen@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; Jeff Booher-Kaeding <Jeff.Booher-Kaeding@arm.com>; Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>; Sunny Wang <Sunny.Wang@arm.com>; Jeremy Linton <Jeremy.Linton@arm.com>
Subject: [PATCH v1 1/1] OvmfPkg/QemuVideoDxe: Zero out PixelInformation in QueryMode
Ensure that the PixelInformation field of the
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure is zeroed out in
EFI_GRAPHICS_OUTPUT_PROTOCOL.QueryMode() and
EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode() when PixelFormat is
PixelBlueGreenRedReserved8BitPerColor.
According to UEFI 2.9 Section 12.9, PixelInformation field of the
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure is valid only if
PixelFormat is PixelBitMask. This means that firmware is not required
to fill out the PixelInformation field for other PixelFormat types,
which implies that the QemuVideoDxe implementation is technically
correct.
However, not zeroing out those fields will leak the contents of the
memory returned by the memory allocator, so it is better to explicitly
set them to zero.
In addition, the SCT test suite relies on PixelInformation always
having a consistent value, which causes failures.
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Jeff Booher-Kaeding <Jeff.Booher-Kaeding@arm.com>
Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Cc: Sunny Wang <Sunny.Wang@arm.com>
Cc: Jeremy Linton <Jeremy.Linton@arm.com>
Signed-off-by: Dimitrije Pavlov <Dimitrije.Pavlov@arm.com>
---
OvmfPkg/QemuVideoDxe/Gop.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/OvmfPkg/QemuVideoDxe/Gop.c b/OvmfPkg/QemuVideoDxe/Gop.c
index 0c4dea7fb6f2..7a9fe208c99c 100644
--- a/OvmfPkg/QemuVideoDxe/Gop.c
+++ b/OvmfPkg/QemuVideoDxe/Gop.c
@@ -31,7 +31,14 @@ QemuVideoCompleteModeInfo (
Info->PixelInformation.ReservedMask = 0;
} else if (ModeData->ColorDepth == 32) {
DEBUG ((DEBUG_INFO, "PixelBlueGreenRedReserved8BitPerColor\n"));
- Info->PixelFormat = PixelBlueGreenRedReserved8BitPerColor;
+ Info->PixelFormat = PixelBlueGreenRedReserved8BitPerColor;
+ Info->PixelInformation.RedMask = 0;
+ Info->PixelInformation.GreenMask = 0;
+ Info->PixelInformation.BlueMask = 0;
+ Info->PixelInformation.ReservedMask = 0;
+ } else {
+ DEBUG ((DEBUG_ERROR, "%a: Invalid ColorDepth %u", __FUNCTION__, ModeData->ColorDepth));
+ ASSERT (FALSE);
}
Info->PixelsPerScanLine = Info->HorizontalResolution;
--
2.34.1
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v1 1/1] OvmfPkg/QemuVideoDxe: Zero out PixelInformation in QueryMode
2022-06-28 18:48 [PATCH v1 1/1] OvmfPkg/QemuVideoDxe: Zero out PixelInformation in QueryMode Dimitrije Pavlov
2022-06-29 7:05 ` [edk2-devel] " Gerd Hoffmann
2022-07-14 14:28 ` Sunny Wang
@ 2022-07-18 16:11 ` Samer El-Haj-Mahmoud
2022-07-27 15:42 ` [edk2-devel] " Ard Biesheuvel
3 siblings, 0 replies; 7+ messages in thread
From: Samer El-Haj-Mahmoud @ 2022-07-18 16:11 UTC (permalink / raw)
To: Dimitrije Pavlov, devel@edk2.groups.io
Cc: Ard Biesheuvel, Jiewen Yao, Jordan Justen, Gerd Hoffmann,
Jeff Booher-Kaeding, Sunny Wang, Jeremy Linton,
Samer El-Haj-Mahmoud, nd
Reviewed-By: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Any chance we can get this pushed?
Thanks,
--Samer
> -----Original Message-----
> From: Dimitrije Pavlov <Dimitrije.Pavlov@arm.com>
> Sent: Tuesday, June 28, 2022 2:48 PM
> To: devel@edk2.groups.io
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>; Jiewen Yao
> <jiewen.yao@intel.com>; Jordan Justen <jordan.l.justen@intel.com>;
> Gerd Hoffmann <kraxel@redhat.com>; Jeff Booher-Kaeding <Jeff.Booher-
> Kaeding@arm.com>; Samer El-Haj-Mahmoud <Samer.El-Haj-
> Mahmoud@arm.com>; Sunny Wang <Sunny.Wang@arm.com>; Jeremy
> Linton <Jeremy.Linton@arm.com>
> Subject: [PATCH v1 1/1] OvmfPkg/QemuVideoDxe: Zero out
> PixelInformation in QueryMode
>
> Ensure that the PixelInformation field of the
> EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure is zeroed out in
> EFI_GRAPHICS_OUTPUT_PROTOCOL.QueryMode() and
> EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode() when PixelFormat is
> PixelBlueGreenRedReserved8BitPerColor.
>
> According to UEFI 2.9 Section 12.9, PixelInformation field of the
> EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure is valid only if
> PixelFormat is PixelBitMask. This means that firmware is not required
> to fill out the PixelInformation field for other PixelFormat types,
> which implies that the QemuVideoDxe implementation is technically
> correct.
>
> However, not zeroing out those fields will leak the contents of the
> memory returned by the memory allocator, so it is better to explicitly
> set them to zero.
>
> In addition, the SCT test suite relies on PixelInformation always
> having a consistent value, which causes failures.
>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Jeff Booher-Kaeding <Jeff.Booher-Kaeding@arm.com>
> Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
> Cc: Sunny Wang <Sunny.Wang@arm.com>
> Cc: Jeremy Linton <Jeremy.Linton@arm.com>
>
> Signed-off-by: Dimitrije Pavlov <Dimitrije.Pavlov@arm.com>
> ---
> OvmfPkg/QemuVideoDxe/Gop.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/OvmfPkg/QemuVideoDxe/Gop.c
> b/OvmfPkg/QemuVideoDxe/Gop.c
> index 0c4dea7fb6f2..7a9fe208c99c 100644
> --- a/OvmfPkg/QemuVideoDxe/Gop.c
> +++ b/OvmfPkg/QemuVideoDxe/Gop.c
> @@ -31,7 +31,14 @@ QemuVideoCompleteModeInfo (
> Info->PixelInformation.ReservedMask = 0;
> } else if (ModeData->ColorDepth == 32) {
> DEBUG ((DEBUG_INFO, "PixelBlueGreenRedReserved8BitPerColor\n"));
> - Info->PixelFormat = PixelBlueGreenRedReserved8BitPerColor;
> + Info->PixelFormat =
> PixelBlueGreenRedReserved8BitPerColor;
> + Info->PixelInformation.RedMask = 0;
> + Info->PixelInformation.GreenMask = 0;
> + Info->PixelInformation.BlueMask = 0;
> + Info->PixelInformation.ReservedMask = 0;
> + } else {
> + DEBUG ((DEBUG_ERROR, "%a: Invalid ColorDepth %u", __FUNCTION__,
> ModeData->ColorDepth));
> + ASSERT (FALSE);
> }
>
> Info->PixelsPerScanLine = Info->HorizontalResolution;
> --
> 2.34.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [edk2-devel] [PATCH v1 1/1] OvmfPkg/QemuVideoDxe: Zero out PixelInformation in QueryMode
2022-06-28 18:48 [PATCH v1 1/1] OvmfPkg/QemuVideoDxe: Zero out PixelInformation in QueryMode Dimitrije Pavlov
` (2 preceding siblings ...)
2022-07-18 16:11 ` Samer El-Haj-Mahmoud
@ 2022-07-27 15:42 ` Ard Biesheuvel
2022-07-27 19:34 ` Dimitrije Pavlov
3 siblings, 1 reply; 7+ messages in thread
From: Ard Biesheuvel @ 2022-07-27 15:42 UTC (permalink / raw)
To: edk2-devel-groups-io, Dimitrije Pavlov
Cc: Ard Biesheuvel, Jiewen Yao, Jordan Justen, Gerd Hoffmann,
Jeff Booher-Kaeding, Samer El-Haj-Mahmoud, Sunny Wang,
Jeremy Linton
On Tue, 28 Jun 2022 at 11:48, Dimitrije Pavlov <Dimitrije.Pavlov@arm.com> wrote:
>
> Ensure that the PixelInformation field of the
> EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure is zeroed out in
> EFI_GRAPHICS_OUTPUT_PROTOCOL.QueryMode() and
> EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode() when PixelFormat is
> PixelBlueGreenRedReserved8BitPerColor.
>
> According to UEFI 2.9 Section 12.9, PixelInformation field of the
> EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure is valid only if
> PixelFormat is PixelBitMask. This means that firmware is not required
> to fill out the PixelInformation field for other PixelFormat types,
> which implies that the QemuVideoDxe implementation is technically
> correct.
>
> However, not zeroing out those fields will leak the contents of the
> memory returned by the memory allocator, so it is better to explicitly
> set them to zero.
>
> In addition, the SCT test suite relies on PixelInformation always
> having a consistent value, which causes failures.
>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Jeff Booher-Kaeding <Jeff.Booher-Kaeding@arm.com>
> Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
> Cc: Sunny Wang <Sunny.Wang@arm.com>
> Cc: Jeremy Linton <Jeremy.Linton@arm.com>
>
> Signed-off-by: Dimitrije Pavlov <Dimitrije.Pavlov@arm.com>
> ---
> OvmfPkg/QemuVideoDxe/Gop.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/OvmfPkg/QemuVideoDxe/Gop.c b/OvmfPkg/QemuVideoDxe/Gop.c
> index 0c4dea7fb6f2..7a9fe208c99c 100644
> --- a/OvmfPkg/QemuVideoDxe/Gop.c
> +++ b/OvmfPkg/QemuVideoDxe/Gop.c
> @@ -31,7 +31,14 @@ QemuVideoCompleteModeInfo (
> Info->PixelInformation.ReservedMask 0;
> } else if (ModeData->ColorDepth 32) {
> DEBUG ((DEBUG_INFO, "PixelBlueGreenRedReserved8BitPerColor\n"));
> - Info->PixelFormat PixelBlueGreenRedReserved8BitPerColor;
> + Info->PixelFormat PixelBlueGreenRedReserved8BitPerColor;
> + Info->PixelInformation.RedMask 0;
> + Info->PixelInformation.GreenMask 0;
> + Info->PixelInformation.BlueMask 0;
> + Info->PixelInformation.ReservedMask 0;
Is this valid C? Or is the patch corrupted by email?
> + } else {
> + DEBUG ((DEBUG_ERROR, "%a: Invalid ColorDepth %u", __FUNCTION__, ModeData->ColorDepth));
> + ASSERT (FALSE);
> }
>
> Info->PixelsPerScanLine Info->HorizontalResolution;
> --
> 2.34.1
>
>
>
> ------------
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#90822): https://edk2.groups.io/g/devel/message/90822
> Mute This Topic: https://groups.io/mt/92050521/1131722
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [ardb@kernel.org]
> ------------
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread