From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id B3A0A1B497 for ; Tue, 16 Apr 2019 11:42:18 +0200 (CEST) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Apr 2019 02:42:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,357,1549958400"; d="scan'208";a="149828418" Received: from bricha3-mobl.ger.corp.intel.com ([10.237.220.103]) by FMSMGA003.fm.intel.com with SMTP; 16 Apr 2019 02:42:14 -0700 Received: by (sSMTP sendmail emulation); Tue, 16 Apr 2019 10:42:13 +0100 Date: Tue, 16 Apr 2019 10:42:13 +0100 From: Bruce Richardson To: Ferruh Yigit Cc: Stephen Hemminger , dev@dpdk.org, Chas Williams , "John W. Linville" Message-ID: <20190416094212.GA1865@bricha3-MOBL.ger.corp.intel.com> References: <20190408160419.7409-1-stephen@networkplumber.org> <20190408164112.12471-1-stephen@networkplumber.org> <7e03b000-f4d4-71c3-5978-8a8623d7ace5@intel.com> <20190412150833.63c41806@shemminger-XPS-13-9360> <3dff5ba9-3965-be8d-7bd5-d8504a66c130@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3dff5ba9-3965-be8d-7bd5-d8504a66c130@intel.com> User-Agent: Mutt/1.11.4 (2019-03-13) Subject: Re: [dpdk-dev] [PATCH v2] net/af_packet: fix vlan_insert corruption 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: Tue, 16 Apr 2019 09:42:19 -0000 On Tue, Apr 16, 2019 at 10:37:07AM +0100, Ferruh Yigit wrote: > On 4/12/2019 11:08 PM, Stephen Hemminger wrote: > > On Fri, 12 Apr 2019 17:28:17 +0100 > > Ferruh Yigit wrote: > > > >> On 4/8/2019 5:41 PM, Stephen Hemminger wrote: > >>> If the af_packet transmit is sending a VLAN packet, > >>> and the transmit path to the kernel os full, then it would > >>> mismanage the outgoing mbuf. The original mbuf would end up > >>> being freed twice, once by AF_PACKET PMD and once by caller. > >> > >> This comment is valid with your new patch [1] that updates 'rte_vlan_insert()' > >> to duplicate the mbuf, right? > >> > >> That patch looks like won't make the release, so I suggest this one wait that > >> patch, although this is harmless on its own, commit log is misleading. > >> > >> [1] > >> https://patches.dpdk.org/patch/51870/ > > > > It was always true, even with existing vlan_insert. > > Existing vlan_insert has issues if it ever creates a clone packet. > > Existing vlan_insert can duplicate mbuf through clone > > > > Right, existing vlan_insert has same issue on af_packet. > > But, should vlan_insert try to duplicate the mbuf when it is shared, does it > worth the complexity it brings? And when that support removed this patch won't > be needed. I don't think vlan insert or other mbuf manipulation APIs should be checking for shared state or not - that's the job of the app. We could have cases where the user does want to modify a shared mbuf. Regards, /Bruce From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 063FBA00E6 for ; Tue, 16 Apr 2019 11:42:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A9CD91B498; Tue, 16 Apr 2019 11:42:20 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id B3A0A1B497 for ; Tue, 16 Apr 2019 11:42:18 +0200 (CEST) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Apr 2019 02:42:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,357,1549958400"; d="scan'208";a="149828418" Received: from bricha3-mobl.ger.corp.intel.com ([10.237.220.103]) by FMSMGA003.fm.intel.com with SMTP; 16 Apr 2019 02:42:14 -0700 Received: by (sSMTP sendmail emulation); Tue, 16 Apr 2019 10:42:13 +0100 Date: Tue, 16 Apr 2019 10:42:13 +0100 From: Bruce Richardson To: Ferruh Yigit Cc: Stephen Hemminger , dev@dpdk.org, Chas Williams , "John W. Linville" Message-ID: <20190416094212.GA1865@bricha3-MOBL.ger.corp.intel.com> References: <20190408160419.7409-1-stephen@networkplumber.org> <20190408164112.12471-1-stephen@networkplumber.org> <7e03b000-f4d4-71c3-5978-8a8623d7ace5@intel.com> <20190412150833.63c41806@shemminger-XPS-13-9360> <3dff5ba9-3965-be8d-7bd5-d8504a66c130@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline In-Reply-To: <3dff5ba9-3965-be8d-7bd5-d8504a66c130@intel.com> User-Agent: Mutt/1.11.4 (2019-03-13) Subject: Re: [dpdk-dev] [PATCH v2] net/af_packet: fix vlan_insert corruption 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190416094213.mTmAhUkdcAUwlf6biHDREdZpLtUiSs4d3xDzDrYIHPY@z> On Tue, Apr 16, 2019 at 10:37:07AM +0100, Ferruh Yigit wrote: > On 4/12/2019 11:08 PM, Stephen Hemminger wrote: > > On Fri, 12 Apr 2019 17:28:17 +0100 > > Ferruh Yigit wrote: > > > >> On 4/8/2019 5:41 PM, Stephen Hemminger wrote: > >>> If the af_packet transmit is sending a VLAN packet, > >>> and the transmit path to the kernel os full, then it would > >>> mismanage the outgoing mbuf. The original mbuf would end up > >>> being freed twice, once by AF_PACKET PMD and once by caller. > >> > >> This comment is valid with your new patch [1] that updates 'rte_vlan_insert()' > >> to duplicate the mbuf, right? > >> > >> That patch looks like won't make the release, so I suggest this one wait that > >> patch, although this is harmless on its own, commit log is misleading. > >> > >> [1] > >> https://patches.dpdk.org/patch/51870/ > > > > It was always true, even with existing vlan_insert. > > Existing vlan_insert has issues if it ever creates a clone packet. > > Existing vlan_insert can duplicate mbuf through clone > > > > Right, existing vlan_insert has same issue on af_packet. > > But, should vlan_insert try to duplicate the mbuf when it is shared, does it > worth the complexity it brings? And when that support removed this patch won't > be needed. I don't think vlan insert or other mbuf manipulation APIs should be checking for shared state or not - that's the job of the app. We could have cases where the user does want to modify a shared mbuf. Regards, /Bruce