From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa7.dell-outbound.iphmx.com (esa7.dell-outbound.iphmx.com [68.232.153.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E16A521A04820 for ; Mon, 24 Apr 2017 05:46:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dell.com; i=@dell.com; q=dns/txt; s=smtpout; t=1493037385; x=1524573385; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=8nlJdBf6SPZgZWwCb3wyHxzhb5SfvKRsa/JgPHqmHNg=; b=aY7R0iJ8Oiplw7PLAYPgUIAqWMczRKnrPyU/DuJ7jlCAVuclPAi3/Zj6 vXRGqUClJPoVgjcOjZC8MYART5ersXaBDq9jpMJ5SmvGBVJ9tu/Pptaed w4xqpdsIwbUgNA9oEdWkmcjrJOh9ZAyDNi+B59TqF5qGvNzOJGYOc1Hjo g=; Received: from esa1.dell-outbound2.iphmx.com ([68.232.153.201]) by esa7.dell-outbound.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Apr 2017 07:36:25 -0500 From: Received: from ausxipps310.us.dell.com ([143.166.148.211]) by esa1.dell-outbound2.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Apr 2017 18:39:26 +0600 X-LoopCount0: from 10.175.216.251 X-IronPort-AV: E=Sophos;i="5.37,244,1488866400"; d="scan'208";a="9406856" To: CC: , Thread-Topic: [edk2] Possible UEFI Shell DrvDiag Command Error Thread-Index: AdK8+L4RxkWlrnwTTPKSLk6x8xvGkA== Date: Mon, 24 Apr 2017 12:46:22 +0000 Message-ID: <2c5b3c022bb94ed9bcdbc7e1f2d9c791@ausx13mps339.AMER.DELL.COM> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titusconfig: No Restrictions 04051212 x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvIiwiaWQiOiI3ZGU4NDdjNC04MmU3LTRmZmItOGIyMy0yM2EwYTBjODNmYWQiLCJwcm9wcyI6W3sibiI6IkNsYXNzaWZpY2F0aW9uIiwidmFscyI6W3sidmFsdWUiOiJObyBSZXN0cmljdGlvbnMifV19LHsibiI6IlN1YmxhYmVscyIsInZhbHMiOltdfSx7Im4iOiJFeHRlcm5hbENvcnJlc3BvbmRlbmNlIiwidmFscyI6W119XX0sIlN1YmplY3RMYWJlbHMiOltdLCJUTUNWZXJzaW9uIjoiMTYuMi4xMS4wIiwiVHJ1c3RlZExhYmVsSGFzaCI6IlBcL1owSFI5YjMreHhHcUdLMGJYeElwK0ljTklGXC9MSU5lZitMcGlDUnZGWT0ifQ== x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.210.125.233] MIME-Version: 1.0 Subject: Possible UEFI Shell DrvDiag Command Error X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 12:46:26 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Although this question is about the shell's drvdiag command, the answer is related to the interpretation of the UEFI specification with respect to the diagnostics protocol's RunDiagnostics() function. Ultimately, the question is, is the drvdiag command in error in trying to free the ErrorType pointer, or is a driver vendor in error when they return an ErrorType parameter that does not point to memory that was allocated using gBS->AllocatePool? The diagnostics protocol's RunDiagnostics() function is partially described in the UEFI spec like this: typedef EFI_STATUS (EFIAPI *EFI_DRIVER_DIAGNOSTICS2_RUN_DIAGNOSTICS) ( IN EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *This, ... OUT EFI_GUID **ErrorType, OUT UINTN *BufferSize, OUT CHAR16 **Buffer ); ... ErrorType A GUID that defines the format of the data returned in Buffer. BufferSize The size, in bytes, of the data returned in Buffer. Buffer A buffer that contains a Null-terminated string plus some additional data whose format is defined by ErrorType. Buffer is allocated by this function with EFI_BOOT_SERVICES.AllocatePool(), and it is the caller's responsibility to free it with a call to EFI_BOOT_SERVICES.FreePool(). After a call to RunDiagnostics, the drvdiag command attempts to free the ErrorType pointer if it is non-NULL, yet nothing in the UEFI spec says that this is proper. 123456789012345678901234567890123456789012345678901234567890123456789012 The UEFI spec goes to great length to point out that *Buffer* must be allocated by the callee using gBS->AllocatePool and that the caller must use gBS->FreePool to release the memory once it is no longer needed. However, there is no such language with respect to ErrorType. So, repeating the question, is the drvdiag command in error in trying to free the ErrorType pointer, or is a driver vendor in error when they return an ErrorType parameter that does not point to memory that was allocated using gBS->AllocatePool? Regards, Jim