From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Pernas Maradei Subject: PMD pcap driver: double free or corruption error Date: Mon, 08 Sep 2014 09:53:51 -0300 Message-ID: <540DA6DF.9040607@emutex.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable To: dev-VfR2kkLFssw@public.gmane.org Return-path: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" Hi, I've been using the PMD pcap driver for a while now. It's very handy for=20 testing and running DPDK on systems with no Intel NICs (like my laptop).=20 Unfortunately I've found a small issue that's been bothering me a lot.=20 It turns out that the PMD pcap driver opens the pcaps/interfaces only at=20 init time and close them everytime the port is closed. So if you close=20 the port two times in a row you'll get a "double free or corruption"=20 error being thrown by libpcap. You can easily reproduce the error with testpmd doing the following: sudo ./x86_64-native-linuxapp-gcc/app/testpmd -c f -n 3=20 --vdev=3Deth_pcap0,rx_pcap=3D../netronome/client/examples/file.pcap,tx_pc= ap=3Dout.pcap=20 -- --port-topology=3Dchained -i ..... init (0) eth_pcap0 PMD: Initializing pmd_pcap for eth_pcap0 PMD: Creating pcap-backed ethdev on numa socket 0 EAL: Core 3 is ready (tid=3De99fc700) EAL: Core 2 is ready (tid=3Dea1fd700) EAL: Core 1 is ready (tid=3Dea9fe700) Interactive-mode selected Configuring Port 0 (socket 0) Port 0: 00:00:00:01:02:03 Checking link statuses... Port 0 Link Up - speed 10000 Mbps - full-duplex Done testpmd> port stop all Stopping ports... Checking link statuses... Port 0 Link Down Done testpmd> port start all Port 0: 00:00:00:01:02:03 Checking link statuses... Port 0 Link Up - speed 10000 Mbps - full-duplex Done testpmd> port stop all Stopping ports... *** Error in `./x86_64-native-linuxapp-gcc/app/testpmd': double free or=20 corruption (!prev): 0x00000000015a9020 *** I have a fix for it that I'm currently testing and will be submitting=20 later on this week. Basically I'm storing the config the driver is=20 started with (type of streams and pcap/interface names) and re-opening=20 them everytime the user starts the port. Thanks, Nico. --=20 Nicol=E1s Pernas Maradei Software Engineer Emutex Ltd. Callan Centre, National Technology Park, Limerick, Ireland Phone: +353 (0)61 514496 Ext #872, Mobile: +353 (0)86 7907731 Web: www.emutex.com, Email: nico-M3NBUjLqch7QT0dZR+AlfA@public.gmane.org This email may contain information, which is confidential and/or privileg= ed. The information is intended solely for the use of the individual or e= ntity named above. If you are not the intended recipient, be aware that a= ny disclosure, copying, distribution or use of the contents is prohibited= . If you have received this electronic transmission in error, please noti= fy the sender by telephone or return email and delete the material from y= our computer. Emutex Ltd is registered in Ireland, No 256238, at Callan C= entre, National Technology Park, Limerick, Ireland.