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 82D067803CF for ; Thu, 21 Sep 2023 13:00:29 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=8zD8eF1kOeFqzwe3/cvjThZRsfiZztCh+pxDxPXzNyo=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC: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:Content-Transfer-Encoding; s=20140610; t=1695301228; v=1; b=R6rXpvPf2eMz8dK0ZAf6/wGrPIZTEMESLHw2CV1wUtc7coW+ckLmRBNG1KRSmO0dUVFHoMSX 2O0wzUsMm255P+I8w1esQD0Of2WhEn1m1jpobFhDfj3kz+9/fxARMyyTzex510wJkyhB0hTBfYh pMLsZdUfgq7Ls3Ce+87a/+h8= X-Received: by 127.0.0.2 with SMTP id GbLoYY7687511xgORq9qM1Rh; Thu, 21 Sep 2023 06:00:28 -0700 X-Received: from NAM04-MW2-obe.outbound.protection.outlook.com (NAM04-MW2-obe.outbound.protection.outlook.com [40.107.101.63]) by mx.groups.io with SMTP id smtpd.web10.16279.1695301227392795489 for ; Thu, 21 Sep 2023 06:00:27 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DpI3iIdKQnNDsFAJmALTTrxAz8thLpiqwh56xvrY9HWfrXcm1Rzh9UdOh/9gfieR6he/VbBilms3jy2HAdAal0meUQnrh/JQdc3SdDdqpmWhEA4MShoDjBjQjFRpR2hnimRAzRdvHHr44/qPU275Y8eNSI/N42yuu6dHo013vm3MYwV0ZhRpzEz90VNbFBcZ1v2rzdVupPwnmX5NGn13ilEcfqmTqPbEn9WdOvLMgStXAxpOIaCv+iUiNeVO6mSxQnF/qwsjVC8Ey+oIfz5EvjgZktgnHEKUq4CPd7VD/jp8skOnS8b1ayVSe5us8t7wt/A/5SX1sYwbBlFB5XQLzg== 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=fRitQatfKBUdIZB6uXJsO5YnF53GZV5b4zS0F683Fek=; b=b2tf2gAuoorQILgyrBq+f4F4NE0aQA/bOMXAQfHojwKrraF9pcqxE9gg1DIhHEm6vcg1JuYHk6XWgCUfwEiRaE5Te+sa5C0V1pujjJmBzR/Vky0/Zv4eO+pD4x1HyEz3Xq4rnn96jV/amYB6/qK2dvfy+Us9bUtA24ClEQZO9UuoNYYt6R6RY8deN6P5NicTNBTImpm1ejFPdCtp/qxtKE8sVlRcFePRZ8vlGT2zjsAckl8jsGqw1yBprMG7+Ki1UUoO2qa229tG07bLRXZ9oYQ+Tox/Qs1uTcXWyFg4nN6wwIY/6JgwVtfK4+bpgrFExgmwMMdtsvD2IdzdmcpqNA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none X-Received: from MW4PR12MB7031.namprd12.prod.outlook.com (2603:10b6:303:1ef::6) by DM4PR12MB8498.namprd12.prod.outlook.com (2603:10b6:8:183::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Thu, 21 Sep 2023 13:00:23 +0000 X-Received: from MW4PR12MB7031.namprd12.prod.outlook.com ([fe80::f345:babc:2bc5:bfae]) by MW4PR12MB7031.namprd12.prod.outlook.com ([fe80::f345:babc:2bc5:bfae%4]) with mapi id 15.20.6813.018; Thu, 21 Sep 2023 13:00:23 +0000 From: "Nickle Wang via groups.io" To: "Chang, Abner" , Igor Kulchytskyy , "devel@edk2.groups.io" CC: Nick Ramirez Subject: Re: [edk2-devel] [PATCH] RedfishPkg/JsonLib: fix JsonObjectGetValue issue Thread-Topic: [EXTERNAL] [PATCH] RedfishPkg/JsonLib: fix JsonObjectGetValue issue Thread-Index: AQHZ6jFHjj/iUZHxa0mPmFXo0d/sgrAj1wSAgAC48gCAALKiQA== Date: Thu, 21 Sep 2023 13:00:23 +0000 Message-ID: References: <20230918130838.6137-1-nicklew@nvidia.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=62399b41-180f-4f95-a5e7-b41ad12f923a;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-09-21T02:15:34Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW4PR12MB7031:EE_|DM4PR12MB8498:EE_ x-ms-office365-filtering-correlation-id: 6a33fa82-e3f0-44b9-65a4-08dbbaa2b7ad x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: hfnuSwTvWIDAE8fU9yq3xZ2bqQ/X7M/zyIi4Rvuyn/8HGf3LIC/3APyrqMh6ozvJ5DDYDvwSU+8QiRPUOq7WS0SyKYmU0FkgBa8apYPp8+daxVYZWJhFJ8aOBWdn/e5zp3S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sEGBdL2id/Uj2lcJBSCLlh?= =?us-ascii?Q?cBKI8uywehxP2RrY6CurHl9uPLWTm6orI0JqQoDC1GajRBlxjlv0pIYZ+UuS?= =?us-ascii?Q?JanhsOy7vaC0QHwtpVtCwP/MwmSYVZCeOGw7mb2qAxizxQ1DAe6nfh9OAEHo?= =?us-ascii?Q?UEy66LGjxHpuNK/w6VC1+RndikpewNrayTjuDrTUVCxi3hTwOI5R7yF8CxF8?= =?us-ascii?Q?qLUU2S8D+S54lBmfBeZV4ePbh0bl6oSP1nfk6nonodR7oDQD2+v/C8Y5HxuQ?= =?us-ascii?Q?v/a3ULVq0gNl5BSZq3Wy32FyGlzEQx6OJbk5Oe7GZ+t4VTW9vaN75OEWWgD6?= =?us-ascii?Q?nICPWAOujj2YKcN4/JcEuM5a5ZgC3CU72MlZH0/pJHzz?= MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR12MB7031.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6a33fa82-e3f0-44b9-65a4-08dbbaa2b7ad X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Sep 2023 13:00:23.2080 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: i5AAC7smswYWGf95KqzridWVT9dG7F+9eMSMREC8DnB5qMIm4gmy86qE9jLNjW2dcErG9RlTrFMn/XnY+EedFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB8498 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,nicklew@nvidia.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: gEHCM6BOrIRmXaqwJKUpC4pxx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=R6rXpvPf; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); 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 Hi Abner, I add suggested comment in version 2: https://edk2.groups.io/g/devel/messag= e/108942 Thanks, Nickle > -----Original Message----- > From: Chang, Abner > Sent: Thursday, September 21, 2023 10:20 AM > To: Igor Kulchytskyy ; Nickle Wang ; > devel@edk2.groups.io > Cc: Nick Ramirez > Subject: RE: [EXTERNAL] [PATCH] RedfishPkg/JsonLib: fix JsonObjectGetValu= e > issue >=20 > External email: Use caution opening links or attachments >=20 >=20 > [AMD Official Use Only - General] >=20 > Hi Nickle, > As we may use a protocol that provide the JSON interface for other packag= es or > drivers, could you please have a comment around the hardcoded number says= the > hardcoded number would be removed when we have a protocol on top of janss= on > lib? People can still have the real hashtable seed if they use library di= rectly. >=20 > Thanks > Abner >=20 > > -----Original Message----- > > From: Igor Kulchytskyy > > Sent: Wednesday, September 20, 2023 11:19 PM > > To: Nickle Wang ; devel@edk2.groups.io > > Cc: Chang, Abner ; Nick Ramirez > > > > Subject: RE: [EXTERNAL] [PATCH] RedfishPkg/JsonLib: fix > > JsonObjectGetValue issue > > > > Caution: This message originated from an External Source. Use proper > > caution when opening attachments, clicking links, or responding. > > > > > > Reviewed-by: Igor Kulchytskyy > > > > Regards, > > Igor > > -----Original Message----- > > From: Nickle Wang > > Sent: Monday, September 18, 2023 9:09 AM > > To: devel@edk2.groups.io > > Cc: Abner Chang ; Igor Kulchytskyy > > ; Nick Ramirez > > Subject: [EXTERNAL] [PATCH] RedfishPkg/JsonLib: fix JsonObjectGetValue > > issue > > > > > > **CAUTION: The e-mail below is from an external source. Please > > exercise caution before opening attachments, clicking links, or > > following guidance.** > > > > JsonObjectGetValue() cannot find corresponding JSON value when the > > EDKII_JSON_VALUE object is created by another UEFI driver. This is > > because "hashtable_seed" is initialized by current time while JsonLib > > is loaded. So, "hashtable_seed" > > will be different in each individual UEFI driver. > > > > Signed-off-by: Nickle Wang > > Cc: Abner Chang > > Cc: Igor Kulchytskyy > > Cc: Nick Ramirez > > --- > > RedfishPkg/Library/JsonLib/JsonLib.inf | 1 + > > RedfishPkg/Library/JsonLib/JsonLib.c | 34 > > ++++++++++++++++++++++++++ > > 2 files changed, 35 insertions(+) > > > > diff --git a/RedfishPkg/Library/JsonLib/JsonLib.inf > > b/RedfishPkg/Library/JsonLib/JsonLib.inf > > index 9d52a622e13a..b0d1bcac7cb3 100644 > > --- a/RedfishPkg/Library/JsonLib/JsonLib.inf > > +++ b/RedfishPkg/Library/JsonLib/JsonLib.inf > > @@ -15,6 +15,7 @@ > > MODULE_TYPE =3D DXE_DRIVER > > VERSION_STRING =3D 1.0 > > LIBRARY_CLASS =3D JsonLib|DXE_DRIVER UEFI_APPLICATI= ON > > UEFI_DRIVER > > + CONSTRUCTOR =3D JsonLibConstructor > > > > # > > # VALID_ARCHITECTURES =3D IA32 X64 ARM AARCH64 RISCV64 > > diff --git a/RedfishPkg/Library/JsonLib/JsonLib.c > > b/RedfishPkg/Library/JsonLib/JsonLib.c > > index 9b758b940293..a7ec2ab217a6 100644 > > --- a/RedfishPkg/Library/JsonLib/JsonLib.c > > +++ b/RedfishPkg/Library/JsonLib/JsonLib.c > > @@ -19,6 +19,8 @@ > > > > #include "jansson.h" > > > > +extern volatile UINT32 hashtable_seed; > > + > > /** > > The function is used to initialize a JSON value which contains a > > new JSON array, > > or NULL on error. Initially, the array is empty. > > @@ -1138,3 +1140,35 @@ JsonGetType ( > > { > > return (EDKII_JSON_TYPE)(((json_t *)JsonValue)->type); } > > + > > +/** > > + JSON Library constructor. > > + > > + @param ImageHandle The image handle. > > + @param SystemTable The system table. > > + > > + @retval EFI_SUCCESS Protocol listener is registered successfully. > > + > > +**/ > > +EFI_STATUS > > +EFIAPI > > +JsonLibConstructor ( > > + IN EFI_HANDLE ImageHandle, > > + IN EFI_SYSTEM_TABLE *SystemTable > > + ) > > +{ > > + // > > + // hashtable_seed is initalized by current time while JsonLib is loa= ded. > > + // Due to above mechanism, hashtable_seed will be different in each > > individual > > + // UEFI driver. As the result, the hash of same key in different > > + UEFI driver // would be different. This breaks JsonObjectGetValue() > > + because // JsonObjectGetValue() won't be able to find corresponding > > + JSON value if // this EDKII_JSON_VALUE is created by another UEFI dr= iver. > > + // > > + // Initial the seed to a fixed magic value for JsonLib to be > > + working in all // UEFI drivers. > > + // > > + hashtable_seed =3D 0xFDAE2143; > > + > > + return EFI_SUCCESS; > > +} > > -- > > 2.17.1 > > > > -The information contained in this message may be confidential and > > proprietary to American Megatrends (AMI). This communication is > > intended to be read only by the individual or entity to whom it is > > addressed or by their designee. If the reader of this message is not > > the intended recipient, you are on notice that any distribution of > > this message, in any form, is strictly prohibited. Please promptly > > notify the sender by reply e-mail or by telephone at 770-246-8600, and = then > delete or destroy all copies of the transmission. -=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 (#108943): https://edk2.groups.io/g/devel/message/108943 Mute This Topic: https://groups.io/mt/101432663/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-