From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (EUR01-DB5-obe.outbound.protection.outlook.com [40.107.15.40]) by mx.groups.io with SMTP id smtpd.web11.8290.1657808955164212822 for ; Thu, 14 Jul 2022 07:29:15 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=lVw+ZqMM; spf=pass (domain: arm.com, ip: 40.107.15.40, mailfrom: sunny.wang@arm.com) ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=W6YdheVNAnjiFFzlmkTX1tFaC0toikTjocHEBd84emgaAyyzle1yMHCch4o7TGawqgJmhn+d+ML8J8ZZ/jfO3udFCttO3dwRc7obFL3NKUNSgUsSpoMrswoKn5JZW+ikFfU2HvuwY19FlDisRtqAihySZZlcsw0IMYfOuRK14IFVyPGNYCLEBlAShdcZAmGBJWlXAhG2Jl7kcVBgJm9CB+dr13CvQiGrh64C7jRew8IIpPbnGe9/11VIS/N7QkEDiQZz24enmX2u0gr00myX6cpFHEr3tbPefJlxBSHsL8/3wewH++lccnCd+0GNFy5SPGzq3Qdlo7POayi+keIOXQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wyv/83QCazplJ6F4T3dJHOly+2eFOXqdQ8ngDRxQOEE=; b=bqEluRQTCe7gGF6Oqoo3QIorrc2QpF9N/fBjCKwdsAI7g6Nor15z5sDI/AELN/G2LY7iEsjZsdGNthxzDeTzZeqp8FhXIfok9FoQ2myUPCEU+ja3PXLuC/St7/yrtopZbQ+VlOyVvojYdG5p/AT+QLhG5g9nvIqPB0jrwcY3j0qgnnOg62hDpUQEy+McKaBIHkz2bx2GOl/UkxCUfXNigzSKEEACxBcnAbRr5XT+qK5nu+LrBMP19XW1aZJ/HxRcFmqZpSHtbCmNvqLhegLVa7/Lzcn9+O6zTIeRrk3CaHf+5iz2vCY1DcO0bRICGNiaRLWtlmd3i40+GWCkI+QYrA== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wyv/83QCazplJ6F4T3dJHOly+2eFOXqdQ8ngDRxQOEE=; b=lVw+ZqMMiO4fGIdvctiS8NPqdiWAxLaC1ZIDfc817LOgGH+yS97ImEsdAjm/uPUdOev/gW56ZsUoUwEqVfSBCWDOoWSYRvbbc7EWuy6SxA40kgGv/FgHDxM3HJSfml88uF0glkIa2TPQsejw9I1/gR096IoPtCSDTlb8f3smomk= Received: from AS9PR06CA0585.eurprd06.prod.outlook.com (2603:10a6:20b:486::16) by GVXPR08MB7704.eurprd08.prod.outlook.com (2603:10a6:150:6a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.26; Thu, 14 Jul 2022 14:29:11 +0000 Received: from VE1EUR03FT011.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:486:cafe::9) by AS9PR06CA0585.outlook.office365.com (2603:10a6:20b:486::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.26 via Frontend Transport; Thu, 14 Jul 2022 14:29:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT011.mail.protection.outlook.com (10.152.18.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.15 via Frontend Transport; Thu, 14 Jul 2022 14:29:10 +0000 Received: ("Tessian outbound 6f9e7ef31fa8:v122"); Thu, 14 Jul 2022 14:29:10 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: b6d69f8cb0462cd4 X-CR-MTA-TID: 64aa7808 Received: from 3e997868b692.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 48A2ADF4-C63F-4FAA-80E6-35E711A1425C.1; Thu, 14 Jul 2022 14:28:58 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 3e997868b692.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 14 Jul 2022 14:28:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nu4Lk0oMGIBq+kBeryOl5Vv1NYW0IUa1Mjt+Y9qsoIR9VnsV4Kl1BRx+TlwtjDIXtzTzwKLn0eAtTWlMj+E8MglS4P2OV2C4o7xUQMhOdlxuqAlLb0cBbQHhJThoGzLGbqG8UvAwI7IPleo4hyudXcM9pT3amKs5mwFp7WZNGDO8lfQnAaWxPpRd3bjGw2tM8Pn/k5d3rVfaivcHnzjwK7LXASCO3oY+mczzoCYYlNQOYxjI9+Oen87s97B5cOFHZom3K0QsVad+Ac5rhJ7VPh/h8GF0b6tBzbSgoFfOBpHtTSOlGza02Dg+y26PVVHivmPg4TpsmnWVCsetcyCpEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wyv/83QCazplJ6F4T3dJHOly+2eFOXqdQ8ngDRxQOEE=; b=a1nRLtsht2xrK0DRfxYuHVWNl89NTqMiIL7ekIJ82E87oRRs2pUt6g2hXLb9yOYL5TzqyJlvMilpv5EW0dJRxRM/oGoI5k/9g7B33wQteJHchotaknMo5HttzwXy/f3vC4e3GS93LImdCjVX0IYmS0U7qBJfIhQBHNTs2o/4x6AwC4m2nXFnRXoBoCbY6TEB+zwgXZ7C3Vru53gLHfvdiZ6nDf9dC4bjlIYXMlObxx7A53Gee6pjc8Y6P+qMHkTTECxYB3XWE8VnLZbmgs3lpOKvXBq+aMwINs0hV1AFZA1LLsR608BObkjBhF92NILzUZlQNw8rX79O5q5hD058KA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wyv/83QCazplJ6F4T3dJHOly+2eFOXqdQ8ngDRxQOEE=; b=lVw+ZqMMiO4fGIdvctiS8NPqdiWAxLaC1ZIDfc817LOgGH+yS97ImEsdAjm/uPUdOev/gW56ZsUoUwEqVfSBCWDOoWSYRvbbc7EWuy6SxA40kgGv/FgHDxM3HJSfml88uF0glkIa2TPQsejw9I1/gR096IoPtCSDTlb8f3smomk= Received: from AS8PR08MB7791.eurprd08.prod.outlook.com (2603:10a6:20b:52d::6) by HE1PR0801MB1753.eurprd08.prod.outlook.com (2603:10a6:3:88::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.14; Thu, 14 Jul 2022 14:28:54 +0000 Received: from AS8PR08MB7791.eurprd08.prod.outlook.com ([fe80::f53a:a7c8:f845:4b37]) by AS8PR08MB7791.eurprd08.prod.outlook.com ([fe80::f53a:a7c8:f845:4b37%7]) with mapi id 15.20.5417.023; Thu, 14 Jul 2022 14:28:54 +0000 From: "Sunny Wang" 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 Subject: Re: [PATCH v1 1/1] OvmfPkg/QemuVideoDxe: Zero out PixelInformation in QueryMode Thread-Topic: [PATCH v1 1/1] OvmfPkg/QemuVideoDxe: Zero out PixelInformation in QueryMode Thread-Index: AQHYix+zkwc10hcxXE2w2eXE7jm1nq1+A8WA Date: Thu, 14 Jul 2022 14:28:54 +0000 Message-ID: References: <20220628184816.24493-1-Dimitrije.Pavlov@arm.com> In-Reply-To: <20220628184816.24493-1-Dimitrije.Pavlov@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-MS-Office365-Filtering-Correlation-Id: a3931f96-d22f-4fb8-512a-08da65a537db x-ms-traffictypediagnostic: HE1PR0801MB1753:EE_|VE1EUR03FT011:EE_|GVXPR08MB7704:EE_ x-checkrecipientrouted: true nodisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: a+OKzPLDZBWloA1i6fPPkWhehmOfz7hr/6NRwUlbWP+b+O4GcxBMlSeHvKhCHMD3VtZiqLKZbtIaK9kquHscl4AGaiJzldfH4HyTA9AtIAxf8aSU9NAZuSXXZIscKnsHaAdOsgbGRazBjwkU7RRFsAafKiMJIyGUIJDxow7ioga1LwAHU8NN03aPsCzrBPyWn1RUyJi9HtNhqnbP1EwYDL3yN6qF6ylrg7iDwavuxTy17lkews0y4y1P0dDUqawu72SAyzMjxfbFJFxHZDPe5MDEIyomkpvwKyOls+yZmyZlRZ8MLJYKTWeHSFbbzyPuy20Gi170JOC3z2bWlU1BpwqqI81Syqo+Dcl88E4eQnvSu5fa09BkdQ0gWCmkXYg0UmUa6rRMbH5CFjkTM6qhfdmodMA5o/EsOV+YCaccvLkMB3fWjktRWViNl5ZgyXEL+TlEhAp4Xki8K4HrnqDTQqwYPBNZXIXxq7/9+5IPAhsbsD18ljH8I4Vlle7e4FBHTpjs4MWDyJMHy+xIBMXRC9VIusxmtxXWmTcQDnzxy8YkaucbU4B0gTdAp0uV8+1N9QJZ8U3kYCBz8t/iAo6r9i6fwS6Cb0hSk2XOHn4AwA54wnc94A7S/eWaJFWtilt+I31ZkdX7o7s3AMwEKxrJtusnlIbbYYRD/lQduklOKq/PBQ8vZ9XwFR6fSw7ajHmBBmdBdwsQ8vXBh3jPNRmYV9Z8wrMWup8U2zMMavZ/SSmpqaQkeUOOKzrdjz4Crd/KcwMHjWlYWqTE1yLXGSKKXwTMoiC+RLsrv/W2IBKvrwBNA0ghyRD+PEqytluAvziF15k0TjW1tCV6Pb2Do+LeclJyLng27XImbXhajOorSIH8tS4Xi1gHxFGY5A83aXPI X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR08MB7791.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(396003)(346002)(376002)(366004)(39860400002)(136003)(71200400001)(478600001)(966005)(33656002)(53546011)(38100700002)(4326008)(7696005)(41300700001)(26005)(9686003)(66946007)(66476007)(110136005)(76116006)(66446008)(19627235002)(316002)(64756008)(8676002)(66556008)(54906003)(186003)(6506007)(8936002)(55016003)(5660300002)(52536014)(83380400001)(38070700005)(86362001)(2906002)(122000001);DIR:OUT;SFP:1101; MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1753 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Return-Path: Sunny.Wang@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT011.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: a11b0b9b-a93d-4245-fdb0-08da65a52e2b X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xFLX5KMpLGM8xOpJAWFzC8K4tBI/05bwk5eyxVn23VLfda8sFTEvGHbhj+NQB18E+uJqxGnezUrxCdHUIqwtGhLKExzWUxtwg7wJJn07EZRoYVdjgBM8Ups1E+JAXYiN1vY9vB6emYvWbD6EeFx/0VcuKdRW7vXWuYcIaR13zDs6S0COjPcRWg2VY3CBV3cqU7Mzg/6B68R5v7ocL3T7js3FEyyHFlko5aqAazBLlTEHg2EiIEhO8p6aYJOZ4rCgbOF8KyiHzRAq9m7Buu8X3NR91SSTKDCCvFWqODCJZF4Ka6ukKYMt6MZFtsorp4q+4zY/rtIn12WXQxI4owYLi7xQ1jLMJJ9Vzwv/Xo86rpjey71Y0Lc4YDHp0o2Cp4M5sGRYCGRkVfIyK+UIqXYBqwyxqyxUVwuKzmr3kBJXh2cHXTrz/hgxNuZAYOuVw+DIAGwZHXkUYXpPIR4RyCoUGytE5PNAU/L6sH4Kmxzquzi5TeQHLNYw3Jpe4cS4loYq/fpJnn/ebGwDsPcCssAi/DCzx+wxW3HOPIwT+bxguJ7teRPBMq8XQscVGIzxkZ/Hnr+resdkHh+DphmFtexLBO5NM2cuDePOrfD1SkIW9KJ1oLY6bORYVdLM2LYBKEPS9yENCTjHy8oR/qWENlhEUuOXS2HMh7qzOeFhEbIlOOI+lEvD3tOoTPBBCD1qfoHiwXkZv5vT67lnGCqIG5dmdc+hQcbV71lWTBo1qaUaO98Vdcjdi4AoZ6RYB1V5/rOg91EqaGd+KX2Nj8mgzKbErmMOa5SZ+1GeSHt1wiFd7JCjjYet7Ur6U+WK0KJWONXYK3SHFkGlUF5/nQawkLtxB332nD0O1KXlOya3V0iz28/xVlbxEHmWpszYhhXHp+EFnivaSiNJKDWFLrqnCoLj/Q== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230016)(4636009)(376002)(39860400002)(396003)(136003)(346002)(40470700004)(36840700001)(46966006)(6506007)(186003)(8936002)(5660300002)(9686003)(53546011)(478600001)(47076005)(55016003)(40480700001)(336012)(52536014)(356005)(33656002)(966005)(41300700001)(110136005)(7696005)(2906002)(86362001)(19627235002)(40460700003)(70206006)(82310400005)(36860700001)(82740400003)(70586007)(4326008)(8676002)(81166007)(83380400001)(26005)(316002)(54906003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jul 2022 14:29:10.6225 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3931f96-d22f-4fb8-512a-08da65a537db X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT011.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR08MB7704 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 inconsi= stent test failure issue mentioned in https://bugzilla.tianocore.org/show_b= ug.cgi?id=3D3601 Reviewed-by: Sunny Wang -----Original Message----- From: Dimitrije Pavlov Sent: 28 June 2022 19:48 To: devel@edk2.groups.io Cc: Ard Biesheuvel ; Jiewen Yao ; Jordan Justen ; Gerd Hoffmann ; Jeff Booher-Kaeding ; Samer El-Haj-= Mahmoud ; Sunny Wang ; Je= remy Linton 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 Cc: Jiewen Yao Cc: Jordan Justen Cc: Gerd Hoffmann Cc: Jeff Booher-Kaeding Cc: Samer El-Haj-Mahmoud Cc: Sunny Wang Cc: Jeremy Linton Signed-off-by: Dimitrije Pavlov --- 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 =3D 0; } else if (ModeData->ColorDepth =3D=3D 32) { DEBUG ((DEBUG_INFO, "PixelBlueGreenRedReserved8BitPerColor\n")); - Info->PixelFormat =3D PixelBlueGreenRedReserved8BitPerColor; + Info->PixelFormat =3D PixelBlueGreenRedReserved8BitP= erColor; + Info->PixelInformation.RedMask =3D 0; + Info->PixelInformation.GreenMask =3D 0; + Info->PixelInformation.BlueMask =3D 0; + Info->PixelInformation.ReservedMask =3D 0; + } else { + DEBUG ((DEBUG_ERROR, "%a: Invalid ColorDepth %u", __FUNCTION__, ModeDa= ta->ColorDepth)); + ASSERT (FALSE); } Info->PixelsPerScanLine =3D Info->HorizontalResolution; -- 2.34.1 IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease 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.