From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 645B1C982C1 for ; Tue, 15 Sep 2026 18:39:34 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6Y3J-0007Lk-C7; Tue, 15 Sep 2026 14:38:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x6Y3E-0007LI-Ku for qemu-devel@nongnu.org; Tue, 15 Sep 2026 14:38:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x6Y38-0007Af-RO for qemu-devel@nongnu.org; Tue, 15 Sep 2026 14:38:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1789497511; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=g0jUHv4b9L3ZyKYFS8lZzngacUCfFmt2CprEAlRhAL4=; b=FyRTdj/kUG7MfGXdy0yLGfsIEp5YpwFG5P7DfuyCeSi/FnGjIUKNvNUVhRATD5XzU5avvf PJveqyR2Mi59/G1oMq3rgVEJzLcDp95DpsrVJHcJfT/3wt8S4RUVhpZlQdgKLzcMQlk1Jy lKHk87G4XCHMFuG/iBOVLF/Nv47w9Ao= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-257-gaIPfJfKNo29wmMhkvGlew-1; Tue, 15 Sep 2026 14:38:29 -0400 X-MC-Unique: gaIPfJfKNo29wmMhkvGlew-1 X-Mimecast-MFC-AGG-ID: gaIPfJfKNo29wmMhkvGlew_1789497508 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 95FF71953996; Tue, 15 Sep 2026 18:38:28 +0000 (UTC) Received: from localhost (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D91B0418; Tue, 15 Sep 2026 18:38:27 +0000 (UTC) Date: Tue, 15 Sep 2026 14:35:38 -0400 From: Stefan Hajnoczi To: =?utf-8?B?0J3QuNC60L7Qu9Cw0Lkg0JfQvtGA0LjQvQ==?= Cc: qemu-devel@nongnu.org, kwolf@redhat.com, mst@redhat.com Subject: Re: [PATCH] util/vhost-user-server: fix potential NULL dereference in vu_message_read Message-ID: <20260915183538.GA105129@fedora> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="aE4Sj7kQSHR7K1r4" Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 Received-SPF: pass client-ip=170.10.129.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org --aE4Sj7kQSHR7K1r4 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 15, 2026 at 04:02:31PM +0300, =D0=9D=D0=B8=D0=BA=D0=BE=D0=BB=D0= =B0=D0=B9 =D0=97=D0=BE=D1=80=D0=B8=D0=BD wrote: > The `vu_message_read()` function initializes `local_err` to `NULL`. > If `server->ioc` is `NULL`, the execution jumps to the `if (!ioc)` > branch and invokes `error_report_err(local_err)`. >=20 > Passing a guaranteed `NULL` pointer to `error_report_err()` leads > to a crash because `error_get_pretty(err)` will attempt to dereference > `err->msg`, triggering a Segmentation Fault (`SIGSEGV`). >=20 > Since `server->ioc` shouldn't be `NULL` during an active coroutine > execution, this error block is effectively dead code, but it represents > a dangerous pattern left over from copy-pasting or incomplete refactoring. >=20 > Fix this by removing the incorrect `error_report_err(local_err)` call > inside the `if (!ioc)` block. The `local_err` variable itself is preserved > as it is used later in the function for actual I/O error handling. >=20 > Signed-off-by: Nikolay N Zorin > --- > =C2=A0util/vhost-user-server.c | 1 - > =C2=A01 file changed, 1 deletion(-) This was fixed by commit 34523df31962 ("util/vhost-user-server: vu_message_read(): improve error handling") and is no longer present in qemu.git/master. Please check against qemu.git/master to avoid duplicating work. Thanks, Stefan >=20 > diff --git a/util/vhost-user-server.c b/util/vhost-user-server.c > index f30f6b3e..a4b2c1d0 100644 > --- a/util/vhost-user-server.c > +++ b/util/vhost-user-server.c > @@ -15,7 +15,6 @@ static bool coroutine_fn vu_message_read(VuDev *vu_dev, > int conn_fd, VhostUserMs >=20 > =C2=A0 =C2=A0 =C2=A0vmsg->fd_num =3D 0; > =C2=A0 =C2=A0 =C2=A0if (!ioc) { > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 error_report_err(local_err); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto fail; > =C2=A0 =C2=A0 =C2=A0} >=20 > --=20 > 2.43.0 >=20 --aE4Sj7kQSHR7K1r4 Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmqpj/oACgkQnKSrs4Gr c8gU0Qf/XhsF96bpiW0RYF9pS3jYakB10MEEmRmW/xWaOhnsoKKLqT+ygku3/H9V /agkMqZdyhKbaSJ6kgKXasdbLRSLFGcZQkHUOrzYOw0RjxruwcIL0DD4f04Xkyn/ c/ZF8RMWHPXQqUWQ5kLG/JqNycawsSCfb2vpfrl2vs6QDUeiD99Easra6j8I0DBb eDLkgqeA3tn1Ub0Q0kX6KBcxuKfnU8mNHLsnBMqBsNxlRCT7OflWKLo2A19R8gQr 46cTopXtWgNbdqwe5PnPJqH6KQT1BeFuN+JNcaU3O4Gfh+1YFYluSbdXDm2zJMJq BXjN7sa2fkZu+DcinG/7brF+r79Udg== =Z2BN -----END PGP SIGNATURE----- --aE4Sj7kQSHR7K1r4--