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=kYQsoooT; spf=pass (domain: arm.com, ip: 40.107.4.69, mailfrom: krzysztof.koch@arm.com) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (EUR03-DB5-obe.outbound.protection.outlook.com [40.107.4.69]) by groups.io with SMTP; Fri, 16 Aug 2019 03:25:32 -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=YFP3qCKpC5z06AentarNPE3l8Vm+I4OvGTAdtSPNqRs=; b=kYQsoooTO9y56mxgtjo+v3YnbURfjoxhXBQm0nVRw5y8CH99kPQVVZp2ptC/xOjsJ51xJ8RoVgihrTTVlmHtZ06wT2qPafoRazqtc5m3lbnwYX59j3mSGRO+WLo28IRxod38B+1zCke5HfDiuUxJg38TKjoZUy1LphBYfbK4CEU= Received: from AM6PR08CA0033.eurprd08.prod.outlook.com (2603:10a6:20b:c0::21) by HE1PR0802MB2602.eurprd08.prod.outlook.com (2603:10a6:3:e2::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.16; Fri, 16 Aug 2019 10:25:28 +0000 Received: from VE1EUR03FT038.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::204) by AM6PR08CA0033.outlook.office365.com (2603:10a6:20b:c0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2178.16 via Frontend Transport; Fri, 16 Aug 2019 10:25:27 +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 VE1EUR03FT038.mail.protection.outlook.com (10.152.19.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2178.16 via Frontend Transport; Fri, 16 Aug 2019 10:25:26 +0000 Received: ("Tessian outbound 40a263b748b4:v26"); Fri, 16 Aug 2019 10:25:24 +0000 X-CR-MTA-TID: 64aa7808 Received: from d339a44bd754.1 (cr-mta-lb-1.cr-mta-net [104.47.4.58]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id B2BE969D-B2E8-445E-94B3-C0FD41036B98.1; Fri, 16 Aug 2019 10:25:19 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-am5eur02lp2058.outbound.protection.outlook.com [104.47.4.58]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d339a44bd754.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Fri, 16 Aug 2019 10:25:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fUaJRhrXt7UBQxRaPwLTNf2ULfu97NQsHfkB+hUDHtBR94E+9wLcn0BY1nwqMr9ZmJU5nyl/YtFpq1QRgWmjaiz6W7BOJVOy5wSWCSJ8CLD4nBruQxSIuUIRou8nSgXPehbdT5H9xBKsXEo5ojOzFTtNBD1HEj6igmG4FmPonZVVDxQv7gYL6SdSUrQwWhrECxKnnXMQV2HrVkNqEHEOmzRKKgRFCFs6DAApRDFNZypcbi/rLsVGngmgD2ZxJ1uLSecu6nq9AD7Qe2KGE++vXNIxOOnz+qgrXFS7jazdz/MdULaEjjX+JPQ14qPaJ7+usZ+qikdkEW36M+FqjvT+TQ== 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=YFP3qCKpC5z06AentarNPE3l8Vm+I4OvGTAdtSPNqRs=; b=gRLqOUr9y+lYTV99b+RY/uBnt1p4YOrCnaJQPsDt/gguHnwZOQTIaouVXZfeV5Pfq+fE6/BO4LHxQgqZ4l+xJBLQVo7tbCRu39E+wjkQQLgm+PmJ9ljs9lC1mOq3x6Vfg+3fHYATC9v/8bh4D/DWSjdhye0FdT8LdmeBgtrT3siY49oRQT1i6Hc/oXAGyZ6lxSb9DqbNTsV+JrlNexsvH+3DqC7yY5gHelDb0tn15lAXxo6a0CxJ8ZdfFA8bBa9OezNYZiXKMKIRs6MX0hzbHi+fjQdVA55wJYDsSEyq1YXhZXQ8ayZWRTTHPNRnpRO+z/aHzNfQ/g1yRLTtMYCd7A== 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=YFP3qCKpC5z06AentarNPE3l8Vm+I4OvGTAdtSPNqRs=; b=kYQsoooTO9y56mxgtjo+v3YnbURfjoxhXBQm0nVRw5y8CH99kPQVVZp2ptC/xOjsJ51xJ8RoVgihrTTVlmHtZ06wT2qPafoRazqtc5m3lbnwYX59j3mSGRO+WLo28IRxod38B+1zCke5HfDiuUxJg38TKjoZUy1LphBYfbK4CEU= Received: from VE1PR08MB4783.eurprd08.prod.outlook.com (10.255.114.16) by VE1PR08MB5024.eurprd08.prod.outlook.com (10.255.159.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2157.18; Fri, 16 Aug 2019 10:25:16 +0000 Received: from VE1PR08MB4783.eurprd08.prod.outlook.com ([fe80::c0c1:9dbc:4681:6b5c]) by VE1PR08MB4783.eurprd08.prod.outlook.com ([fe80::c0c1:9dbc:4681:6b5c%7]) with mapi id 15.20.2178.016; Fri, 16 Aug 2019 10:25:16 +0000 From: "Krzysztof Koch" To: "Gao, Zhichao" , "devel@edk2.groups.io" CC: "Carsey, Jaben" , "Ni, Ray" , Sami Mujawar , Matteo Carlini , nd Subject: Re: [PATCH v1 03/11] ShellPkg: acpiview: FADT: Validate global pointer before use Thread-Topic: [PATCH v1 03/11] ShellPkg: acpiview: FADT: Validate global pointer before use Thread-Index: AQHVU2sLq1shhzTWPU6bIns9p4W1aKb9YYCQgAAwZaA= Date: Fri, 16 Aug 2019 10:25:16 +0000 Message-ID: References: <20190815131121.52644-1-krzysztof.koch@arm.com> <20190815131121.52644-4-krzysztof.koch@arm.com> <3CE959C139B4C44DBEA1810E3AA6F9000B823290@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <3CE959C139B4C44DBEA1810E3AA6F9000B823290@SHSMSX101.ccr.corp.intel.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: eb02f3ce-ec25-4577-b4b0-109b04eddec5.1 x-checkrecipientchecked: true Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Krzysztof.Koch@arm.com; x-originating-ip: [217.140.106.49] x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: 0adddc20-3feb-4500-ae47-08d722340dfb 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:VE1PR08MB5024; X-MS-TrafficTypeDiagnostic: VE1PR08MB5024:|HE1PR0802MB2602: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:6430;OLM:6430; x-forefront-prvs: 0131D22242 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM;SFS:(10009020)(4636009)(376002)(39860400002)(396003)(346002)(136003)(366004)(199004)(13464003)(189003)(7736002)(99286004)(52536014)(110136005)(3846002)(2501003)(102836004)(74316002)(186003)(33656002)(15650500001)(7696005)(6506007)(9686003)(305945005)(53546011)(446003)(11346002)(14454004)(26005)(76176011)(66066001)(486006)(316002)(229853002)(256004)(8676002)(25786009)(5660300002)(81166006)(14444005)(478600001)(476003)(6246003)(81156014)(54906003)(71190400001)(71200400001)(55016002)(66446008)(66476007)(6436002)(66946007)(66556008)(76116006)(64756008)(4326008)(8936002)(53936002)(86362001)(2906002)(6116002);DIR:OUT;SFP:1101;SCL:1;SRVR:VE1PR08MB5024;H:VE1PR08MB4783.eurprd08.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX: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: e6q0reM6/LwzGIR1PLgNKrVk+lLfHb5pJFuR2DmTL1JcOtI1m1qMPfFJKIzm9XHVdrU026nb9NOeAg3JgaOcOpmwJMJNmBPGMPsq7q9M5ETfvohvJ7DNQW0PLvzrnOagiA+hwTqj7T3F8sKP+Ie3oqozALFGsp/U4T9pAkKWtJmvWkDSUAiGGTGIOQZu/07d1Cw8DEPqHHPEtzpcg6geTN1zHZP98uNRU/TNiHB3wu9QF2NgtMuQSrztokfj0W1xtBkfM+z99DX27fUpOYYktl9ad0IDo5BbCCkz31FFONF5pRwDASo9GnYXYLQRaoOMr6iRoqsZkxanejX1peBvoot5Jo1AjWK/yiPz5JNS8urhMin5YFNoGgv0rc9PHdh1j4lpZ7X6n60K+VwWH2obkdIbl3RVJE4firGI5U8M3Uk= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5024 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Krzysztof.Koch@arm.com; Return-Path: Krzysztof.Koch@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT038.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)(346002)(376002)(39860400002)(396003)(2980300002)(13464003)(199004)(189003)(8746002)(81156014)(8936002)(8676002)(50466002)(229853002)(5660300002)(81166006)(26005)(46406003)(14454004)(110136005)(336012)(99286004)(478600001)(53546011)(33656002)(6506007)(102836004)(26826003)(7696005)(52536014)(86362001)(54906003)(76176011)(446003)(63370400001)(63350400001)(486006)(126002)(476003)(11346002)(316002)(22756006)(2501003)(15650500001)(3846002)(23726003)(4326008)(14444005)(25786009)(6116002)(74316002)(186003)(305945005)(9686003)(70586007)(6246003)(70206006)(55016002)(47776003)(356004)(7736002)(66066001)(2906002)(76130400001)(97756001)(36906005);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR0802MB2602;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: ec98f11b-c475-472e-3f21-08d72234080b X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(710020)(711020)(4605104)(1401327)(2017052603328)(7193020);SRVR:HE1PR0802MB2602; NoDisclaimer: True X-Forefront-PRVS: 0131D22242 X-Microsoft-Antispam-Message-Info: Xj04BD2XHu2DHYYYHnSYpaj4uQcz+fFRldCaypZx875FhKjSVv+unCYaVn1xublbh0F0gKXRxMmSDi1cGLrvYE+/8Qt0uxGQOCQxyK2SsBbdIQsFVEaV5dddFu64wRC5X5iyro/yfvaSgWZ0M2mH7aqLQv15j5Tg+gJYaV1iLpEvP+XAyd8Vfs/Ue1DsSwXLmGpaIzFP0lnoaEWqnZReCM3A6zS6AHjdBlFUZZOnGDuYgVwDrVLEaNrZqv/cH6kHBG+wemtKmQ1WI0JS8GowhYfMNpAag3FuPtn8pbMz+APsSvNGc4GQmJ7WZnE20VVeGb6wvhJgY9vSWKkcqPO3ve4P4I6pxc+tmUh5nbKWo/AZ9JlX8JvcZjhP0ZK5M8sH010b+qPqxmeGeWE+NnsrrOPBEkBSUvDT1OLLlUmj1zM= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2019 10:25:26.3195 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0adddc20-3feb-4500-ae47-08d722340dfb 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: HE1PR0802MB2602 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Zhichao, I think you're right. I will submit a v2 patch that minimizes the amount of= pointer validation required for parsing the remaining tables. Kind regards, Krzysztof -----Original Message----- From: Gao, Zhichao =20 Sent: Friday, August 16, 2019 8:35 To: Krzysztof Koch ; devel@edk2.groups.io Cc: Carsey, Jaben ; Ni, Ray ; Sam= i Mujawar ; Matteo Carlini ; = nd Subject: RE: [PATCH v1 03/11] ShellPkg: acpiview: FADT: Validate global poi= nter before use For FadtMinorRevision and X_DsdtAddress, I don't think they are required se= ction. Maybe we should consider check the length before check them. As I kn= ow, the OVMF's FACP table doesn't have the section after flag. Thanks, Zhichao > -----Original Message----- > From: Krzysztof Koch [mailto:krzysztof.koch@arm.com] > Sent: Thursday, August 15, 2019 9:11 PM > To: devel@edk2.groups.io > Cc: Carsey, Jaben ; Ni, Ray=20 > ; Gao, Zhichao ;=20 > Sami.Mujawar@arm.com; Matteo.Carlini@arm.com; nd@arm.com > Subject: [PATCH v1 03/11] ShellPkg: acpiview: FADT: Validate global=20 > pointer before use >=20 > Check if global pointers have been successfully updated before they=20 > are used for further table parsing. >=20 > Signed-off-by: Krzysztof Koch > --- >=20 > Notes: > v1: > - Test against NULL pointers [Krzysztof] >=20 > =20 > ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c > | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) >=20 > diff --git > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser. > c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser. > c > index > e40c9ef8ee4b3285faf8c6edf3cb6236ee367397..e218e45926abced1096e75441 > e22108db7a3a811 100644 > --- > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser. > c > +++ > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtPars > +++ er.c > @@ -203,6 +203,20 @@ ParseAcpiFadt ( > PARSER_PARAMS (FadtParser) > ); >=20 > + // Check if the values used to control the parsing logic have been=20 > + // successfully read. > + if ((DsdtAddress =3D=3D NULL) || > + (FadtMinorRevision =3D=3D NULL) || > + (X_DsdtAddress =3D=3D NULL)) { > + IncrementErrorCount (); > + Print ( > + L"ERROR: Insufficient table length. AcpiTableLength =3D %d. " \ > + L"FADT parsing aborted.\n", > + AcpiTableLength > + ); > + return; > + } > + > if (Trace) { > Print (L"\nSummary:\n"); > PrintFieldName (2, L"FADT Version"); > -- > 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' >=20