Received: from eggs.gnu.org ([2001:4830:134:3::10]:42151) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bb4p3-0000v2-9i for qemu-devel@nongnu.org; Sat, 20 Aug 2016 07:52:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bb4oz-0004OJ-9G for qemu-devel@nongnu.org; Sat, 20 Aug 2016 07:52:20 -0400 Received: from hera.aquilenet.fr ([2a01:474::1]:51409) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bb4oz-0004OF-2V for qemu-devel@nongnu.org; Sat, 20 Aug 2016 07:52:17 -0400 Date: Sat, 20 Aug 2016 13:52:10 +0200 From: Samuel Thibault Message-ID: <20160820115210.GJ4252@var.home> References: <20160818134405.26424-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20160818134405.26424-1-marcandre.lureau@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] slirp: fix segv when init failed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?Marc-Andr=E9?= Lureau Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, jasowang@redhat.com Marc-Andr=E9 Lureau, on Thu 18 Aug 2016 17:44:05 +0400, wrote: > Since commit f6c2e66ae8c8a, slirp uses an exit notifier to call > slirp_smb_cleanup. However, if init() failed, the notifier isn't added, > and removing it will fail: >=20 > =3D=3D18447=3D=3D Invalid write of size 8 > =3D=3D18447=3D=3D at 0x7EF2B5: notifier_remove (notify.c:32) > =3D=3D18447=3D=3D by 0x48E80C: qemu_remove_exit_notifier (vl.c:2661) > =3D=3D18447=3D=3D by 0x6A2187: net_slirp_cleanup (slirp.c:134) > =3D=3D18447=3D=3D by 0x69419D: qemu_cleanup_net_client (net.c:338) > =3D=3D18447=3D=3D by 0x69445B: qemu_del_net_client (net.c:401) > =3D=3D18447=3D=3D by 0x6A2B81: net_slirp_init (slirp.c:366) > =3D=3D18447=3D=3D by 0x6A4241: net_init_slirp (slirp.c:865) > =3D=3D18447=3D=3D by 0x695C6D: net_client_init1 (net.c:1051) > =3D=3D18447=3D=3D by 0x695F6E: net_client_init (net.c:1108) > =3D=3D18447=3D=3D by 0x696DBA: net_init_netdev (net.c:1498) > =3D=3D18447=3D=3D by 0x7F1F99: qemu_opts_foreach (qemu-option.c:1116= ) > =3D=3D18447=3D=3D by 0x696E60: net_init_clients (net.c:1516) > =3D=3D18447=3D=3D Address 0x0 is not stack'd, malloc'd or (recently) f= ree'd >=20 > Signed-off-by: Marc-Andr=E9 Lureau Reviewed-by: Samuel Thibault > --- > net/slirp.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) >=20 > diff --git a/net/slirp.c b/net/slirp.c > index facc30e..b60893f 100644 > --- a/net/slirp.c > +++ b/net/slirp.c > @@ -131,7 +131,9 @@ static void net_slirp_cleanup(NetClientState *nc) > SlirpState *s =3D DO_UPCAST(SlirpState, nc, nc); > =20 > slirp_cleanup(s->slirp); > - qemu_remove_exit_notifier(&s->exit_notifier); > + if (s->exit_notifier.notify) { > + qemu_remove_exit_notifier(&s->exit_notifier); > + } > slirp_smb_cleanup(s); > QTAILQ_REMOVE(&slirp_stacks, s, entry); > } > --=20 > 2.9.0 >=20 >=20 --=20 Samuel bon comment on fait de l'investigation pour savoir qui est le vilain = ? on d=E9branche le routeur et on regarde qui s'affole -+- #ens-mim administre -+-