From nobody Sat May 30 18:34:12 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1779181005; cv=none; d=zohomail.com; s=zohoarc; b=IffUF4j1niJ8s5FT0G+NRXyOfNPM2iQ08H3JyLrtX1W5r0UTu1OwvepRwG/c+mUkxxGuwrWMpPELLjqTU3AJYAq2jxqz6UkDdRL1t3x7171gHVP0hLMyR/AFJotS3mT6LwtlY9BgltZQYbvphry6gBkTmjlMvUu5zeiXTL9+Slk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779181005; h=Content-Type: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=7SI4QuBLtZHs0J7Ga2vw3XAw/52+dzlqNrGzzneYN/4=; b=gYp0ACa5/4hMacXnK8DXh9s/3REwPo9q0GgistkDrWKcMOVn6r04LyIgyEL7wS/VkG+p12t2Whq2lNBjxk4ECnQHFlAsnQ/f0FDIatOhc3V1rZicNz9VYx3pNkBfnwcmUWqilJxutRqCGkuKUcC1hz9ASIOmfB4703H9RV4Hb9o= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1779181005702495.19339229503396; Tue, 19 May 2026 01:56:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPGFP-0003ho-TL; Tue, 19 May 2026 04:56:19 -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 1wPGFB-0003fy-RU for qemu-devel@nongnu.org; Tue, 19 May 2026 04:56:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wPGFA-0001Vc-6h for qemu-devel@nongnu.org; Tue, 19 May 2026 04:56:05 -0400 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-612-YOacHz2UOyuZV_CdlXTrJA-1; Tue, 19 May 2026 04:55:58 -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 DA39219560B4; Tue, 19 May 2026 08:55:56 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.44.48.13]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CD84319560A2; Tue, 19 May 2026 08:55:55 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E21E418007A4; Tue, 19 May 2026 10:55:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779180961; 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=7SI4QuBLtZHs0J7Ga2vw3XAw/52+dzlqNrGzzneYN/4=; b=MIA8G/Uf08Qj5PnjJJnICmWCeLDEFvPx/eejwZV8Yvn3BxeSadESNs3yH8RX3bocx9sIBf UfaQrb6qw+efeiyGxCUysUPHAQYzYMDmqli2Vvgm9pAVe+g54tf1lTVdLEe+m08b2pq3cm SXMCDkYo/z4hwvlE7OOfWV53jFnQEHw= X-MC-Unique: YOacHz2UOyuZV_CdlXTrJA-1 X-Mimecast-MFC-AGG-ID: YOacHz2UOyuZV_CdlXTrJA_1779180957 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Sergio Lopez , Gerd Hoffmann , "Michael S. Tsirkin" , Richard Henderson , Paolo Bonzini , Feifan Qian , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PULL 1/2] hw/uefi: check auth.hdr_length minimum size Date: Tue, 19 May 2026 10:55:53 +0200 Message-ID: <20260519085554.944458-2-kraxel@redhat.com> In-Reply-To: <20260519085554.944458-1-kraxel@redhat.com> References: <20260519085554.944458-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, 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_H5=0.001, RCVD_IN_MSPIKE_WL=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1779181007841154100 auth.hdr_length maximum is already checked (against buffer size). The header has some fixed fields which are included in the header length, so there also is a minimum size which must be verified. Add a check for that. Fixes possible integer underflow. While being at it replace the magic number '24' with sizeof calculations for better code documentation. Fixes: CVE-2026-8341 Fixes: f1488fac0584 ("hw/uefi: add var-service-auth.c") Reported-by: Feifan Qian Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Gerd Hoffmann Message-ID: <20260512060523.17493-1-kraxel@redhat.com> --- hw/uefi/var-service-auth.c | 5 ++++- hw/uefi/var-service-pkcs7.c | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/uefi/var-service-auth.c b/hw/uefi/var-service-auth.c index 795f2f54e4ab..f3dc9c6ca608 100644 --- a/hw/uefi/var-service-auth.c +++ b/hw/uefi/var-service-auth.c @@ -194,7 +194,7 @@ static efi_status uefi_vars_check_auth_2_sb(uefi_vars_s= tate *uv, return EFI_SUCCESS; } =20 - if (auth.hdr_length =3D=3D 24) { + if (auth.hdr_length =3D=3D (sizeof(auth) - sizeof(auth.timestamp))) { /* no signature (auth->cert_data is empty) */ return EFI_SECURITY_VIOLATION; } @@ -228,6 +228,9 @@ efi_status uefi_vars_check_auth_2(uefi_vars_state *uv, = uefi_variable *var, } memcpy(&auth, data, sizeof(auth)); =20 + if (auth.hdr_length < (sizeof(auth) - sizeof(auth.timestamp))) { + return EFI_SECURITY_VIOLATION; + } if (uadd64_overflow(sizeof(efi_time), auth.hdr_length, &data_offset)) { return EFI_SECURITY_VIOLATION; } diff --git a/hw/uefi/var-service-pkcs7.c b/hw/uefi/var-service-pkcs7.c index c859743e8677..8a1f1395a2fb 100644 --- a/hw/uefi/var-service-pkcs7.c +++ b/hw/uefi/var-service-pkcs7.c @@ -113,9 +113,9 @@ static gnutls_datum_t *build_pkcs7(void *data) =20 memcpy(&auth, data, sizeof(auth)); pkcs7 =3D g_new(gnutls_datum_t, 1); - pkcs7->size =3D auth.hdr_length - 24; + pkcs7->size =3D auth.hdr_length - (sizeof(auth) - sizeof(auth.timestam= p)); pkcs7->data =3D g_malloc(pkcs7->size); - memcpy(pkcs7->data, data + 16 + 24, pkcs7->size); + memcpy(pkcs7->data, data + sizeof(auth), pkcs7->size); =20 wrap_pkcs7(pkcs7); =20 --=20 2.54.0 From nobody Sat May 30 18:34:12 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1779181006; cv=none; d=zohomail.com; s=zohoarc; b=Jot9M8UC8c5bQD+Soa2wO/G5G+KpekBxgvn0C5D1K86/QYOqSER48Ia0kE0dawVoTpMFqiSY3kzkZNVQ4vSg6kmLSg044IGLa62RG7p7XMUxQtNznlIABP9xbM4pJMvxz0bNglZshSAy0p61NbOXQoDNHNZbjPH0juVuUBwl5Ts= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779181006; 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=gmWH8TlLipTDm1QeUP9GkUq3EE0SkXJJj62EqvoQh4A=; b=mk9TNzHjA9Mke6DPqWFXTYYkGkfYRiAsrCJSJfzO8pU2tdKNvyTQgyBPFOazxJkyw0DBewxxBsM6rl4nDdM5P2oFU7RGZoiydIGFtf0c/CAVBNNuB4EH+NxsWJmUUtN25Yl/Jo+xwCtRsdNcQoGp+Iz4ex5WQdkWjZ+uwPxJKSI= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177918100628289.87177885042126; Tue, 19 May 2026 01:56:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPGFI-0003gu-Bw; Tue, 19 May 2026 04:56:13 -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 1wPGFB-0003fz-Sy for qemu-devel@nongnu.org; Tue, 19 May 2026 04:56:07 -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 1wPGF9-0001VV-RK for qemu-devel@nongnu.org; Tue, 19 May 2026 04:56:05 -0400 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-589-As-qNEIeMzq0VPnLNlnp4Q-1; Tue, 19 May 2026 04:55:59 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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 E9F7A1800616; Tue, 19 May 2026 08:55:58 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.44.48.13]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AE0C91800673; Tue, 19 May 2026 08:55:57 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id F25401800840; Tue, 19 May 2026 10:55:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779180961; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gmWH8TlLipTDm1QeUP9GkUq3EE0SkXJJj62EqvoQh4A=; b=cVVnO6oyO7btFL05DqEoDP3nO52lO6izD6wqxS42AMl8h+a5VBMDGW0W7DA0lLaPfsSL7V o9yxI92yuTO/D8fKfRnHsSQ46+xZihhGM5HVJMN6yb5e5WjmH8blJFbpVTricZc6oFesgY RHxwrYJxL5hgD7WSg5WvctzU/pplVRs= X-MC-Unique: As-qNEIeMzq0VPnLNlnp4Q-1 X-Mimecast-MFC-AGG-ID: As-qNEIeMzq0VPnLNlnp4Q_1779180959 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Sergio Lopez , Gerd Hoffmann , "Michael S. Tsirkin" , Richard Henderson , Paolo Bonzini , Luigi Leonardi Subject: [PULL 2/2] hw/i386/microvm: Add IGVM support Date: Tue, 19 May 2026 10:55:54 +0200 Message-ID: <20260519085554.944458-3-kraxel@redhat.com> In-Reply-To: <20260519085554.944458-1-kraxel@redhat.com> References: <20260519085554.944458-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1779181009373158500 Content-Type: text/plain; charset="utf-8" From: Luigi Leonardi The IGVM infrastructure operates on X86MachineState and is already machine-type-agnostic, but the "igvm-cfg" QOM property is only registered on the PC machine type. Register it on microvm as well. When an IGVM file is configured, the firmware image is provided as a payload of the IGVM file so skip loading the default BIOS. Signed-off-by: Luigi Leonardi Message-ID: <20260512-microvm_igvm-v1-1-8b1fd8861235@redhat.com> Signed-off-by: Gerd Hoffmann --- hw/i386/microvm.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index 5a7889f21b8a..779741ec76ee 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -159,7 +159,6 @@ static int microvm_ioapics(MicrovmMachineState *mms) =20 static void microvm_devices_init(MicrovmMachineState *mms) { - const char *default_firmware; X86MachineState *x86ms =3D X86_MACHINE(mms); ISABus *isa_bus; GSIState *gsi_state; @@ -276,10 +275,12 @@ static void microvm_devices_init(MicrovmMachineState = *mms) serial_hds_isa_init(isa_bus, 0, 1); } =20 - default_firmware =3D x86_machine_is_acpi_enabled(x86ms) - ? MICROVM_BIOS_FILENAME - : MICROVM_QBOOT_FILENAME; - x86_bios_rom_init(x86ms, default_firmware, get_system_memory(), true); + if (!x86ms->igvm) { + const char *default_firmware =3D x86_machine_is_acpi_enabled(x86ms) + ? MICROVM_BIOS_FILENAME + : MICROVM_QBOOT_FILENAME; + x86_bios_rom_init(x86ms, default_firmware, get_system_memory(), tr= ue); + } } =20 static void microvm_memory_init(MicrovmMachineState *mms) @@ -717,6 +718,16 @@ static void microvm_class_init(ObjectClass *oc, const = void *data) =20 compat_props_add(mc->compat_props, microvm_properties, G_N_ELEMENTS(microvm_properties)); + +#if defined(CONFIG_IGVM) + object_class_property_add_link(oc, "igvm-cfg", + TYPE_IGVM_CFG, + offsetof(X86MachineState, igvm), + object_property_allow_set_link, + OBJ_PROP_LINK_STRONG); + object_class_property_set_description(oc, "igvm-cfg", + "Set IGVM configuration"); +#endif } =20 static const TypeInfo microvm_machine_info =3D { --=20 2.54.0