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 B8F7478003C for ; Fri, 22 Sep 2023 01:17:06 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=cGjQH6ra5jCqjDoAkn0IxifNNmnT6uHm01yMi5vRO7A=; 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=1695345425; v=1; b=KYDcCNke0gbn4el0seHh+2KLHBCyWv0uBCEQtOODWm02xOWG6uVS7hIbFMPT1NubdWrWhhFf pJqizYMXq5yA52g2/ZrfR7wO3D7Urv4bL7qeg+ierqtnMFpJ/+Wi3VZr625EDCE5fEKdp2XGiIw cgoTi2iY45/phJ+OfiMktpGI= X-Received: by 127.0.0.2 with SMTP id W98TYY7687511xhjM1y5ojmI; Thu, 21 Sep 2023 18:17:05 -0700 X-Received: from NAM04-MW2-obe.outbound.protection.outlook.com (NAM04-MW2-obe.outbound.protection.outlook.com [40.107.101.75]) by mx.groups.io with SMTP id smtpd.web11.12282.1695345424755130787 for ; Thu, 21 Sep 2023 18:17:04 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BLxPbidP4vMsMfhXztWZYsKCxZdHvp9OLz8beEs2bGeFN/u22EasLETvQtVC7ro7hrITqjuegPuVkR3b+TZxwT/n5EaIDDxjKT5aSpYP33nPX3tLskDFn6z/09CzYvDMtf44n/PYwpZmGFwnkcv+rOoity+Y2HvJQww+tAMqyWCwu66rwYfbge88fOAaRvvfubBPoTNIJg4ZBilTE74DfkSsERghoQnlLACKbY/8FbxEQNlLvRkvdIyUYtgJzp1T7WCVi5PBAd7UWwuQ3AW13tvFntgAheBbBNh4orUMwo4lEDUCaxcq6UMpj7MofMM354djNz3KMUux56cq3nx7jQ== 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=c8T2zoMime87ECHpe98bhNRTkdSTEGAvQzlNXvLbokY=; b=GhXC5jYJKeaywx7hySH1CbhhuZZaOVmhLuQ1IeohHerv3Ges60c2glNs6TAlscq/VkKQj32eK0ssqnL/Rpe/6CAlgiCyfhslJMyY4DMVD1CuO9qzEtdZnjIq9CF98siMfBIAhleVB5CwgL1e2ADkM6BM9QQFA14oQIsWUi5N60GJNJggtE5zYQqgTTOhtyUSt+xW2WhIxfE/h6b5kcAOK34NALHUt8xq5bu9OJn1aPdT/Yoi6vl/j93Fz+qu9hyoME3BJqLlJZ45Ud61LNe0adWq/CZTzC7kUAy6Wl0GuFzsMJI6S5ZpWnvvABwRt58EjjVvxBB892bca0dNGFYw3g== 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 DS7PR12MB8083.namprd12.prod.outlook.com (2603:10b6:8:e4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Fri, 22 Sep 2023 01:17:03 +0000 X-Received: from MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::2061:ca33:b659:2c02]) by MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::2061:ca33:b659:2c02%5]) with mapi id 15.20.6792.026; Fri, 22 Sep 2023 01:17:02 +0000 From: "Chang, Abner via groups.io" To: Nickle Wang , 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: AQHZ6jFHejNNIJeUO0ugJzdrJV/n27Aj1y6AgAC3cKCAALQpgIAAzReQ Date: Fri, 22 Sep 2023 01:17:02 +0000 Message-ID: References: <20230918130838.6137-1-nicklew@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=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: MN2PR12MB3966:EE_|DS7PR12MB8083:EE_ x-ms-office365-filtering-correlation-id: dd5cd1ce-b7fb-4ef2-d0df-08dbbb09a0c6 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: XsuznYNmwRc2kITGnsmVD9I+INbVQYrdBBpdzlF8lCdCIR3fx1+rtZxqpybEFRAuf2q6UdNcg4TCgUnBiNMy6B0kjqz/KOME8JYBo3iBIaDmsShrDHq3zljqDW5pSovGeAz8vu+ZCBMqqGwwimBMTZv1AUnI7h0VNb54+i9mqpsvbzFaCCJI2EG9wV/amKXF6pU90Lfnrp1USs6b0KID1hjxiLhJEj6VzOUB67aSoMy67q9U13vSVVuM8e33YRJcyO85NtokkT8FkDUIV1g/Xi2FBvNq74AiDZAZBPFidAqJUsgKwMO921YWO/j4l9VM17JbS+XzHaHS9uJVOeO1TPnpQelUjuMNKh8LcRG7u5zlyyI7SJeada5uMMaBsIqZ5IYS8qyKpaTxJ9fXl2P9NBwOudpcaE4UyU8mpmGjIf+fSVR1hlErLkY1mD47DBIXDvqi0MvTfzYp6MEUTiJn7jdgbPudqiFkSf4zNc8k1mvxLBSZU2dAMtRsk/YCOP2AkB4A4/cRzspZBBRglT4gzw0iEyGPkldvMvw8RFUn3JS7s88BZELAjrcDs/wcKXB1nUHG1HcOShQmvQ/4Rto8pGwjy7kqRcluUbaWhTAxb3s= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?a17DpfK6zS2OnW/ntceaIjkEwqI0xo5LxL80paaEmphHceMPwBtQhlKIjQFE?= =?us-ascii?Q?L5ZVt2FJNnJ/EB52bhsmSgfMgJcRPRbLcKH7+BObWtvCjqF+KxA8zDBj+snm?= =?us-ascii?Q?gAq7CxAFEE/gBXAhD0KvNWtx6n4tCneRyggzTQLtsjblkw4rEM76asfJXDIF?= =?us-ascii?Q?w60BHMC5Aoog84EbdMFfOe85AG0HnZgHEc4f8AUaVtQXx/pERerjLJJLvTVr?= =?us-ascii?Q?WjQGRBdOABU7U55HICkAirwCxhJjtaToRxjw/+b9mLehUb2wjUI1dgiEMAOV?= =?us-ascii?Q?jLuzjE2bfojETvYUFPM5EkoWbxO2mpLY/e/m7kIrWJz3rJhqLrwTARNzVwVE?= =?us-ascii?Q?u0AmCATascxYXZEZ6YfNcnIG11fNBaoNlnsam3cIFaM7mvytk+LV8NWCmY87?= =?us-ascii?Q?BQg8cvAFj42siUXZ4bgbhk6Gc6640rHGiIujh606cVJCMJ6Jt75ZdEaTSS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axCHazqVviverL/IX7jbkC1UCDQ1E/Hw5?= =?us-ascii?Q?7mU5ACn0g6HuFqpYk4f//oiqSrwUlDkxHf/2a8Tpg4zSqjqAzY0LU+nypeom?= =?us-ascii?Q?pSq2jh+i8RkVCahP6xPx8LmxHlb5rJ1N1dcaOIGbpte3nWAoBUKBeMpLklse?= =?us-ascii?Q?Yy/ZCcKRUxLblOpilEGSOoMDVpIFQ5ivDdQGtHS/s/Wdx3duqP1+b5+FmXnt?= =?us-ascii?Q?baTbQOq5Sei6ili3CLk=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: dd5cd1ce-b7fb-4ef2-d0df-08dbbb09a0c6 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Sep 2023 01:17:02.9418 (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: qNo9SI/b3EIZhuo96bBfPePyH6JMXi9fX9k4rAVI3OvXjYUor5D0eBDmsFEeTJOu2NnjYbV0JoN53D2dR7CW5g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB8083 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: dJSAkMz95MDNTJft0lkZme0Zx7686176AA= 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=KYDcCNke; 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 [AMD Official Use Only - General] Thank you Nickle. RB is given to that patch. Abner > -----Original Message----- > From: Nickle Wang > Sent: Thursday, September 21, 2023 9:00 PM > To: Chang, Abner ; Igor Kulchytskyy > ; devel@edk2.groups.io > Cc: Nick Ramirez > Subject: RE: [EXTERNAL] [PATCH] RedfishPkg/JsonLib: fix JsonObjectGetValu= e > issue > > [AMD Official Use Only - General] > > Caution: This message originated from an External Source. Use proper caut= ion > when opening attachments, clicking links, or responding. > > > Hi Abner, > > I add suggested comment in version 2: > https://edk2.groups.io/g/devel/message/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 > JsonObjectGetValue > > issue > > > > External email: Use caution opening links or attachments > > > > > > [AMD Official Use Only - General] > > > > Hi Nickle, > > As we may use a protocol that provide the JSON interface for other pack= ages > 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 > jansson > > lib? People can still have the real hashtable seed if they use library = directly. > > > > Thanks > > Abner > > > > > -----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 JsonObjectGetValu= e > > > 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_APPLICA= TION > > > 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 l= oaded. > > > + // Due to above mechanism, hashtable_seed will be different in eac= h > > > 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 correspondin= g > > > + JSON value if // this EDKII_JSON_VALUE is created by another UEFI > driver. > > > + // > > > + // 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, an= d > 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 (#108974): https://edk2.groups.io/g/devel/message/108974 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-