From: "Ard Biesheuvel" <ardb@kernel.org>
To: Dimitrije Pavlov <Dimitrije.Pavlov@arm.com>
Cc: edk2-devel-groups-io <devel@edk2.groups.io>,
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: Re: [PATCH v2 1/1] OvmfPkg/QemuVideoDxe: Zero out PixelInformation in QueryMode
Date: Mon, 1 Aug 2022 22:50:30 +0200 [thread overview]
Message-ID: <CAMj1kXGMbwe-Kz2USkrSYjLfWMh4zqwwLNNRCwWThKnrQj9gOA@mail.gmail.com> (raw)
In-Reply-To: <20220728213042.2145-1-Dimitrije.Pavlov@arm.com>
On Thu, 28 Jul 2022 at 23:31, 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>
>
> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Merged as #3164
Thanks,
> ---
> 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
>
next prev parent reply other threads:[~2022-08-01 20:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-28 21:30 [PATCH v2 1/1] OvmfPkg/QemuVideoDxe: Zero out PixelInformation in QueryMode Dimitrije Pavlov
2022-08-01 20:50 ` Ard Biesheuvel [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-07-28 21:54 Dimitrije Pavlov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMj1kXGMbwe-Kz2USkrSYjLfWMh4zqwwLNNRCwWThKnrQj9gOA@mail.gmail.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox