From patchwork Sat Nov 12 10:44:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 9424051 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2BD9960476 for ; Sat, 12 Nov 2016 10:44:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20F202971C for ; Sat, 12 Nov 2016 10:44:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1567229789; Sat, 12 Nov 2016 10:44:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 88D662971C for ; Sat, 12 Nov 2016 10:44:36 +0000 (UTC) Received: from localhost ([::1]:57557 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c5VnX-0006kx-8s for patchwork-qemu-devel@patchwork.kernel.org; Sat, 12 Nov 2016 05:44:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c5VnG-0006kX-Vf for qemu-devel@nongnu.org; Sat, 12 Nov 2016 05:44:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c5VnG-0000Q3-7Q for qemu-devel@nongnu.org; Sat, 12 Nov 2016 05:44:19 -0500 Received: from hera.aquilenet.fr ([2a01:474::1]:40529) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c5VnG-0000Pp-15 for qemu-devel@nongnu.org; Sat, 12 Nov 2016 05:44:18 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id A7E0B9B61; Sat, 12 Nov 2016 11:44:16 +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 OydK_7HONoQ6; Sat, 12 Nov 2016 11:44:16 +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 237E6848F; Sat, 12 Nov 2016 11:44:16 +0100 (CET) Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.87) (envelope-from ) id 1c5VnD-0006JK-MP; Sat, 12 Nov 2016 11:44:15 +0100 Date: Sat, 12 Nov 2016 11:44:15 +0100 From: Samuel Thibault To: Brian Candler Message-ID: <20161112104415.GR2417@var.home> References: <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> <20161111220911.GC2417@var.home> <07abcfd1-cff0-015d-90fb-f992b7328547@pobox.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <07abcfd1-cff0-015d-90fb-f992b7328547@pobox.com> 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: 2a01:474::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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Hello, Brian Candler, on Sat 12 Nov 2016 09:33:55 +0000, wrote: > On 11/11/2016 22:09, Samuel Thibault wrote: > >Ooh, I see. Now it's obvious, now that it's not coming from the tcb > >loop:) Could you try the attached patch? > > It looks like it now goes into an infinite loop when a connection is closed. Oops, sorry, my patch was completely bogus, here is a proper one. Samuel diff --git a/slirp/socket.c b/slirp/socket.c index 280050a..6c18971 100644 --- a/slirp/socket.c +++ b/slirp/socket.c @@ -66,6 +66,23 @@ void sofree(struct socket *so) { Slirp *slirp = so->slirp; + struct mbuf *ifm; + + for (ifm = (struct mbuf *) slirp->if_fastq.qh_link; + (struct quehead *) ifm != &slirp->if_fastq; + ifm = ifm->ifq_next) { + if (ifm->ifq_so == so) { + ifm->ifq_so = NULL; + } + } + + for (ifm = (struct mbuf *) slirp->if_batchq.qh_link; + (struct quehead *) ifm != &slirp->if_batchq; + ifm = ifm->ifq_next) { + if (ifm->ifq_so == so) { + ifm->ifq_so = NULL; + } + } if (so->so_emu==EMU_RSH && so->extra) { sofree(so->extra);