From patchwork Fri Nov 11 22:09:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 693981 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tFvH42Mznz9sXx for ; Sat, 12 Nov 2016 09:10:07 +1100 (AEDT) Received: from localhost ([::1]:55628 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c5K1K-0002un-GB for incoming@patchwork.ozlabs.org; Fri, 11 Nov 2016 17:10:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c5K0e-0002Zr-6g for qemu-devel@nongnu.org; Fri, 11 Nov 2016 17:09:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c5K0Z-0001BI-8Q for qemu-devel@nongnu.org; Fri, 11 Nov 2016 17:09:20 -0500 Received: from hera.aquilenet.fr ([141.255.128.1]:42408) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c5K0Z-0001AT-2H for qemu-devel@nongnu.org; Fri, 11 Nov 2016 17:09:15 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 169D4A33F; Fri, 11 Nov 2016 23:09:13 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YEki1-53cgZO; Fri, 11 Nov 2016 23:09:12 +0100 (CET) Received: from var.youpi.perso.aquilenet.fr (unknown [IPv6:2a01:cb19:181:c200:3602:86ff:fe2c:6a19]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 63801842A; Fri, 11 Nov 2016 23:09:12 +0100 (CET) Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.87) (envelope-from ) id 1c5K0V-0004o2-V3; Fri, 11 Nov 2016 23:09:11 +0100 Date: Fri, 11 Nov 2016 23:09:11 +0100 From: Samuel Thibault To: Brian Candler Message-ID: <20161111220911.GC2417@var.home> References: <20161104111419.GG9817@stefanha-x1.localdomain> <20161106180401.GE27308@var.home> <20161107104245.GC5036@stefanha-x1.localdomain> <466003bb-a2c4-bb9b-7b0b-7b2d6dcb16d7@pobox.com> <20161109112724.GC4682@stefanha-x1.localdomain> <02eee090-b017-dd4e-e63c-814d3d7beb72@pobox.com> <20161111161705.GE2417@var.home> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 141.255.128.1 Subject: Re: [Qemu-devel] Crashing in tcp_close X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Hajnoczi , qemu-devel@nongnu.org, Jan Kiszka Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Brian Candler, on Fri 11 Nov 2016 20:53:12 +0000, wrote: > On 11/11/2016 16:17, Samuel Thibault wrote: > >Could you increase the value given to valgrind's --num-callers= so we > >can make sure the context of this call? > > OK: re-run with --num-callers=250. It took a few iterations, but I captured > it again. (I have grepped out all the "invalid file descriptor" lines). Thanks! > ==1217== Thread 1: > ==1217== Invalid read of size 4 > ==1217== at 0x550B5B: if_start (if.c:230) > ==1217== by 0x5550E2: slirp_pollfds_poll (slirp.c:770) > ==1217== by 0x5891EB: main_loop_wait (main-loop.c:508) > ==1217== by 0x2F4430: main_loop (vl.c:1908) > ==1217== by 0x2F4430: main (vl.c:4604) Ooh, I see. Now it's obvious, now that it's not coming from the tcb loop :) Could you try the attached patch? Samuel diff --git a/slirp/socket.c b/slirp/socket.c index 280050a..1a50d30 100644 --- a/slirp/socket.c +++ b/slirp/socket.c @@ -66,6 +66,13 @@ void sofree(struct socket *so) { Slirp *slirp = so->slirp; + struct mbuf *ifm; + + for (ifm = slirp->next_m; ifm; ifm = ifm->ifq_next) { + if (ifm->ifq_so == so) { + ifm->ifq_so = NULL; + } + } if (so->so_emu==EMU_RSH && so->extra) { sofree(so->extra);