From nobody Sun Sep 28 16:36:58 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1758028773; cv=none; d=zohomail.com; s=zohoarc; b=KFsUEADg4w2bq7Gi60IN1QS8QTz3OtIOtOlupXNgSCm3y2mvv1/bwA3Ij11vIh3JJhaVcn6OiFvJrUfiGqKA2TS8mimgVWHbrawLbNL3H/b1JjubzXTg9JEQzXxO56P47lHEVA2p0W2htrMFxjH9m1NfDdDIziJcSVl9og1JoQM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1758028773; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=MNlmMd6mGnz88Xb18uWmdi7nOu8lfIjb8YU+w/HXckE=; b=J2gZBif+R5ec6B/dbQNomZVEntdstN/ZG5v+F0kYwAOgZg+R7NHE+7sSxuBgovbv0UmppxZW8MJR4q4gzuhVdgckW/wgdbpXUtJambYGsUfFvYL3HfAtgtyxNbw/IZlcrqzD7lp9YgaMNxiRy/jpkdglXca1/MskRWSk8ShJGJo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1758028773847105.54008052893482; Tue, 16 Sep 2025 06:19:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uyVWq-0005rO-OU; Tue, 16 Sep 2025 09:15:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uyVWG-0005V1-Dh; Tue, 16 Sep 2025 09:14:53 -0400 Received: from forwardcorp1a.mail.yandex.net ([2a02:6b8:c0e:500:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uyVWA-0006a1-Pv; Tue, 16 Sep 2025 09:14:52 -0400 Received: from mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net [IPv6:2a02:6b8:c1f:3a87:0:640:845c:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id 83C7BC0262; Tue, 16 Sep 2025 16:14:19 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6bf:8080:16c::1:b]) by mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id 5EQRob1Gj0U0-NwCTS7A7; Tue, 16 Sep 2025 16:14:18 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1758028458; bh=MNlmMd6mGnz88Xb18uWmdi7nOu8lfIjb8YU+w/HXckE=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=C4Pkm9GbyomO+TvPVIXm0bFQn704a8w6AAlDpuOdeAEBn3aDDcz8/8hBZ3jdl/qTL qx7GNJX4yeuie6BOw5IM2aXnO+4aEMwPXvnIcZVAqXxlCu5U49NbxusR9glIk1OsFd 9e0zdgQMc0qT9qTjOC8iHV0gMOd2VH9r/8cNFEXA= Authentication-Results: mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: berrange@redhat.com Cc: qemu-devel@nongnu.org, peterx@redhat.com, qemu-block@nongnu.org, vsementsov@yandex-team.ru, leiyang@redhat.com, marcandre.lureau@redhat.com, Coiby Xu , "Michael S. Tsirkin" , Stefano Garzarella Subject: [PATCH v5 13/13] util/vhost-user-server: vu_message_read(): improve error handling Date: Tue, 16 Sep 2025 16:14:02 +0300 Message-ID: <20250916131403.368343-14-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250916131403.368343-1-vsementsov@yandex-team.ru> References: <20250916131403.368343-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a02:6b8:c0e:500:1:45:d181:df01; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1758028774461116600 Content-Type: text/plain; charset="utf-8" 1. Drop extra error_report_err(NULL), it will just crash, if we get here. 2. Get and report error of qemu_set_blocking(), instead of aborting. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Daniel P. Berrang=C3=A9 --- util/vhost-user-server.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/util/vhost-user-server.c b/util/vhost-user-server.c index 04c72a92aa..1dbe409f82 100644 --- a/util/vhost-user-server.c +++ b/util/vhost-user-server.c @@ -62,7 +62,7 @@ static void vmsg_close_fds(VhostUserMsg *vmsg) } } =20 -static void vmsg_unblock_fds(VhostUserMsg *vmsg) +static bool vmsg_unblock_fds(VhostUserMsg *vmsg, Error **errp) { int i; =20 @@ -74,13 +74,16 @@ static void vmsg_unblock_fds(VhostUserMsg *vmsg) */ if (vmsg->request =3D=3D VHOST_USER_ADD_MEM_REG || vmsg->request =3D=3D VHOST_USER_SET_MEM_TABLE) { - return; + return true; } =20 for (i =3D 0; i < vmsg->fd_num; i++) { - /* TODO: handle error more gracefully than aborting */ - qemu_set_blocking(vmsg->fds[i], false, &error_abort); + if (!qemu_set_blocking(vmsg->fds[i], false, errp)) { + return false; + } } + + return true; } =20 static void panic_cb(VuDev *vu_dev, const char *buf) @@ -123,7 +126,6 @@ vu_message_read(VuDev *vu_dev, int conn_fd, VhostUserMs= g *vmsg) =20 vmsg->fd_num =3D 0; if (!ioc) { - error_report_err(local_err); goto fail; } =20 @@ -177,7 +179,10 @@ vu_message_read(VuDev *vu_dev, int conn_fd, VhostUserM= sg *vmsg) } while (read_bytes !=3D VHOST_USER_HDR_SIZE); =20 /* qio_channel_readv_full will make socket fds blocking, unblock them = */ - vmsg_unblock_fds(vmsg); + if (!vmsg_unblock_fds(vmsg, &local_err)) { + error_report_err(local_err); + goto fail; + } if (vmsg->size > sizeof(vmsg->payload)) { error_report("Error: too big message request: %d, " "size: vmsg->size: %u, " --=20 2.48.1