From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from g2t2354.austin.hpe.com (g2t2354.austin.hpe.com [15.233.44.27]) (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 2A3DD21E87986 for ; Mon, 11 Sep 2017 13:50:18 -0700 (PDT) Received: from G9W8454.americas.hpqcorp.net (exchangepmrr1.us.hpecorp.net [16.216.161.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g2t2354.austin.hpe.com (Postfix) with ESMTPS id 772F37E; Mon, 11 Sep 2017 20:53:13 +0000 (UTC) Received: from G4W9121.americas.hpqcorp.net (2002:10d2:1510::10d2:1510) by G9W8454.americas.hpqcorp.net (2002:10d8:a104::10d8:a104) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Mon, 11 Sep 2017 20:53:13 +0000 Received: from NAM01-BY2-obe.outbound.protection.outlook.com (15.241.52.13) by G4W9121.americas.hpqcorp.net (16.210.21.16) with Microsoft SMTP Server (TLS) id 15.0.1178.4 via Frontend Transport; Mon, 11 Sep 2017 20:53:13 +0000 Received: from CS1PR84MB0151.NAMPRD84.PROD.OUTLOOK.COM (10.162.189.30) by CS1PR84MB0152.NAMPRD84.PROD.OUTLOOK.COM (10.162.190.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.35.12; Mon, 11 Sep 2017 20:53:10 +0000 Received: from CS1PR84MB0151.NAMPRD84.PROD.OUTLOOK.COM ([10.162.189.30]) by CS1PR84MB0151.NAMPRD84.PROD.OUTLOOK.COM ([10.162.189.30]) with mapi id 15.20.0035.021; Mon, 11 Sep 2017 20:53:09 +0000 From: "Palmer, Thomas" To: "Daryl McDaniel (EDK2 Lists)" , "'Carsey, Jaben'" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH 1/1] StdLib/EfiSocketLib: Fix ABI mismatch for 2 event functions Thread-Index: AQHTEijzmnPFCZFwb0urW/kAglizVqJ+ND+AgDIRQoCAABJkAIAAAHOQ Date: Mon, 11 Sep 2017 20:53:09 +0000 Message-ID: References: <1502404487-12865-1-git-send-email-thomas.palmer@hpe.com> <074401d32b3e$1d6bd810$58438830$@mc2research.org> In-Reply-To: <074401d32b3e$1d6bd810$58438830$@mc2research.org> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=thomas.palmer@hpe.com; x-originating-ip: [15.203.233.85] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CS1PR84MB0152; 6:21okgq+8FYTFOG81VyOZtZf3yas0s2r4SuFICQNb3SkIRjZ/JAPbf7YrLp0JC8topxkLlZlZaF+V3G+V37IvRFP8P/JkMNs/wGSHNe15oHgU8c1BNQ/FZjmDBJtU3lNehUWZhBDXT5KQx27mXib3fVBfw8H+PE0BV9AmMZ+F7CNMtf90re1m3CdtwnLbvgRg/tgIpwQ2nQiwbwbzgVwEdaz4FDfqJPMbGEOhybcSBq554U9R66q5TdiRfY17Ia+PR0nMbvk6NJVJqTrwmio5MJERPrl1ULTRuE/DYKRhql3bzadxt9o2nuuMoVdEFM8L8l8s5Iwzqy7nXcVzeqL2oQ==; 5:R/R8RUrx+9anScsuHs49RjuizJD+1Cf43lWbKLr/w6+ExUhSmpvoSWjM2HwNJKlqyA9LajQwDsBPb4tlK9+A08gKlo+6XIA8D03IC7xWoVTlBhorpHSVFclCh2DnPNp19G8nnnmiGR755IYLTDBtAQ==; 24:Qrt3I/rOoe/skQH6aKxPoiBCk5xKQRWMMFNxfFd/qrHqGHQBrppGH+N3BKBq/XTKIDKJUw6G0HjNcGX1u3ov82ItckeQI7W4lHzqQwhOvgg=; 7:r83iEsD6SI787sjd9UtOlrTgTNkNvN4+LlXOPm2/GC1QAZpTBTCHFqTjgRPdDNcHx4zR8Zv0LfimgA8CT4uuxyAah9YRf+At+gAM1oCEjG6hdPYsKxfkv2fpbh6Ftqim47pW2wvtcm7+XCP6CUrUGTpKornhcJS2NJhOnZTqi7VcgbAjiojQKc2IPWIUIlHmra8UE3tPLIdqG+lSp8DA20s4+Tg+OB/DQqxRo8bCZ0w= x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10019020)(6009001)(39860400002)(377454003)(13464003)(199003)(189002)(33656002)(50986999)(53546010)(189998001)(5660300001)(86362001)(101416001)(93886005)(2900100001)(77096006)(2950100002)(229853002)(3660700001)(6506006)(316002)(6436002)(7696004)(68736007)(97736004)(2501003)(66066001)(3280700002)(106356001)(2906002)(105586002)(3846002)(14454004)(8676002)(53936002)(74316002)(45080400002)(478600001)(9686003)(102836003)(6116002)(76176999)(4326008)(8936002)(6246003)(55016002)(81156014)(81166006)(54356999)(7736002)(305945005)(25786009)(19627235001); DIR:OUT; SFP:1102; SCL:1; SRVR:CS1PR84MB0152; H:CS1PR84MB0151.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; x-ms-office365-filtering-correlation-id: 7eeadea9-594e-408d-4f6b-08d4f9571c2e x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:CS1PR84MB0152; x-ms-traffictypediagnostic: CS1PR84MB0152: x-exchange-antispam-report-test: UriScan:(227479698468861)(162533806227266)(228905959029699); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(93006095)(93001095)(3002001)(10201501046)(6055026)(6041248)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123558100)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CS1PR84MB0152; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CS1PR84MB0152; x-forefront-prvs: 04270EF89C received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Sep 2017 20:53:09.5413 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR84MB0152 X-OriginatorOrg: hpe.com Subject: Re: [PATCH 1/1] StdLib/EfiSocketLib: Fix ABI mismatch for 2 event functions 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, 11 Sep 2017 20:50:18 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Daryl, The gist of the patch is to have these callbacks match the EFI_EVENT_NOTIF= Y when compiled in GCC/DEBUG. The EFIAPI token's absence is not noticed i= n Visual Studio builds b/c VS builds everything with Microsoft's ABI. How= ever, with GCC/DEBUG the EFIAPI token is critical for instructing compiler = which ABI to use. (I believe GCC/RELEASE uses Microsoft ABI). The other piece of the patch is simply changing the callback's second argu= ment type to match EFI_EVENT_NOTIFY. I created a new variable in each funct= ion with the callback's old argument type and name so the rest of the funct= ion can remain unchanged. You should not notice any functional differences for Visual Studio and GCC= RELEASE builds. However, GCC DEBUG builds should now function correctly. Regards, Thomas Palmer "I have only made this letter longer because I have not had the time to mak= e it shorter" - Blaise Pascal -----Original Message----- From: Daryl McDaniel (EDK2 Lists) [mailto:edk2-lists@mc2research.org]=20 Sent: Monday, September 11, 2017 3:40 PM To: Palmer, Thomas ; 'Carsey, Jaben' ; edk2-devel@lists.01.org Cc: Shifflett, Joseph Subject: RE: [PATCH 1/1] StdLib/EfiSocketLib: Fix ABI mismatch for 2 event = functions Thomas, I'll take a look at this. Have you determined what the impact of changing the signature of the functi= ons (adding/removing parameters) will be? Can it adversely affect existing= code? Sincerely, Daryl McDaniel > -----Original Message----- > From: Palmer, Thomas [mailto:thomas.palmer@hpe.com] > Sent: Monday, September 11, 2017 12:35 PM > To: Carsey, Jaben ; edk2-devel@lists.01.org;=20 > edk2- lists@mc2research.org > Cc: edk2-lists@mc2research.org; Shifflett, Joseph=20 > > Subject: RE: [PATCH 1/1] StdLib/EfiSocketLib: Fix ABI mismatch for 2=20 > event functions >=20 > Daryl? >=20 > I haven't seen a comment on this patch since 8/10 >=20 >=20 > Regards, >=20 > Thomas Palmer >=20 > "I have only made this letter longer because I have not had the time=20 > to make it shorter" - Blaise Pascal >=20 >=20 > -----Original Message----- > From: Carsey, Jaben [mailto:jaben.carsey@intel.com] > Sent: Thursday, August 10, 2017 5:59 PM > To: Palmer, Thomas ; edk2-devel@lists.01.org > Cc: edk2-lists@mc2research.org; Shifflett, Joseph=20 > > Subject: RE: [PATCH 1/1] StdLib/EfiSocketLib: Fix ABI mismatch for 2=20 > event functions >=20 > Looks good to me. >=20 > Daryl? >=20 > > -----Original Message----- > > From: Thomas Palmer [mailto:thomas.palmer@hpe.com] > > Sent: Thursday, August 10, 2017 3:35 PM > > To: edk2-devel@lists.01.org > > Cc: edk2-lists@mc2research.org; Carsey, Jaben=20 > > ; joseph.shifflett@hpe.com; Thomas Palmer=20 > > > > Subject: [PATCH 1/1] StdLib/EfiSocketLib: Fix ABI mismatch for 2=20 > > event functions > > Importance: High > > > > The gBS->CreateEvent expects a EFI_EVENT_NOTIFY function as the=20 > > third argument. The EFIAPI token is an important component of that=20 > > prototype. Its absence can cause unexpected issues on DEBUG systems=20 > > built with GCC due to ABI mismatches. > > > > Both EslTcp4ConnectComplete and EslTcp6ConnectComplete did not have=20 > > the EFIAPI token required of a EFI_EVENT_NOTIFY function. GCC did=20 > > not catch this because of the explicit EFI_EVENT_NOTIFY cast. By=20 > > removing the cast, a build error ensues. > > > > This patch removes the cast and updates both functions to comply=20 > > with EFI_EVENT_NOTIFY. > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Thomas Palmer > > --- > > StdLib/EfiSocketLib/Tcp4.c | 8 ++++++-- StdLib/EfiSocketLib/Tcp6.c=20 > > | > > 8 ++++++-- > > 2 files changed, 12 insertions(+), 4 deletions(-) > > > > diff --git a/StdLib/EfiSocketLib/Tcp4.c b/StdLib/EfiSocketLib/Tcp4.c=20 > > index 68477fba6e70..8125a8d4f5ad 100644 > > --- a/StdLib/EfiSocketLib/Tcp4.c > > +++ b/StdLib/EfiSocketLib/Tcp4.c > > @@ -2,6 +2,7 @@ > > Implement the TCP4 driver support for the socket layer. > > > > Copyright (c) 2011 - 2015, Intel Corporation. All rights=20 > > reserved.
> > + (C) Copyright 2017 Hewlett Packard Enterprise Development LP
> > This program and the accompanying materials are licensed and made=20 > > available > > under the terms and conditions of the BSD License which accompanies = this > > distribution. The full text of the license may be found at @@ > > -192,9 +193,10 @@ EslTcp4Accept ( > > > > **/ > > VOID > > +EFIAPI > > EslTcp4ConnectComplete ( > > IN EFI_EVENT Event, > > - IN ESL_PORT * pPort > > + IN VOID *Context > > ) > > { > > BOOLEAN bRemoveFirstPort; > > @@ -203,12 +205,14 @@ EslTcp4ConnectComplete ( > > ESL_SOCKET * pSocket; > > ESL_TCP4_CONTEXT * pTcp4; > > EFI_STATUS Status; > > + ESL_PORT * pPort; > > > > DBG_ENTER ( ); > > > > // > > // Locate the TCP context > > // > > + pPort =3D Context; > > pSocket =3D pPort->pSocket; > > pTcp4 =3D &pPort->Context.Tcp4; > > > > @@ -1288,7 +1292,7 @@ EslTcp4PortAllocate ( > > // > > Status =3D gBS->CreateEvent ( EVT_NOTIFY_SIGNAL, > > TPL_SOCKETS, > > - (EFI_EVENT_NOTIFY)EslTcp4ConnectCompl= ete, > > + EslTcp4ConnectComplete, > > pPort, > > &pTcp4->ConnectToken.CompletionToken.= Event); > > if ( EFI_ERROR ( Status )) { > > diff --git a/StdLib/EfiSocketLib/Tcp6.c b/StdLib/EfiSocketLib/Tcp6.c=20 > > index 0f6d2d6ac93c..9f9c00f6dc57 100644 > > --- a/StdLib/EfiSocketLib/Tcp6.c > > +++ b/StdLib/EfiSocketLib/Tcp6.c > > @@ -2,6 +2,7 @@ > > Implement the TCP6 driver support for the socket layer. > > > > Copyright (c) 2011 - 2014, Intel Corporation. All rights=20 > > reserved.
> > + (C) Copyright 2017 Hewlett Packard Enterprise Development LP
> > This program and the accompanying materials are licensed and made=20 > > available > > under the terms and conditions of the BSD License which accompanies = this > > distribution. The full text of the license may be found at @@ > > -186,9 +187,10 @@ EslTcp6Accept ( > > > > **/ > > VOID > > +EFIAPI > > EslTcp6ConnectComplete ( > > IN EFI_EVENT Event, > > - IN ESL_PORT * pPort > > + IN VOID *Context > > ) > > { > > BOOLEAN bRemoveFirstPort; > > @@ -197,12 +199,14 @@ EslTcp6ConnectComplete ( > > ESL_SOCKET * pSocket; > > ESL_TCP6_CONTEXT * pTcp6; > > EFI_STATUS Status; > > + ESL_PORT * pPort; > > > > DBG_ENTER ( ); > > > > // > > // Locate the TCP context > > // > > + pPort =3D Context; > > pSocket =3D pPort->pSocket; > > pTcp6 =3D &pPort->Context.Tcp6; > > > > @@ -1339,7 +1343,7 @@ EslTcp6PortAllocate ( > > // > > Status =3D gBS->CreateEvent ( EVT_NOTIFY_SIGNAL, > > TPL_SOCKETS, > > - (EFI_EVENT_NOTIFY)EslTcp6ConnectCompl= ete, > > + EslTcp6ConnectComplete, > > pPort, > > &pTcp6->ConnectToken.CompletionToken.= Event); > > if ( EFI_ERROR ( Status )) { > > -- > > 2.7.4