From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=ES0KvzEy; spf=pass (domain: arm.com, ip: 40.107.4.51, mailfrom: sami.mujawar@arm.com) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (EUR03-DB5-obe.outbound.protection.outlook.com [40.107.4.51]) by groups.io with SMTP; Tue, 20 Aug 2019 02:49:46 -0700 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=5JbvF0VCWqIZj6D6sVI0h1t4YOjcPYijgj6lwYhDogo=; b=ES0KvzEyTA1GEsuOUDTRxIo4e74wBLD/Nk7DWJDhKR7ni5eB+lIGr4K8LLB8YKskf2/KptwtEsvhckHBsgd/LcUQkkwTcCMpQ5aVZWwh71CQeHJxDlFZ6K3XwfZ8BHfJ+yxBnrCqOTpU4PrbHayijfQ+Q5/xO4kxyicWGsOMNQI= Received: from DB6PR0802CA0044.eurprd08.prod.outlook.com (2603:10a6:4:a3::30) by VE1PR08MB4958.eurprd08.prod.outlook.com (2603:10a6:803:110::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2157.16; Tue, 20 Aug 2019 09:49:41 +0000 Received: from VE1EUR03FT004.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::208) by DB6PR0802CA0044.outlook.office365.com (2603:10a6:4:a3::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.16 via Frontend Transport; Tue, 20 Aug 2019 09:49:41 +0000 Authentication-Results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=temperror action=none header.from=arm.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT004.mail.protection.outlook.com (10.152.18.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.16 via Frontend Transport; Tue, 20 Aug 2019 09:49:39 +0000 Received: ("Tessian outbound 40a263b748b4:v26"); Tue, 20 Aug 2019 09:49:38 +0000 X-CR-MTA-TID: 64aa7808 Received: from 7e60655995b8.3 (cr-mta-lb-1.cr-mta-net [104.47.2.51]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 813E6DA0-6EE8-4019-B83E-6F75F8612560.1; Tue, 20 Aug 2019 09:49:33 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01lp2051.outbound.protection.outlook.com [104.47.2.51]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 7e60655995b8.3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Tue, 20 Aug 2019 09:49:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SYiUhtzbCTptSw9CBSgiFpRCsoyYlEk4YH4h2qW8eqM3S1LOWLbZnxcbYr0LB5Wl24x9qbDiit1ehX6wHY3CLan5M2RxjSyKFBsKDCnOd0hEHKJcC56u8dipidXjYcmDaO5MXnftqb1YZ4Gd/E+mqOcgzimDlR2PbbfF092WIkndczfFhFZXcljitFUZGs3e6LUFG0Q4JpX0GnYwYjpFqQvU6+V7R1/6jOYvKZF0sHyc4R4g751pPk9/V+BNjUVeT92OGzfc64ECMhX95D/LQ1GV5Dz9iVNmvfxEF1TYD0vYNnBE8ichRNd9rGBPNiydgF2ACXwhouxCBPuZIhZRkg== 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-SenderADCheck; bh=5JbvF0VCWqIZj6D6sVI0h1t4YOjcPYijgj6lwYhDogo=; b=lS2wuRpyc8EHRMg35oaxjB75Q6+OyyEnKB0Dz0IZFrDnn/MJDb8JRueWrd3Yn3gA4RkoaqWEOIr/4NhNdlwfVwbqIQF0JAHRiO3a+/Yu9LGa4k0dxgx0HzT8QGkRKMqkEy2KgMl6TsJJqvqrc6e0fuSw4zBDjlppBLUiSmGdFMFaskhIueSTQAeLBNClw28ZKIvq+xLTyyewjHLktD2q0/U4VQ6nSqPhRe3HdaDu4b887m8Hs9/ybzaGlcwx6g7bM3lufy1vYt3TkHTMfAUYXlkMS6Yyus29ZdOmfNB38MQgHVIKlUUtsUtD7DynhzELuYYdEDa0LXanYk5ITvI4uQ== 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=5JbvF0VCWqIZj6D6sVI0h1t4YOjcPYijgj6lwYhDogo=; b=ES0KvzEyTA1GEsuOUDTRxIo4e74wBLD/Nk7DWJDhKR7ni5eB+lIGr4K8LLB8YKskf2/KptwtEsvhckHBsgd/LcUQkkwTcCMpQ5aVZWwh71CQeHJxDlFZ6K3XwfZ8BHfJ+yxBnrCqOTpU4PrbHayijfQ+Q5/xO4kxyicWGsOMNQI= Received: from DB6PR0802MB2375.eurprd08.prod.outlook.com (10.172.228.142) by DB6PR0802MB2264.eurprd08.prod.outlook.com (10.172.227.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.18; Tue, 20 Aug 2019 09:49:29 +0000 Received: from DB6PR0802MB2375.eurprd08.prod.outlook.com ([fe80::88a4:74c4:c4b7:aa1a]) by DB6PR0802MB2375.eurprd08.prod.outlook.com ([fe80::88a4:74c4:c4b7:aa1a%5]) with mapi id 15.20.2178.018; Tue, 20 Aug 2019 09:49:29 +0000 From: "Sami Mujawar" To: Krzysztof Koch , "devel@edk2.groups.io" CC: "jaben.carsey@intel.com" , "ray.ni@intel.com" , "zhichao.gao@intel.com" , Matteo Carlini , nd Subject: Re: [PATCH v2 03/11] ShellPkg: acpiview: FADT: Validate global pointer before use Thread-Topic: [PATCH v2 03/11] ShellPkg: acpiview: FADT: Validate global pointer before use Thread-Index: AQHVVme0gzhnt6MxxEKDTJtXmsZMWKcDy/3A Date: Tue, 20 Aug 2019 09:49:29 +0000 Message-ID: References: <20190819082514.30936-1-krzysztof.koch@arm.com> In-Reply-To: <20190819082514.30936-1-krzysztof.koch@arm.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 3dd633c3-e548-41a0-a7ea-f8084ad16fb1.1 x-checkrecipientchecked: true Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Sami.Mujawar@arm.com; x-originating-ip: [217.140.96.140] x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: bdef9e24-bb5c-4cdb-a977-08d72553b84b X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam-Untrusted: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:DB6PR0802MB2264; X-MS-TrafficTypeDiagnostic: DB6PR0802MB2264:|VE1PR08MB4958: X-MS-Exchange-PUrlCount: 1 x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:6790;OLM:6790; x-forefront-prvs: 013568035E X-Forefront-Antispam-Report-Untrusted: SFV:NSPM;SFS:(10009020)(4636009)(366004)(136003)(39860400002)(376002)(396003)(346002)(189003)(13464003)(199004)(7736002)(74316002)(478600001)(55016002)(6306002)(66556008)(66946007)(76116006)(66476007)(14454004)(71200400001)(71190400001)(305945005)(9686003)(66446008)(64756008)(15650500001)(25786009)(5660300002)(66066001)(7696005)(76176011)(486006)(14444005)(256004)(229853002)(86362001)(11346002)(446003)(3846002)(33656002)(6116002)(52536014)(2501003)(476003)(26005)(186003)(6246003)(53936002)(53546011)(6506007)(54906003)(110136005)(2906002)(8676002)(81156014)(81166006)(966005)(99286004)(316002)(4326008)(6436002)(102836004)(8936002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0802MB2264;H:DB6PR0802MB2375.eurprd08.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info-Original: GvjinLFXoa5h05xLlp+u1pktN4l8SgOV/llIRYPQ2zXmO9XWtEW3wK2G3a+2o73Vq+SO6JU2W2jgBv83lLpx++OvCP2p31E6C4Xyb7r/w4wmSQjLblTLJG8nAOtMsmC+z57pKr+Ce0rZhmvUfSUHP2WTHtCKbse+uCOm3ZrQJnDIKs0w4SVVXAEImiHkEvj4RrvxWMU2MSkomycNj7n/N8+V56FvRLyTQqOzwZVjG2QO7EbFbYGNrRMqaw4ZyU1lm0QmjbP/W+Lx3uEqPTkqVWfNWh5hZkVwgxYJP6fvGxkpl2p7RD9p8Ul5j9X7BBxtVzLQhUmFd0PzsmNWFivzPKRtx9Fa2QMPTVKIlW3aDkxlaV9qvgqfTz7sm21wIxrYX/h8zF6taEveejv72iToEO8qgcUOoHMh0iWwoiMk+wA= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2264 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Sami.Mujawar@arm.com; Return-Path: Sami.Mujawar@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT004.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123;IPV:CAL;SCL:-1;CTRY:IE;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(136003)(39860400002)(346002)(396003)(376002)(2980300002)(199004)(189003)(13464003)(86362001)(33656002)(8746002)(8936002)(26826003)(70206006)(36906005)(97756001)(14454004)(102836004)(26005)(99286004)(52536014)(81156014)(81166006)(54906003)(110136005)(6246003)(2501003)(7696005)(316002)(46406003)(76176011)(4326008)(53546011)(76130400001)(66066001)(6506007)(47776003)(2906002)(7736002)(305945005)(6306002)(9686003)(55016002)(15650500001)(356004)(23726003)(6116002)(229853002)(3846002)(5660300002)(50466002)(25786009)(478600001)(8676002)(336012)(126002)(70586007)(22756006)(63370400001)(63350400001)(74316002)(446003)(476003)(11346002)(186003)(966005)(14444005)(486006);DIR:OUT;SFP:1101;SCL:1;SRVR:VE1PR08MB4958;H:64aa7808-outbound-1.mta.getcheckrecipient.com;FPR:;SPF:TempError;LANG:en;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;A:1;MX:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 2fc88633-64fe-4e12-52aa-08d72553b1e4 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600148)(710020)(711020)(4605104)(1401327)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020);SRVR:VE1PR08MB4958; NoDisclaimer: True X-Forefront-PRVS: 013568035E X-Microsoft-Antispam-Message-Info: dCAa1lxgsgz2ZiRXkEqwcqLgMQNyUF0HzOkDomdmBsNbUcuRL/uUyEugYdT9RRlsykg2eO2W6YkYPDeP9zrvdGPtpk4WBvIuMXCW8jk9EydvSlDWPT8zw3vt5rdBs57TycD5XBLQlYn5XjNV29PQU8f91sXys0nRGJ7IQwrpGOYET/DZxx9KuWGt8e2f0JsQp15ZdYdTGU+3WwpM5nrx03bcZ4fnRyHWV2EOcsH4ya7GLm+TV+UHi4b1NrVZ7E2g25CfRItRFgFjnq3r1avXd/MprIu0mehy6JK38z4s4Q8R6+CN+vjT2l9qA5y7B6VlTdgvj8I3+7guYF6iHkJYT8K8oWBf2WBiJWS1+MC2Xk9d/ksnHwmcMLTFlvW0Nt/3UhquUfW/K6sTm0K2OFNKnaDyr+NPYWD6wD9uXG8Yxi4= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2019 09:49:39.9383 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bdef9e24-bb5c-4cdb-a977-08d72553b84b 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-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4958 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Sami Mujawar Regards, Sami Mujawar -----Original Message----- From: Krzysztof Koch =20 Sent: 19 August 2019 09:25 AM To: devel@edk2.groups.io Cc: jaben.carsey@intel.com; ray.ni@intel.com; zhichao.gao@intel.com; Sami M= ujawar ; Matteo Carlini ; nd = Subject: [PATCH v2 03/11] ShellPkg: acpiview: FADT: Validate global pointer= before use Check if global pointers have been successfully updated before they are use= d for further table parsing. Signed-off-by: Krzysztof Koch --- Changes can be seen at: https://github.com/KrzysztofKoch1/edk2/tree/612_add= _pointer_validation_v2 Notes: v1: - Test against NULL pointers [Krzysztof] v2: - Do not require FadtMinorRevision and X_DsdtAddress pointers to be valid in order to process the remaining ACPI tables [Zhichao] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c | 1= 9 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/Fadt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtPa= rser.c index e40c9ef8ee4b3285faf8c6edf3cb6236ee367397..6859c4824c2866fd3eb9a789a8d= fc950724b27ca 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.= c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtPars +++ er.c @@ -204,9 +204,11 @@ ParseAcpiFadt ( ); =20 if (Trace) { - Print (L"\nSummary:\n"); - PrintFieldName (2, L"FADT Version"); - Print (L"%d.%d\n", *AcpiHdrInfo.Revision, *FadtMinorRevision); + if (FadtMinorRevision !=3D NULL) { + Print (L"\nSummary:\n"); + PrintFieldName (2, L"FADT Version"); + Print (L"%d.%d\n", *AcpiHdrInfo.Revision, *FadtMinorRevision); + } =20 if (*GetAcpiXsdtHeaderInfo ()->OemTableId !=3D *AcpiHdrInfo.OemTableId= ) { IncrementErrorCount (); @@ -214,21 +216,20 @@ ParseAcpiFadt ( } } =20 - // If X_DSDT is not zero then use X_DSDT and ignore DSDT, - // else use DSDT. - if (*X_DsdtAddress !=3D 0) { + // If X_DSDT is valid then use X_DSDT and ignore DSDT, else use DSDT. + if ((X_DsdtAddress !=3D NULL) && (*X_DsdtAddress !=3D 0)) { DsdtPtr =3D (UINT8*)(UINTN)(*X_DsdtAddress); - } else if (*DsdtAddress !=3D 0) { + } else if ((DsdtAddress !=3D NULL) && (*DsdtAddress !=3D 0)) { DsdtPtr =3D (UINT8*)(UINTN)(*DsdtAddress); } else { - // Both DSDT and X_DSDT cannot be zero. + // Both DSDT and X_DSDT cannot be invalid. #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) if (Trace) { // The DSDT Table is mandatory for ARM systems // as the CPU information MUST be presented in // the DSDT. IncrementErrorCount (); - Print (L"ERROR: Both X_DSDT and DSDT are NULL.\n"); + Print (L"ERROR: Both X_DSDT and DSDT are invalid.\n"); } #endif return; -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'