From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa5.dell-outbound.iphmx.com (esa5.dell-outbound.iphmx.com [68.232.153.95]) (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 2CC9181F06 for ; Fri, 17 Feb 2017 10:15:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dell.com; i=@dell.com; q=dns/txt; s=smtpout; t=1487355061; x=1518891061; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=2p9sXygK87T7cUv3GAjqMd9cBPer1tz7ERj3Kbkc8Wg=; b=uoNbnn2dTwLfhjc+ienCr403q8XgXdsr7B42iABDmC+m0+bGp7LSCRSZ BhCgMquuRVKOt8bqRZV0jn8879bWLff1UYynkXW4mZNOgE+MME40lWBIn CZiyjSbkgczkAsR3h38D1F8BoF8Es98tp1YsCwF/ZQmot7h6tdktN127O w=; Received: from esa2.dell-outbound2.iphmx.com ([68.232.153.202]) by esa5.dell-outbound.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Feb 2017 12:11:01 -0600 From: Received: from ausxipps306.us.dell.com ([143.166.148.156]) by esa2.dell-outbound2.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Feb 2017 00:05:42 +0600 X-LoopCount0: from 10.175.216.249 X-IronPort-AV: E=Sophos;i="5.35,172,1484028000"; d="scan'208";a="74217165" To: CC: , , Thread-Topic: [edk2] [PATCH] ShellPkg/HandleParsingLib: Correct format specifier for LoadedImage Thread-Index: AQHShwz6TQunOBWyxEGGLjjxZm7yh6FpnqeAgAABMwCAAW/5AIAC5UwA//+CfUCAAAGecIAABVyTgAAFezA= Date: Fri, 17 Feb 2017 18:12:45 +0000 Message-ID: References: <62a8491631d9dbde89d160ab213d3a16a2e76534.1487107403.git.jeff.westfahl@ni.com> <66fef1ec77c84e188120b733da3d00a9@ausx13mps335.AMER.DELL.COM> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titusconfig: Internal Use 04051212 x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvIiwiaWQiOiJlZDA5YWI1YS1iZjUxLTQ2OTMtYTA2Zi04ODNlMGNmNWViN2EiLCJwcm9wcyI6W3sibiI6IkNsYXNzaWZpY2F0aW9uIiwidmFscyI6W3sidmFsdWUiOiJJbnRlcm5hbCBVc2UifV19LHsibiI6IlN1YmxhYmVscyIsInZhbHMiOltdfSx7Im4iOiJFeHRlcm5hbENvcnJlc3BvbmRlbmNlIiwidmFscyI6W3sidmFsdWUiOiJObyJ9XX1dfSwiU3ViamVjdExhYmVscyI6W10sIlRNQ1ZlcnNpb24iOiIxNi4yLjExLjAiLCJUcnVzdGVkTGFiZWxIYXNoIjoiQzNuaEl0OTgzMVp0UEpcLzR5VTJOeThiQjczQSswcWxhTFdNZE5BdEZ5VFE9In0= x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.210.125.233] MIME-Version: 1.0 Subject: Re: [PATCH] ShellPkg/HandleParsingLib: Correct format specifier for LoadedImage X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2017 18:15:31 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Dell - Internal Use - Confidential =20 Thanks, Jeff. I wasn't thinking that through properly. Printing the address and size seems ok. Then one could use dmem, for example, to dump the actual data. -----Original Message----- From: Jeff Westfahl [mailto:jeff.westfahl@ni.com]=20 Sent: Friday, February 17, 2017 11:44 AM To: Carsey, Jaben Cc: Dailey, Jim ; Ni, Ruiyu ; edk2= -devel@lists.01.org; jeff.westfahl@ni.com Subject: RE: [edk2] [PATCH] ShellPkg/HandleParsingLib: Correct format speci= fier for LoadedImage Using "%s" tries to print the data as text, but crashes if the pointer=20 to that data is garbage. Using "%x" just prints the value of the pointer,=20 whether it's valid or not. It doesn't print any of the actual data. On Fri, 17 Feb 2017, Carsey, Jaben wrote: > I think that the long term solution may improve upon this one, but if the= data is hex, then printing in hex at all would seem to be the logical firs= t step. > >> -----Original Message----- >> From: Jim.Dailey@dell.com [mailto:Jim.Dailey@dell.com] >> Sent: Friday, February 17, 2017 9:36 AM >> To: Carsey, Jaben >> Cc: Ni, Ruiyu ; edk2-devel@lists.01.org; >> jeff.westfahl@ni.com >> Subject: RE: [edk2] [PATCH] ShellPkg/HandleParsingLib: Correct format >> specifier for LoadedImage >> Importance: High >> >> My point was that printing one byte of the data as hex is not much bette= r (as >> far >> as avoiding the crash is concerned) than simply not printing the data at= all. If >> we are just trying to avoid the crash, printing nothing is even simpler. >> >> If the correct representation is hex bytes, fine; but why print only 1 o= f them >> and not all of them? >> >> >> -----Original Message----- >> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of >> Carsey, Jaben >> Sent: Friday, February 17, 2017 11:28 AM >> To: Jeff Westfahl >> Cc: Ni, Ruiyu ; Carsey, Jaben >> ; edk2-devel@lists.01.org >> Subject: Re: [edk2] [PATCH] ShellPkg/HandleParsingLib: Correct format >> specifier for LoadedImage >> >> I was reading the email. I was also waiting and making sure there was >> consensus since I didn't have a strong opinion. I will let Ray check al= so, but I >> think the fix is good. >> >> Reviewed-by: Jaben Carsey >> >>> -----Original Message----- >>> From: Jeff Westfahl [mailto:jeff.westfahl@ni.com] >>> Sent: Friday, February 17, 2017 8:55 AM >>> To: Jeff Westfahl >>> Cc: edk2-devel@lists.01.org; Carsey, Jaben ; Ni= , >>> Ruiyu >>> Subject: Re: [edk2] [PATCH] ShellPkg/HandleParsingLib: Correct format >>> specifier for LoadedImage >>> Importance: High >>> >>> Jaben, Ruiyu, >>> >>> Sorry, I forgot to cc you as the ShellPkg maintainers when I submitted >>> this patch. >>> >>> Regards, >>> Jeff Westfahl >>> >>> On Wed, 15 Feb 2017, Jeff Westfahl wrote: >>> >>>> Jim, >>>> >>>> I agree that those are good ideas. However, such an implementation >> would >>>> still crash on a BIOS built against the EDK II before commit 891d844. = I think >>>> it might be best to resolve the crash with the simple patch I have mad= e, >>> and >>>> defer your suggestions for now. >>>> >>>> Regards, >>>> Jeff >>>> >>>> On Tue, 14 Feb 2017, Jim.Dailey@dell.com wrote: >>>> >>>>> Please disregard the earlier "Confidential" text. The stupid plug-in = that >>>>> adds this >>>>> does not show the text in the mail when it is composed in text mode, = so >> I >>>>> often >>>>> forget to turn this "feature" off when posting. Sorry. >>>>> >>>>> -----Original Message----- >>>>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf >> Of >>>>> Dailey, Jim >>>>> Sent: Tuesday, February 14, 2017 4:40 PM >>>>> To: jeff.westfahl@ni.com; edk2-devel@lists.01.org >>>>> Subject: Re: [edk2] [PATCH] ShellPkg/HandleParsingLib: Correct format >>>>> specifier for LoadedImage >>>>> >>>>> Jeff, >>>>> >>>>> Perhaps a better approach is to print *all* the LoadOptions data as h= ex >>>>> bytes? >>>>> >>>>> In addition, one might first analyze the LoadOptions data, and, when >>>>> apropos, >>>>> print obvious strings as strings? >>>>> >>>>> Regards, >>>>> Jim >>>>> >>>>> -----Original Message----- >>>>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf >> Of >>> Jeff >>>>> Westfahl >>>>> Sent: Tuesday, February 14, 2017 3:54 PM >>>>> To: edk2-devel@lists.01.org >>>>> Subject: [edk2] [PATCH] ShellPkg/HandleParsingLib: Correct format >>> specifier >>>>> for LoadedImage >>>>> >>>>> The format specifier for the LoadOptions field of the LoadedImage >>> protocol >>>>> is "%s". However, the data in LoadOptions is often generic binary dat= a. A >>>>> format specifier of "%x" is more appropriate for this field. >>>>> >>>>> Using "dh -v" with format specifier "%s" on BIOS images based on EDK = II >>>>> source before commit 891d844 can cause a crash. >>>>> >>>>> Contributed-under: TianoCore Contribution Agreement 1.0 >>>>> Signed-off-by: Jeff Westfahl >>>>> --- >>>>> ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni | 2 +- >>>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>>> >>>>> diff --git >>> a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni >>>>> b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni >>>>> index 0d51627c5f..273a4201bc 100644 >>>>> --- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni >>>>> +++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.uni >>>>> @@ -354,7 +354,7 @@ >>>>> " DeviceHandle.= .: >>>>> %%H%x%%N\r\n" >>>>> " FilePath.....= .: >>>>> %%H%x%%N\r\n" >>>>> " OptionsSize..= .: >>>>> %%H%x%%N\r\n" >>>>> - " LoadOptions.= ..: >>>>> %%H%s%%N\r\n" >>>>> + " LoadOptions.= ..: >>>>> %%H%x%%N\r\n" >>>>> " ImageBase....= .: >>>>> %%H%x%%N\r\n" >>>>> " ImageSize....= .: >>>>> %%H%Lx%%N\r\n" >>>>> " CodeType.....= .: >>>>> %%H%s%%N\r\n" >>>>> -- >>>>> 2.11.0.windows.3 >>>>> >>>>> _______________________________________________ >>>>> edk2-devel mailing list >>>>> edk2-devel@lists.01.org >>>>> https://lists.01.org/mailman/listinfo/edk2-devel >>>>> _______________________________________________ >>>>> edk2-devel mailing list >>>>> edk2-devel@lists.01.org >>>>> https://lists.01.org/mailman/listinfo/edk2-devel >>>>> >>>> _______________________________________________ >>>> edk2-devel mailing list >>>> edk2-devel@lists.01.org >>>> https://lists.01.org/mailman/listinfo/edk2-devel >>>> >> _______________________________________________ >> edk2-devel mailing list >> edk2-devel@lists.01.org >> https://lists.01.org/mailman/listinfo/edk2-devel >