From nobody Thu Nov 12 15:08:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1793389233; cv=none; d=zohomail.com; s=zohoarc; b=XUT4zjsGn4XisVOhTapAxFfR/+Bwm0bm2UXQmggN90rRvtIznWZwKWrGdVXN9qAgYGpSYz6IAURMrLLRxrgBEVOqJxb1Y2vcfXS+0YcdWtR253mqP6R8AJsdekuQKDkEOu31mLtPcgd/NPfzM1rnDliW2XmlYQfw5Kga8hSNqP0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793389233; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id; bh=ZdpktEchiARfY2rBuTFn1FEwz2eIdtaQitw1/wylWb0=; b=JXsztavScQMeR6taIzHfmp6TF9jAEP8t56/NFrDxVITX92FbsCx8/YBs7AuyAbYQwCUBdy/kunmMVWjGyg9hQ6qBFsseO4ntrAI8vWFcsUWGloiHuqGHRb+maYCOX/wV7+iX4G4lbQ2U7Cd8L5Q/k2c0XeFFsXVoq5n/rpLPaW0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1793389232973296.6556413324987; Fri, 30 Oct 2026 12:40:32 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id A85CB41B02; Fri, 30 Oct 2026 15:40:31 -0400 (EDT) Received: from [172.19.199.19] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 46A9D41D37; Fri, 30 Oct 2026 15:36:15 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 04A6441C84; Fri, 30 Oct 2026 15:36:06 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 40AF23F35B for ; Fri, 30 Oct 2026 15:34:54 -0400 (EDT) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-360-fDh9YkIcOK-jgkd0jQ6SvA-1; Fri, 30 Oct 2026 15:34:44 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DE650180056E; Fri, 30 Oct 2026 19:34:41 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F3B3630002C9; Fri, 30 Oct 2026 19:34:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793388894; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZdpktEchiARfY2rBuTFn1FEwz2eIdtaQitw1/wylWb0=; b=RX7t3Rr3JXvAYlUFIeCr+0yWxXMNjvVD8HC2U4xExspWekXucc+zFYgdeFcJ8dD/U8Wvyg PLBezOGJSDFl6998ZWm9sDoXQrDeDyf6EQNNCeGQVoSFj+quF6pbxDCPwE4jl+aCmguki1 pg0Soa2K4kD2vImbuTFs2UfJ2GHvd7E= X-MC-Unique: fDh9YkIcOK-jgkd0jQ6SvA-1 X-Mimecast-MFC-AGG-ID: fDh9YkIcOK-jgkd0jQ6SvA_1793388882 To: qemu-devel@nongnu.org Subject: [PULL 1/5] qed: fix incorrect denominator in qed_bytes_to_clusters() (CVE-2026-118594) Date: Fri, 30 Oct 2026 15:34:12 -0400 Message-ID: <20261030193416.1691807-2-stefanha@redhat.com> In-Reply-To: <20261030193416.1691807-1-stefanha@redhat.com> References: <20261030193416.1691807-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-MFC-PROC-ID: pMbg8Q13gkSbvzYBOt1HshHT8k6p77Cua4VU3dpqjyo_1793388882 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: O4KPKZIB7MRPHPC34LRJCK774PH7W2IC X-Message-ID-Hash: O4KPKZIB7MRPHPC34LRJCK774PH7W2IC X-MailFrom: stefanha@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: qemu-block@nongnu.org, Fabiano Rosas , Zhao Liu , Kevin Wolf , Richard Henderson , "Michael S. Tsirkin" , Laurent Vivier , Fam Zheng , devel@lists.libvirt.org, "Denis V. Lunev" , Paolo Bonzini , Hanna Reitz , Stefan Hajnoczi , Pierrick Bouvier , John Snow , oxsignal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Stefan Hajnoczi via Devel Reply-To: Stefan Hajnoczi X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1793389235772158500 cluster_size - 1 is often used in bitwise mask operations in qed.h, so this bug is probably a copy-paste error. qed_bytes_to_clusters() uses a division and the denominator should be the full cluster_size value. This bug can be used to leak heap memory to the guest with a QED file where cluster_size <=3D 32 KB (the default is 64 KB) and table_size =3D 8 or 16 (the default is 4). Fixes: CVE-2026-118594 Fixes: 298800cae72e ("qed: Table, L2 cache, and cluster functions") Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4737 Reported-by: oxsignal Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Stefan Hajnoczi --- block/qed.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/qed.h b/block/qed.h index 26d4bf038c7..04bcd7ac4fa 100644 --- a/block/qed.h +++ b/block/qed.h @@ -253,7 +253,7 @@ static inline uint64_t qed_offset_into_cluster(BDRVQEDS= tate *s, uint64_t offset) static inline uint64_t qed_bytes_to_clusters(BDRVQEDState *s, uint64_t byt= es) { return qed_start_of_cluster(s, bytes + (s->header.cluster_size - 1)) / - (s->header.cluster_size - 1); + s->header.cluster_size; } =20 static inline unsigned int qed_l1_index(BDRVQEDState *s, uint64_t pos) --=20 2.56.0 From nobody Thu Nov 12 15:08:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1793389145; cv=none; d=zohomail.com; s=zohoarc; b=Fvm/pZCFmUXS4206w8vuywSOf/wVIxl5ov41L7lQ+FMshy2XA4sHxUYmuyi8AIe+q2krQgUIESF1jDsfIUr+jq4Ikpe5gcrAO0HbArSxpQXpN5js5EzKWmDxzKKgfbDVL4uaJ9SE1ulRpQoDyMy4CjjEPxVJyQl5v0msVQVEfd8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793389145; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id; bh=fbqAxd07L8SqmsCj8QK1ulNU218X8efn4pp7MZpWCN8=; b=NsBrni4un7L/tqu1yizbO70R2NYoXLVt7Hfsh2P/cVDNXaHXrRzTWBX2KPgVmrTlZ1VBsThH6ubjopMSom8RKLuuKG4XWduDQi4Wtc4diUyxMyeNUY5sSDmatrzc89KInPAoWbYmGqu/d3JZRSQCpUmG0rUnYBmRVEEsMmzaYL4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1793389144992697.7028539287938; Fri, 30 Oct 2026 12:39:04 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 7BAF341B6B; Fri, 30 Oct 2026 15:39:02 -0400 (EDT) Received: from [172.19.199.19] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id BF38641CC4; Fri, 30 Oct 2026 15:36:04 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 571DB41B54; Fri, 30 Oct 2026 15:35:54 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 50A3B41BEA for ; Fri, 30 Oct 2026 15:34:53 -0400 (EDT) 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-464-WFrX0WNRM9e_9kYJwZ9PEA-1; Fri, 30 Oct 2026 15:34:48 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 5E7931954190; Fri, 30 Oct 2026 19:34:44 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F13A21956086; Fri, 30 Oct 2026 19:34:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793388893; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fbqAxd07L8SqmsCj8QK1ulNU218X8efn4pp7MZpWCN8=; b=S9bsQ76lPHJKmC0pbLDaojgEYducgxkEiZzFDWZm0BpIcJEXWZJZQ7oL5i96Hm/TjzwzIV +aGOgsVerCKO/98hEClY1Ws28vicZUEzSPMrraU/QbWR/R1ZYonZ3aumdjk4pr0LwInBkW vnTqnYRD2IRbRPZClOjEwcIcmbPwV9o= X-MC-Unique: WFrX0WNRM9e_9kYJwZ9PEA-1 X-Mimecast-MFC-AGG-ID: WFrX0WNRM9e_9kYJwZ9PEA_1793388884 To: qemu-devel@nongnu.org Subject: [PULL 2/5] virtio-blk: Implement full NUL padding for GET_ID Date: Fri, 30 Oct 2026 15:34:13 -0400 Message-ID: <20261030193416.1691807-3-stefanha@redhat.com> In-Reply-To: <20261030193416.1691807-1-stefanha@redhat.com> References: <20261030193416.1691807-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-MFC-PROC-ID: ofmOyphXQ1LpBJb0-8bgkU260t1rJaAtylfizzbQnAw_1793388884 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: OPMNOFDP2C2G6AVBENFNPNRFLRWXZGKB X-Message-ID-Hash: OPMNOFDP2C2G6AVBENFNPNRFLRWXZGKB X-MailFrom: stefanha@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: qemu-block@nongnu.org, Fabiano Rosas , Zhao Liu , Kevin Wolf , Richard Henderson , "Michael S. Tsirkin" , Laurent Vivier , Fam Zheng , devel@lists.libvirt.org, "Denis V. Lunev" , Paolo Bonzini , Hanna Reitz , Stefan Hajnoczi , Pierrick Bouvier , John Snow X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Stefan Hajnoczi via Devel Reply-To: Stefan Hajnoczi X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1793389152235154100 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kevin Wolf The spec requires not only NUL termination of the device ID string, but NUL padding: VIRTIO_BLK_T_GET_ID requests fetch the device ID string from the device into data. The device ID string is a NUL-padded ASCII string up to 20 bytes long. If the string is 20 bytes long then there is no NUL terminator. Zero out all of the remaining bytes in the request buffer. Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi Message-ID: <20261029231001.194240-2-kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi --- hw/block/virtio-blk.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 536d71a91ad..3f236f22d57 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -1011,14 +1011,18 @@ static int virtio_blk_handle_request(VirtIOBlockReq= *req, MultiReqBuffer *mrb) case VIRTIO_BLK_T_GET_ID: { /* - * NB: per existing s/n string convention the string is + * The spec requires NUL-padding for the output. The string is * terminated by '\0' only when shorter than buffer. */ const char *serial =3D s->conf.serial ? s->conf.serial : ""; - size_t size =3D MIN(strlen(serial) + 1, - MIN(iov_size(in_iov, in_num), - VIRTIO_BLK_ID_BYTES)); + size_t req_size =3D MIN(iov_size(in_iov, in_num), VIRTIO_BLK_ID_BY= TES); + size_t size =3D MIN(strlen(serial), req_size); + size_t padding =3D req_size - size; + iov_from_buf(in_iov, in_num, 0, serial, size); + if (padding) { + iov_memset(in_iov, in_num, size, 0, padding); + } virtio_blk_req_complete(req, VIRTIO_BLK_S_OK); g_free(req); break; --=20 2.56.0 From nobody Thu Nov 12 15:08:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1793389353; cv=none; d=zohomail.com; s=zohoarc; b=cj28dsEftinwp8JXTkfcLBKdju0wUBCY8d4Q/0eIrwwV8NRNWgWCJdMfxPpIf/06E7JnkHkIQtoZUAWkZprK5nEvZxTm4rSqvkPOhFF8cq1yM5/yw7+X2m4q1PHZLtHv6AC8cFBQZZnxfkOZYIpj9QHkT6cF4APdHbdb1MgvfFI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793389353; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id; bh=VvKRH1G0+rxTP+DfgmOzHVSelDkl5uSl8bUmmzz37pk=; b=F3qnm253JSnAcQ/7WXnUYhr8aPnCX7wnSyZa95z8sDHDEOATxrQ5KHD1i4qPOMIjdXxfye32Ip6xvkqOc/PnczAmzGr1f4Him15/xTKogoLZmel37IM5F0U0Iu4zU0XuUf9QE/f+ALznsJaZNBNCwwHSJSMbA1QJRg4TX8WOK8g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1793389353182913.5126365358306; Fri, 30 Oct 2026 12:42:33 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id D516A41B63; Fri, 30 Oct 2026 15:42:31 -0400 (EDT) Received: from [172.19.199.19] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 65DE641DC2; Fri, 30 Oct 2026 15:36:58 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id AE65541A3B; Fri, 30 Oct 2026 15:36:43 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 4E67641BF0 for ; Fri, 30 Oct 2026 15:34:56 -0400 (EDT) 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-413-LMcsRVDqNXuvi_cd0W7Lqg-1; Fri, 30 Oct 2026 15:34:48 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 58F3219541A2; Fri, 30 Oct 2026 19:34:46 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3050F1956088; Fri, 30 Oct 2026 19:34:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793388895; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VvKRH1G0+rxTP+DfgmOzHVSelDkl5uSl8bUmmzz37pk=; b=bWA+MYaXCuTxXZlnOLrf9Tcmhd3If66eVoOf9diq1TlL3KWhJQzd8GVjPnOphNnmh7ZDFU 5NW0VCIHJNOlfnZtUWkfAEJpkhwGUbMO06MZyAhnoydB8LHKgxRYvw3lwt4lc5wWpJYVAV sQ0bQM+TN8IKDTMmrzSfsV2owrUTbMQ= X-MC-Unique: LMcsRVDqNXuvi_cd0W7Lqg-1 X-Mimecast-MFC-AGG-ID: LMcsRVDqNXuvi_cd0W7Lqg_1793388886 To: qemu-devel@nongnu.org Subject: [PULL 3/5] virtio-blk-test: Add a basic GET_ID test case Date: Fri, 30 Oct 2026 15:34:14 -0400 Message-ID: <20261030193416.1691807-4-stefanha@redhat.com> In-Reply-To: <20261030193416.1691807-1-stefanha@redhat.com> References: <20261030193416.1691807-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-MFC-PROC-ID: XTaoTQnMAD3lH52pUmCi_J7daXOie3HUnWmO2yEHtYc_1793388886 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: NFTST24ICVS3PKAMSVLY26G4D7RGKTPP X-Message-ID-Hash: NFTST24ICVS3PKAMSVLY26G4D7RGKTPP X-MailFrom: stefanha@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: qemu-block@nongnu.org, Fabiano Rosas , Zhao Liu , Kevin Wolf , Richard Henderson , "Michael S. Tsirkin" , Laurent Vivier , Fam Zheng , devel@lists.libvirt.org, "Denis V. Lunev" , Paolo Bonzini , Hanna Reitz , Stefan Hajnoczi , Pierrick Bouvier , John Snow X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Stefan Hajnoczi via Devel Reply-To: Stefan Hajnoczi X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1793389353771158500 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kevin Wolf This covers the simple common case with no surprises: A serial that is shorter than 20 characters and can fit in the request buffer. Signed-off-by: Kevin Wolf Message-ID: <20261029231001.194240-3-kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi --- tests/qtest/virtio-blk-test.c | 96 +++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/tests/qtest/virtio-blk-test.c b/tests/qtest/virtio-blk-test.c index 98c906ebb4a..825ea261bed 100644 --- a/tests/qtest/virtio-blk-test.c +++ b/tests/qtest/virtio-blk-test.c @@ -95,6 +95,8 @@ static uint64_t virtio_blk_request(QGuestAllocator *alloc= , QVirtioDevice *d, g_assert_cmpuint(data_size % sizeof(struct virtio_blk_discard_write_zeroes), = =3D=3D, 0); break; + case VIRTIO_BLK_T_GET_ID: + break; default: g_assert_cmpuint(data_size, =3D=3D, 0); } @@ -771,6 +773,91 @@ static void resize(void *obj, void *data, QGuestAlloca= tor *t_alloc) =20 } =20 +static QVirtQueue *get_id_setup(QVirtioDevice *dev, QGuestAllocator *t_all= oc) +{ + QVirtQueue *vq; + uint64_t features =3D qvirtio_get_features(dev); + + features =3D features & (1ull << VIRTIO_F_VERSION_1); + qvirtio_set_features(dev, features); + + vq =3D qvirtqueue_setup(dev, t_alloc, 0); + qvirtio_set_driver_ok(dev); + return vq; +} + +static uint8_t get_id_request(QVirtioDevice *dev, QVirtQueue *vq, + char *buf, size_t buf_len, + char pattern_byte, + QGuestAllocator *t_alloc) +{ + QTestState *qts =3D global_qtest; + uint64_t req_addr; + uint32_t free_head; + uint8_t status; + + QVirtioBlkReq req =3D { + .type =3D VIRTIO_BLK_T_GET_ID, + .data =3D buf, + }; + + req_addr =3D virtio_blk_request(t_alloc, dev, &req, buf_len); + + memset(req.data, pattern_byte, buf_len); + memwrite(req_addr + 16, req.data, buf_len); + + free_head =3D qvirtqueue_add(qts, vq, req_addr, 16, false, true); + qvirtqueue_add(qts, vq, req_addr + 16, buf_len, true, true); + qvirtqueue_add(qts, vq, req_addr + 16 + buf_len, 1, true, false); + + qvirtqueue_kick(qts, dev, vq, free_head); + + qvirtio_wait_used_elem(qts, dev, vq, free_head, NULL, + QVIRTIO_BLK_TIMEOUT_US); + status =3D readb(req_addr + 16 + buf_len); + memread(req_addr + 16, buf, buf_len); + + guest_free(t_alloc, req_addr); + + return status; +} + +static void get_id_serial_short(void *obj, void *data, QGuestAllocator *t_= alloc) +{ + QVirtioBlk *blk_if =3D obj; + QVirtioDevice *dev =3D blk_if->vdev; + QVirtQueue *vq; + uint8_t status; + const char expected[20] =3D "abc"; + char buf[20]; + + vq =3D get_id_setup(dev, t_alloc); + status =3D get_id_request(dev, vq, buf, 20, 0xa5, t_alloc); + g_assert_cmpint(status, =3D=3D, 0); + g_assert_cmpmem(buf, 20, expected, sizeof(expected)); + + qvirtqueue_cleanup(blk_if->vdev->bus, vq, t_alloc); +} + +static void get_id_serial_short_20_characters(void *obj, void *data, + QGuestAllocator *t_alloc) +{ + QVirtioBlk *blk_if =3D obj; + QVirtioDevice *dev =3D blk_if->vdev; + QVirtQueue *vq; + uint8_t status; + /* Edge case of a serial with exactly 20 characters: No NUL terminatio= n */ + const char expected[25] =3D "01234567890123456789\xa5\xa5\xa5\xa5\xa5"; + char buf[25]; + + vq =3D get_id_setup(dev, t_alloc); + status =3D get_id_request(dev, vq, buf, 25, 0xa5, t_alloc); + g_assert_cmpint(status, =3D=3D, 0); + g_assert_cmpmem(buf, 25, expected, sizeof(expected)); + + qvirtqueue_cleanup(blk_if->vdev->bus, vq, t_alloc); +} + static void *virtio_blk_test_setup(GString *cmd_line, void *arg) { char *tmp_path =3D drive_create(); @@ -802,6 +889,15 @@ static void register_virtio_blk_test(void) qos_add_test("nxvirtq", "virtio-blk-pci", test_nonexistent_virtqueue, &opts); qos_add_test("hotplug", "virtio-blk-pci", pci_hotplug, &opts); + + /* serial number tests */ + opts.edge.extra_device_opts =3D "serial=3Dabc"; + qos_add_test("get_id/serial_short", "virtio-blk", + get_id_serial_short, &opts); + + opts.edge.extra_device_opts =3D "serial=3D01234567890123456789"; + qos_add_test("get_id/serial_short_20_characters", "virtio-blk", + get_id_serial_short_20_characters, &opts); } =20 libqos_init(register_virtio_blk_test); --=20 2.56.0 From nobody Thu Nov 12 15:08:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1793389411; cv=none; d=zohomail.com; s=zohoarc; b=YV2PBNsJuXWkYzCWd+5G77A72oWg2GJioUdANd5lCYn6GolStezgcJ/KgB0TnMtL9cBP5rfT13oaif5FwEd0Tx4bPyrqWHCmLdQ8CqAwSi3M2LsFRxTREz/jmO9JGcEPqhOJnmjyvjzr8ivGpU8dI5dZRNuhPeI+prEPLy5Qo2o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793389411; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id; bh=XLGA493Vj9xh8BrJe/Qqc+qXudIfkdp9yKAHfyhO/UY=; b=gRlLC72npQpQp9+JxY55l6jHj9T7jXCMSaqvJsXbQwfUK5T2oZpSXcY//4iJMXRC0Dk6J/AFwAohELJw1PnlwLVPNXZ+r2MuZTECTO5WYp3sYbojPnxZSHk3picbKJqWRZF5zguyIVS53jw++Fr4GsfELR98y7YhOhCRFSB0YOA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1793389411379244.44394244419095; Fri, 30 Oct 2026 12:43:31 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 0CA3641B6E; Fri, 30 Oct 2026 15:43:29 -0400 (EDT) Received: from [172.19.199.19] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 2E30341E1A; Fri, 30 Oct 2026 15:37:09 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 3FFE841DDA; Fri, 30 Oct 2026 15:36:59 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 9554A4182E for ; Fri, 30 Oct 2026 15:34:57 -0400 (EDT) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-130-h8Z0FjoNPiu73h0N_fNJIg-1; Fri, 30 Oct 2026 15:34:52 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E65821800616; Fri, 30 Oct 2026 19:34:47 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 51EE218001CA; Fri, 30 Oct 2026 19:34:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793388897; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XLGA493Vj9xh8BrJe/Qqc+qXudIfkdp9yKAHfyhO/UY=; b=HL+8LeInyMS5dbLSkDOdLGjWuAxLaPM1Cvb9iiyaanUh9he8spHEXD4IPjUbtOjOYXvVzX lO1R7REiuQz3IrpfH7Oryi5R6eCEYVNuRg/wMiodO+1xoosi2eaAUlWGXMY0nB/nGq21HQ loIxEsEMn/eqaGqxArX4Hl2HdWSxfIs= X-MC-Unique: h8Z0FjoNPiu73h0N_fNJIg-1 X-Mimecast-MFC-AGG-ID: h8Z0FjoNPiu73h0N_fNJIg_1793388888 To: qemu-devel@nongnu.org Subject: [PULL 4/5] virtio-blk: Deprecate silent truncation of serial Date: Fri, 30 Oct 2026 15:34:15 -0400 Message-ID: <20261030193416.1691807-5-stefanha@redhat.com> In-Reply-To: <20261030193416.1691807-1-stefanha@redhat.com> References: <20261030193416.1691807-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-MFC-PROC-ID: PhTzCxuXhOfaWhmf65XlDFHYUB_cKwz9clGJA4CzuBY_1793388888 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: HWVMLFJJYBYHDZK2PW6WX3C65JTWPZPO X-Message-ID-Hash: HWVMLFJJYBYHDZK2PW6WX3C65JTWPZPO X-MailFrom: stefanha@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: qemu-block@nongnu.org, Fabiano Rosas , Zhao Liu , Kevin Wolf , Richard Henderson , "Michael S. Tsirkin" , Laurent Vivier , Fam Zheng , devel@lists.libvirt.org, "Denis V. Lunev" , Paolo Bonzini , Hanna Reitz , Stefan Hajnoczi , Pierrick Bouvier , John Snow X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Stefan Hajnoczi via Devel Reply-To: Stefan Hajnoczi X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1793389414199154100 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kevin Wolf Commit a8686a9b, which made serial a qdev property instead of relying on -drive options, accidentally allowed specifying serial strings of arbitraty length while the virtio-blk protocol can only communicate 20 characters to the guest. This means that a longer serial number on the command line is silently truncated to 20 characters from the guest perspective. This is obviously bad behaviour. People are specifying longer serials in practice and guests will see something different than what was configured. Instead of silent truncation, this should be an error. Deprecate the silent truncation for now as a first step towards making it an error later. Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi Message-ID: <20261029231001.194240-4-kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi --- docs/about/deprecated.rst | 13 +++++++++++++ hw/block/virtio-blk.c | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index dab47b6ca38..0891bbc44de 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -362,6 +362,19 @@ the addition of volatile memory support, it is now nec= essary to distinguish between persistent and volatile memory backends. As such, memdev is depre= cated in favor of persistent-memdev. =20 +``-device virtio-blk,serial=3Dmore_than_20_characters`` (since 11.2) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The ``virtio-blk`` device has a limitation of 20 characters for the serial +string. Accidentally, QEMU started accepting longer strings on the command= line +in version 0.15.0, but it was still silently truncated to 20 characters for +guests. + +Specifying a longer serial than can be exposed to the guest is a configura= tion +error and deprecated; it will become a hard error in later versions. If the +truncation is intentional, explicitly specify the serial already in trunca= ted +form on the command line instead. + Block device options '''''''''''''''''''' =20 diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 3f236f22d57..eeeb405127c 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -1849,6 +1849,12 @@ static void virtio_blk_device_realize(DeviceState *d= ev, Error **errp) return; } =20 + if (conf->serial && strlen(conf->serial) > VIRTIO_BLK_ID_BYTES) { + warn_report("serial is longer than %d characters and will be trunc= ated " + "for the guest. This configuration is deprecated.", + VIRTIO_BLK_ID_BYTES); + } + if (!blkconf_apply_backend_options(&conf->conf, !blk_supports_write_perm(conf->conf= .blk), true, errp)) { --=20 2.56.0 From nobody Thu Nov 12 15:08:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1793389464; cv=none; d=zohomail.com; s=zohoarc; b=leRjA+yJT/E2FY2ySV5na73zKYBLucZSA86VaQs6HpAQFHZZoA19AkgwEEJolD40C5VHp9rR+POM/Vu/PxREEDKkfPm+pjPe6kyhwOAyfnkVfcKXXxkLBDHYHZGIep5fTnTcjb7cfTqndDvs7wJDahQk7veQtwYiCCKAAGzCTRI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793389464; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id; bh=0+7UvJTxWmf/PeFHP2HIInprW3+xR9CGmrDUeTnMQYc=; b=i+CRr7sgWC5PlpRHH10owr4tWjVLXXufCrawz9b/Ld6v5KAVPCQ232WjQzoNXz80SnZPx37nl8fgoWlxjixoTFRatJxM4xQTMhjycE2zxyDvDYUVnNXsmSKSAPBYsYiPJL22EZ5KvRJf/51zvxSBLareaj2XHOFhiF11QR8KTuI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1793389464719746.2698115548528; Fri, 30 Oct 2026 12:44:24 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 8195B41BB8; Fri, 30 Oct 2026 15:44:23 -0400 (EDT) Received: from [172.19.199.19] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 3D103423D8; Fri, 30 Oct 2026 15:37:15 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 847BB41ADA; Fri, 30 Oct 2026 15:36:59 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id D30AA41B9C for ; Fri, 30 Oct 2026 15:35:04 -0400 (EDT) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-352-RONa20WUM3O9DTz_7_qK4g-1; Fri, 30 Oct 2026 15:34:54 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E6FC718011CD; Fri, 30 Oct 2026 19:34:50 +0000 (UTC) Received: from localhost (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 999571956087; Fri, 30 Oct 2026 19:34:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793388904; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0+7UvJTxWmf/PeFHP2HIInprW3+xR9CGmrDUeTnMQYc=; b=fxMqiH9kVlZ14vS2Ow8a5oaU7d9UcSSlYzeKpCe+J60TacU8S+kK1RX/P37pz6l/KMIb6g LB9nfNoaiAuY+mrLQlduGOOWEFy4hmWX4PO3Cg3/IwB5M9TPbC5y6ac38y1BZIwYyO641y RF+R4hcAWW4FjyydDwoqg7xtlTntwlE= X-MC-Unique: RONa20WUM3O9DTz_7_qK4g-1 X-Mimecast-MFC-AGG-ID: RONa20WUM3O9DTz_7_qK4g_1793388891 To: qemu-devel@nongnu.org Subject: [PULL 5/5] virtio-blk-test: Test truncated serial Date: Fri, 30 Oct 2026 15:34:16 -0400 Message-ID: <20261030193416.1691807-6-stefanha@redhat.com> In-Reply-To: <20261030193416.1691807-1-stefanha@redhat.com> References: <20261030193416.1691807-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-MFC-PROC-ID: y65ZhUsdKZX1xiJDczPBRtITDveUCRZoLpkGhEjgGIw_1793388891 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: V5ADJUCVCAMAIPP7HEKZHWECZYFPPHFL X-Message-ID-Hash: V5ADJUCVCAMAIPP7HEKZHWECZYFPPHFL X-MailFrom: stefanha@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: qemu-block@nongnu.org, Fabiano Rosas , Zhao Liu , Kevin Wolf , Richard Henderson , "Michael S. Tsirkin" , Laurent Vivier , Fam Zheng , devel@lists.libvirt.org, "Denis V. Lunev" , Paolo Bonzini , Hanna Reitz , Stefan Hajnoczi , Pierrick Bouvier , John Snow X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Stefan Hajnoczi via Devel Reply-To: Stefan Hajnoczi X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1793389465676158500 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kevin Wolf Only 20 bytes are written to the passed buffer and the returned string doesn't have a NUL terminator. Signed-off-by: Kevin Wolf Message-ID: <20261029231001.194240-5-kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi --- tests/qtest/virtio-blk-test.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/qtest/virtio-blk-test.c b/tests/qtest/virtio-blk-test.c index 825ea261bed..722bd0711fa 100644 --- a/tests/qtest/virtio-blk-test.c +++ b/tests/qtest/virtio-blk-test.c @@ -858,6 +858,25 @@ static void get_id_serial_short_20_characters(void *ob= j, void *data, qvirtqueue_cleanup(blk_if->vdev->bus, vq, t_alloc); } =20 +static void get_id_serial_short_trunc(void *obj, void *data, + QGuestAllocator *t_alloc) +{ + QVirtioBlk *blk_if =3D obj; + QVirtioDevice *dev =3D blk_if->vdev; + QVirtQueue *vq; + uint8_t status; + /* Everything after the 20 character maximum is untouched, no '\0' */ + const char expected[25] =3D "01234567890123456789\xa5\xa5\xa5\xa5\xa5"; + char buf[25]; + + vq =3D get_id_setup(dev, t_alloc); + status =3D get_id_request(dev, vq, buf, 25, 0xa5, t_alloc); + g_assert_cmpint(status, =3D=3D, 0); + g_assert_cmpmem(buf, 25, expected, sizeof(expected)); + + qvirtqueue_cleanup(blk_if->vdev->bus, vq, t_alloc); +} + static void *virtio_blk_test_setup(GString *cmd_line, void *arg) { char *tmp_path =3D drive_create(); @@ -898,6 +917,10 @@ static void register_virtio_blk_test(void) opts.edge.extra_device_opts =3D "serial=3D01234567890123456789"; qos_add_test("get_id/serial_short_20_characters", "virtio-blk", get_id_serial_short_20_characters, &opts); + + opts.edge.extra_device_opts =3D "serial=3D0123456789012345678901234567= 89"; + qos_add_test("get_id/serial_short_trunc", "virtio-blk", + get_id_serial_short_trunc, &opts); } =20 libqos_init(register_virtio_blk_test); --=20 2.56.0