From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 0313A7288; Fri, 27 Apr 2018 14:37:14 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Apr 2018 05:37:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,335,1520924400"; d="scan'208";a="36904871" Received: from irsmsx110.ger.corp.intel.com ([163.33.3.25]) by orsmga008.jf.intel.com with ESMTP; 27 Apr 2018 05:37:10 -0700 Received: from irsmsx155.ger.corp.intel.com (163.33.192.3) by irsmsx110.ger.corp.intel.com (163.33.3.25) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 27 Apr 2018 13:37:09 +0100 Received: from irsmsx101.ger.corp.intel.com ([169.254.1.118]) by irsmsx155.ger.corp.intel.com ([169.254.14.108]) with mapi id 14.03.0319.002; Fri, 27 Apr 2018 13:37:09 +0100 From: "Van Haaren, Harry" To: Akhil Goyal , "De Lara Guarch, Pablo" , "Zhang, Roy Fan" CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 1/2] crypto/scheduler: set null pointer after freeing Thread-Index: AQHT3gRrKPB3q/M14U2dVjHcUcERi6QUaxYAgAAGRoCAABpPwA== Date: Fri, 27 Apr 2018 12:37:08 +0000 Message-ID: References: <20180426150950.7568-1-pablo.de.lara.guarch@intel.com> <5e2f48d7-c451-c550-5ddc-70263a278e2f@nxp.com> <5bec1a84-d91f-26cf-1a5d-2909c0906c8f@nxp.com> In-Reply-To: <5bec1a84-d91f-26cf-1a5d-2909c0906c8f@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMzAxOGU4MDMtY2M5Ny00NDExLWE5YzUtMDMzMmU3Yzc4MTBiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJ3eklwTEdoejkzbUVnc1lFMDNlWVFjXC84NkFiTUFvU0pJclJWNmI4cmlhSFwvSkhsYjBXWW9Ra0FCbnBuT2J3eEYifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 1/2] crypto/scheduler: set null pointer after freeing X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Apr 2018 12:37:15 -0000 > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Akhil Goyal > Sent: Friday, April 27, 2018 12:59 PM > To: De Lara Guarch, Pablo ; Akhil Goyal > ; Zhang, Roy Fan > Cc: dev@dpdk.org; stable@dpdk.org > Subject: Re: [dpdk-dev] [PATCH 1/2] crypto/scheduler: set null pointer af= ter > freeing >=20 > Hi Pablo, >=20 > On 4/27/2018 5:06 PM, De Lara Guarch, Pablo wrote: > > Hi Akhil, > > > >> -----Original Message----- > >> From: Akhil Goyal [mailto:akhil.goyal@nxp.com] > >> Sent: Friday, April 27, 2018 9:47 AM > >> To: De Lara Guarch, Pablo ; Zhang, Roy= Fan > >> > >> Cc: dev@dpdk.org; stable@dpdk.org > >> Subject: Re: [dpdk-dev] [PATCH 1/2] crypto/scheduler: set null pointer > after > >> freeing > >> > >> Hi Pablo, > >> > >> On 4/26/2018 8:39 PM, Pablo de Lara wrote: > >>> When freeing memory, pointers should be set to NULL, to avoid memory > >>> corruption/segmentation faults. > >> > >> Shouldn't this be handled in the rte_free itself. A lot of other drive= r are > also not > >> setting null after rte_free. > >> This would require change at a lot of places if this is not handled in > rte_free. > >> > > > > The glibc function "free" works the same way. Users are responsible for > > setting to NULL these pointers (because sometimes, it is not necessary = to do > such thing). > Yes it is correct but rte_free is custom free API in DPDK which can be > modified or we can have a safer API rte_free_safe which can set the > pointer to null. > > > > Anyway, in case we still wanted to change it, we would need to pass a > pointer > > to a pointer in rte_free, which would imply an API breakage. Actually there is an alternative solution, by creating a macro like so; #define rte_free(x) do { rte_free_(x); /* call the real implementation, now with _ */ x =3D NULL; } while (0) This is not an ABI break if symbol versioning is used for rte_free(). It is an API change however - not that the calling code has to change, but rather that the effect of rte_free() changes transparently. I'm not sure what the correct thing to do is in this case - just pointing out that this is another possible solution. > I think if the community agrees, we can add this change may be in next > releases. +1 to discuss this with the community, regardless of the implementation :) > > Thanks, > > Pablo > > > >> Thanks, > >> Akhil