From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id A8D54740034 for ; Fri, 10 Nov 2023 02:06:08 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=cGICgf5zH3blaft5TfMT+/zXzR4yHmuI2A1aw7jrG4I=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:msip_labels:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type; s=20140610; t=1699581967; v=1; b=EROvxefrjbXzOH2PTCHJQC35fpRlj3vFd5qh/z9VhOac9qbhOHSa4U9SUUMwJqa3J3uKyLGk ZZeIvk2VUOAa04STBPqxRE+wNHiI4BRGKgjS7b8j0AnS3ASFzlhygzb2fBfPCUueXzgiJAg2Szd 7/7SHB1DPWwDbDmEjLQu3rZM= X-Received: by 127.0.0.2 with SMTP id HPDkYY7687511x4UaVnuOxG6; Thu, 09 Nov 2023 18:06:07 -0800 X-Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.68]) by mx.groups.io with SMTP id smtpd.web11.19533.1699581966203085839 for ; Thu, 09 Nov 2023 18:06:06 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IGU0Is3Z112fjyM+UwrPYGDcraWS2IbxLZJiebZyaPszeP/MnGbIyu8v3Ickr0WMYh5BGJcoPKYPWyoMlS3r3TPHNVBf7s/9CBJc9PMckxBGtLHnFCz838brs2Romoea9YLpYYuD4/y8RYxU4Y87Cm6HPiHAh3GaPTX37zlvgWkxVpAqtY98Rxutj2yQv0y6xRU4IAlAfB+c+Yf/3erdtc2owRmrg1dM/tqLtMW8SOIqdvNsHvjJkvd5qx8OJ1X4lSAbawhqXIz4DpHeS6LZeZ4Oncw+3PAc8IFWkBPhGjGV+pB/807WAU8aYCRle6l68afcY/sQW6uKKeR0L2LYwQ== 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=iGCJLoJAC4FAwc8kf4ne5XrLAhNKHTqlbEPsavf3yXA=; b=ee090Ce9hILZymZj+k58YzOl0Xgjm1CH8sii/L6CsRT53cMZTgLwvqIG4Q4R5+SNyYAiECZUJgRBfzqUq7jzcRCrD8amTwiLmXfNYEB25X/DlVFCcDDHrHN8GNsLDlsilJ3psnOptg5TP8gAesPZs9D1mTzRsn596I9VVzb7NORuWviQY1ZqxpZwXm8qcCa3F2wAf5caRWfnCHBa3CZ5zig9ks3f34DcfUxZQ/F7Qn7DNNbISTlDJvkVZLJRmYKORPCxt5XubOJmjdqpm3majeX7KmpIMxaI93IvfUrcxczgNHe/4N/ozETmn0MmWtNfFikhW/P4Z+tTEvNf0//yLw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by MN0PR12MB6174.namprd12.prod.outlook.com (2603:10b6:208:3c5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.28; Fri, 10 Nov 2023 02:06:03 +0000 X-Received: from MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::f3b0:4a8d:2c74:f066]) by MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::f3b0:4a8d:2c74:f066%4]) with mapi id 15.20.6977.019; Fri, 10 Nov 2023 02:06:02 +0000 From: "Chang, Abner via groups.io" To: Ashish Singhal , "devel@edk2.groups.io" , "quic_llindhol@quicinc.com" , "ardb+tianocore@kernel.org" , "git@danielschaefer.me" , Jeff Brasen Subject: Re: [edk2-devel] [PATCH 1/2] EmbeddedPkg: Fix Android Boot Command Line Length Bug Thread-Topic: [PATCH 1/2] EmbeddedPkg: Fix Android Boot Command Line Length Bug Thread-Index: AQHaC28qiwa5OI/Ck0+5OYaFWBFm8rBtneCAgAU/dqA= Date: Fri, 10 Nov 2023 02:06:02 +0000 Message-ID: References: <999da9572bc2ff0bbb8d7a69740256afd6ad5cde.1698697168.git.ashishsingha@nvidia.com> In-Reply-To: Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=a6b136b9-740f-47e0-ac51-f7c4d0fc2256;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=0;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2023-11-10T02:03:31Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN2PR12MB3966:EE_|MN0PR12MB6174:EE_ x-ms-office365-filtering-correlation-id: 733f1b5a-a24b-46fe-9473-08dbe1919759 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: YNGMsmBFyqgxvYKdWHbgGEqaw8QEdl0lWRY6lg+jNIan6Q/SDUqJ5a0ajPZytY0DiNEO9DQ+RxcDk7Falj2tQCuRJmKY8E58HQUoVBq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wHFovc48dV5jks3vcZCA0eCA8u19lO+VyOz94MF0hYBAEoNg?= =?us-ascii?Q?uA8LVzvoxBWO4S+8Q4snzoMd6Kc5FtR8B4xLdjwLsnRJedCPHFUyZfAjDIBk?= =?us-ascii?Q?CisrRb1BodA37Hgi98d+ai+k5D9QP+uXorrOLJGV0KQeOB018HQGxLzgBxPz?= =?us-ascii?Q?39xsrvD4gxQSdA8elDF8MFMxhaiZUOZaUZ7MDWjdP+VXDjIPvl8wLmtytPW5?= =?us-ascii?Q?OwRMm7g4yKhOJ+G+4cSHlRmLR6KDHreLbGy2PeltuQOwB7YIAwJMa4QVjUjA?= =?us-ascii?Q?BfElPYsJOTeYWaPPuEjoQePMhJUyk3lVRInsvaM8OMP94HF05NWPgUE5AmnH?= =?us-ascii?Q?h8bhtxF8+RhGy+jueTE=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB3966.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 733f1b5a-a24b-46fe-9473-08dbe1919759 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Nov 2023 02:06:02.8505 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: zt31qZxGrNHsmiTgeum2zNnQIdhkyUkzWN/1i0fii3GEy84i50AHYOSq7j5OJlbh3kVJMW2IapRCrrcnmX4e7Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6174 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,abner.chang@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: haUyNGwtXxJiFgVjMIrykaOix7686176AA= Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_MN2PR12MB3966822C72AE3C5129993E4CEAAEAMN2PR12MB3966namp_" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=EROvxefr; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") --_000_MN2PR12MB3966822C72AE3C5129993E4CEAAEAMN2PR12MB3966namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [AMD Official Use Only - General] From: Ashish Singhal Sent: Tuesday, November 7, 2023 1:55 AM To: devel@edk2.groups.io; quic_llindhol@quicinc.com; ardb+tianocore@kernel.= org; Chang, Abner ; git@danielschaefer.me; Jeff Brasen= Subject: Re: [PATCH 1/2] EmbeddedPkg: Fix Android Boot Command Line Length = Bug Caution: This message originated from an External Source. Use proper cautio= n when opening attachments, clicking links, or responding. Hello, Hoping to get some feedback on these 2 patches this week. Thanks Ashish ________________________________ From: Ashish Singhal > Sent: Monday, October 30, 2023 2:24 PM To: devel@edk2.groups.io >; quic_llindhol@quicinc.com >; ardb+tianocore@kernel.org >; abner.chang@amd.com >= ; git@danielschaefer.me >; Jeff Brasen > Cc: Ashish Singhal = > Subject: [PATCH 1/2] EmbeddedPkg: Fix Android Boot Command Line Length Bug Curently, AndroidBootImgLib expects input kernel command line to never exceed 256 unicode characters where the image header allows for 512 ascii characters. If image header allows 512 ascii characters, similar number of unicode characters should be allowed at the minimum. Signed-off-by: Ashish Singhal > --- .../AndroidBootImgLib/AndroidBootImgLib.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c b/Em= beddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c index 1359a66db2..02769cd0df 100644 --- a/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c +++ b/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c @@ -321,8 +321,9 @@ AndroidBootImgGetFdt ( EFI_STATUS AndroidBootImgUpdateArgs ( - IN VOID *BootImg, - OUT VOID *KernelArgs + IN VOID *BootImg, + OUT VOID *KernelArgs, + IN UINT32 KernelArgsSize ) { CHAR8 ImageKernelArgs[ANDROID_BOOTIMG_KERNEL_ARGS_SIZE]; @@ -337,13 +338,13 @@ AndroidBootImgUpdateArgs ( AsciiStrToUnicodeStrS ( ImageKernelArgs, KernelArgs, - ANDROID_BOOTIMG_KERNEL_ARGS_SIZE >> 1 + KernelArgsSize ); // Append platform kernel arguments if (mAndroidBootImg->AppendArgs) { Status =3D mAndroidBootImg->AppendArgs ( KernelArgs, - ANDROID_BOOTIMG_KERNEL_ARGS_SIZE + KernelArgsSize ); } @@ -611,11 +612,16 @@ AndroidBootImgBoot ( MEMORY_DEVICE_PATH KernelDevicePath; EFI_HANDLE ImageHandle; VOID *NewKernelArg; + UINT32 NewKernelArgSize; EFI_LOADED_IMAGE_PROTOCOL *ImageInfo; VOID *RamdiskData; UINTN RamdiskSize; IN VOID *FdtBase; + if ((Buffer =3D=3D NULL) || (BufferSize =3D=3D 0)) { + return EFI_INVALID_PARAMETER; + } + NewKernelArg =3D NULL; ImageHandle =3D NULL; @@ -637,14 +643,15 @@ AndroidBootImgBoot ( goto Exit; } - NewKernelArg =3D AllocateZeroPool (ANDROID_BOOTIMG_KERNEL_ARGS_SIZE); + NewKernelArgSize =3D ANDROID_BOOTIMG_KERNEL_ARGS_SIZE; + NewKernelArg =3D AllocateZeroPool (sizeof (CHAR16) * NewKernelArgSiz= e); I think you can just move the memory allocation code to inside AndroidBootI= mgUpdateArgs then you don't need the additional arg for AndroidBootImgUpdat= eArgs. Also Change AndroidBootImgUpdateArgs (Buffer, NewKernelArg); to AndroidBoot= ImgUpdateArgs (Buffer, &NewKernelArg); With this the code looks simple. thanks Abner if (NewKernelArg =3D=3D NULL) { DEBUG ((DEBUG_ERROR, "Fail to allocate memory\n")); Status =3D EFI_OUT_OF_RESOURCES; goto Exit; } - Status =3D AndroidBootImgUpdateArgs (Buffer, NewKernelArg); + Status =3D AndroidBootImgUpdateArgs (Buffer, NewKernelArg, NewKernelArgS= ize); if (EFI_ERROR (Status)) { goto Exit; } -- 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111006): https://edk2.groups.io/g/devel/message/111006 Mute This Topic: https://groups.io/mt/102284239/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- --_000_MN2PR12MB3966822C72AE3C5129993E4CEAAEAMN2PR12MB3966namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

[AMD Official Use Only - General]


 

 

From: Ashish Singhal <ashishsingha@nvidia.= com>
Sent: Tuesday, November 7, 2023 1:55 AM
To: devel@edk2.groups.io; quic_llindhol@quicinc.com; ardb+tianocore@= kernel.org; Chang, Abner <Abner.Chang@amd.com>; git@danielschaefer.me= ; Jeff Brasen <jbrasen@nvidia.com>
Subject: Re: [PATCH 1/2] EmbeddedPkg: Fix Android Boot Command Line = Length Bug

 

Caution: This message originated from an External Source. Use proper caution= when opening attachments, clicking links, or responding.

 

Hello,

 

Hoping to get some feedback on these 2 patches this week.<= o:p>

 

Thanks

Ashish


From: Ashish Singhal <ashishsingha@nvidia.com>
Sent: Monday, October 30, 2023 2:24 PM
To: devel@edk2.groups.io= <devel@edk2.groups.io>; quic_llindhol@quicinc.com = <quic_llindhol@quicinc.com<= /a>>; ardb+tianocore@kernel.org = <ardb+tianocore@kernel.org<= /a>>; abner.chang@amd.com <abner.chang@amd.com>; git@danielschaefer.me <git@danielschaefer.me>; Jeff Br= asen <jbrasen@nvidia.com> Cc: Ashish Singhal <as= hishsingha@nvidia.com>
Subject: [PATCH 1/2] EmbeddedPkg: Fix Android Boot Command Line Leng= th Bug

 

Curently, AndroidBoot= ImgLib expects input kernel command line
to never exceed 256 unicode characters where the image header
allows for 512 ascii characters. If image header allows 512
ascii characters, similar number of unicode characters should be
allowed at the minimum.

Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
---
 .../AndroidBootImgLib/AndroidBootImgLib.c     | 1= 9 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c b/Em= beddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c
index 1359a66db2..02769cd0df 100644
--- a/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c
+++ b/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c
@@ -321,8 +321,9 @@ AndroidBootImgGetFdt (
 
 EFI_STATUS
 AndroidBootImgUpdateArgs (
-  IN  VOID  *BootImg,
-  OUT VOID  *KernelArgs
+  IN  VOID    *BootImg,
+  OUT VOID    *KernelArgs,
+  IN  UINT32  KernelArgsSize
   )
 {
   CHAR8       ImageKernelArgs[ANDR= OID_BOOTIMG_KERNEL_ARGS_SIZE];
@@ -337,13 +338,13 @@ AndroidBootImgUpdateArgs (
   AsciiStrToUnicodeStrS (
     ImageKernelArgs,
     KernelArgs,
-    ANDROID_BOOTIMG_KERNEL_ARGS_SIZE >> 1<= /p>

+    K= ernelArgsSize
     );
   // Append platform kernel arguments
   if (mAndroidBootImg->AppendArgs) {
     Status =3D mAndroidBootImg->AppendArgs (
            &nb= sp;            =         KernelArgs,
-            &n= bsp;            = ;       ANDROID_BOOTIMG_KERNEL_ARGS_SIZE
+            &n= bsp;            = ;       KernelArgsSize
            &nb= sp;            =         );
   }
 
@@ -611,11 +612,16 @@ AndroidBootImgBoot (
   MEMORY_DEVICE_PATH       &n= bsp; KernelDevicePath;
   EFI_HANDLE        &nbs= p;        ImageHandle;
   VOID         &nbs= p;             = *NewKernelArg;
+  UINT32          &= nbsp;          NewKernelArgSiz= e;
   EFI_LOADED_IMAGE_PROTOCOL  *ImageInfo;
   VOID         &nbs= p;             = *RamdiskData;
   UINTN         &nb= sp;            Ramdi= skSize;
   IN  VOID        &= nbsp;          *FdtBase;
 
+  if ((Buffer =3D=3D NULL) || (BufferSize =3D=3D 0)) {
+    return EFI_INVALID_PARAMETER;
+  }
+
   NewKernelArg =3D NULL;
   ImageHandle  =3D NULL;
 
@@ -637,14 +643,15 @@ AndroidBootImgBoot (
     goto Exit;
   }
 
-  NewKernelArg =3D AllocateZeroPool (ANDROID_BOOTIMG_KERNEL_ARGS_SIZE= );
+  NewKernelArgSize =3D ANDROID_BOOTIMG_KERNEL_ARGS_SIZE;
+  NewKernelArg     =3D AllocateZeroPool (sizeof (= CHAR16) * NewKernelArgSize);

I think you can just = move the memory allocation code to inside AndroidBootImgUpdateArgs then you= don’t need the additional arg for AndroidBootImgUpdateArgs.

Also Change AndroidBo= otImgUpdateArgs (Buffer, NewKernelArg); to AndroidBootImgUpdateArgs (Buffer= , &NewKernelArg);

With this the code lo= oks simple.

thanks

Abner


   if (NewKernelArg =3D=3D NULL) {
     DEBUG ((DEBUG_ERROR, "Fail to allocate memory= \n"));
     Status =3D EFI_OUT_OF_RESOURCES;
     goto Exit;
   }
 
-  Status =3D AndroidBootImgUpdateArgs (Buffer, NewKernelArg);
+  Status =3D AndroidBootImgUpdateArgs (Buffer, NewKernelArg, NewKerne= lArgSize);
   if (EFI_ERROR (Status)) {
     goto Exit;
   }
--
2.17.1

_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

View/Reply Online (#111006) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--_000_MN2PR12MB3966822C72AE3C5129993E4CEAAEAMN2PR12MB3966namp_--