From nobody Mon Apr 29 10:42:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1667488642; cv=none; d=zohomail.com; s=zohoarc; b=I92tSQ6XxBilhlvzBLw1SzqpxFZloA4/+rylE9dQ4Mp6kUnnvk0NOUgsFH02/F5vKyWW+G2scy12VpvY3q+KtZFLh4UZeM5r3NyDy4hxRdzFHVNqWslnFl6X36ePVJHbJtME61T4spgoRe+ybFdd1pbC5URLjsDq0BFiF0ZEvV0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667488642; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=LtZSoViwsDJsOroKONhsEKwTsL+hX9O/xiEjwXgiuQM=; b=ntnJtMy+uf0giT3zJ2hRf18/kkHmogqqijDvbAK+d3PdhBq/X4wWSoXZ/fiy4mbARS0o/lhEIo5TnhjhNP9gTzejWDfB3t9jJ8h6VTKuOYl0QTr8Ls8j7X+CmPc1pwyuK1sIRzwxRRoVx6wXXaowasO/07RP8PfaglcNDQKBK40= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1667488642105961.350963727943; Thu, 3 Nov 2022 08:17:22 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-562-iIlsmrj5O8ODkJmLP8iH_Q-1; Thu, 03 Nov 2022 11:17:18 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C68C03833285; Thu, 3 Nov 2022 15:17:06 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E75B1121319; Thu, 3 Nov 2022 15:17:06 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0E9C419465A4; Thu, 3 Nov 2022 15:17:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 371021946594 for ; Thu, 3 Nov 2022 15:17:05 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 01C1B2166B30; Thu, 3 Nov 2022 15:17:05 +0000 (UTC) Received: from speedmetal.redhat.com (ovpn-208-3.brq.redhat.com [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6BB4D2166B26 for ; Thu, 3 Nov 2022 15:17:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667488641; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=LtZSoViwsDJsOroKONhsEKwTsL+hX9O/xiEjwXgiuQM=; b=Dy1KvYHekAWgywz2dgJmPEAF0aGIUDqCpRRyUECjUNbLRUuYnrZhs2V06Dnivgv2oKrxWi sAWuSgnIMLLVFlQdK3qb5HA+k9jJKbpCGpdB1CwDh4gYaqczt+CgxE0XM6yE3/3NHw4byL 02uduuVNwreK2mk+Xg7zRuu4jfwn73Y= X-MC-Unique: iIlsmrj5O8ODkJmLP8iH_Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH] qemu: validate: Validate maximum start time for Date: Thu, 3 Nov 2022 16:17:03 +0100 Message-Id: <6d13488f6585561dd87691305b6ab0e411e971ce.1667488623.git.pkrempa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1667488643049100001 Content-Type: text/plain; charset="utf-8" Glib can internally convert only unix timestamps up to 9999-12-31T23:59:59 (253402300799). Validate that the user doesn't use more than that as otherwise we cause an assertion failure: (process:1183396): GLib-CRITICAL **: 14:25:00.906: g_date_time_format: ass= ertion 'datetime !=3D NULL' failed Additionally adjust the schema to allow bigger values as we use 'unsigned long long' to parse the value. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2128993 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/schemas/domaincommon.rng | 2 +- src/qemu/qemu_validate.c | 17 +++++++++++++++++ .../clock-absolute.x86_64-latest.args | 2 +- tests/qemuxml2argvdata/clock-absolute.xml | 2 +- .../clock-absolute.x86_64-latest.xml | 2 +- 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index ebb39de3ef..cefe818044 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -1312,7 +1312,7 @@ absolute - + diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 1456a69351..1d4081e47e 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -663,6 +663,23 @@ qemuValidateDomainDefClockTimers(const virDomainDef *d= ef, } } + switch ((virDomainClockOffsetType) def->clock.offset) { + case VIR_DOMAIN_CLOCK_OFFSET_ABSOLUTE: + /* maximum timestamp glib can convert is 9999-12-31T23:59:59 */ + if (def->clock.data.starttime > 253402300799) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("The maximum 'start' value for is 253402300799")); + return -1; + } + + case VIR_DOMAIN_CLOCK_OFFSET_UTC: + case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME: + case VIR_DOMAIN_CLOCK_OFFSET_TIMEZONE: + case VIR_DOMAIN_CLOCK_OFFSET_VARIABLE: + case VIR_DOMAIN_CLOCK_OFFSET_LAST: + break; + } + return 0; } diff --git a/tests/qemuxml2argvdata/clock-absolute.x86_64-latest.args b/tes= ts/qemuxml2argvdata/clock-absolute.x86_64-latest.args index 75fc162cee..af64bc0f1a 100644 --- a/tests/qemuxml2argvdata/clock-absolute.x86_64-latest.args +++ b/tests/qemuxml2argvdata/clock-absolute.x86_64-latest.args @@ -23,7 +23,7 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ -nodefaults \ -chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ --rtc base=3D1970-01-01T00:20:34 \ +-rtc base=3D9999-12-31T23:59:59 \ -no-shutdown \ -no-acpi \ -boot strict=3Don \ diff --git a/tests/qemuxml2argvdata/clock-absolute.xml b/tests/qemuxml2argv= data/clock-absolute.xml index e79f53ed3c..63ef7f6f33 100644 --- a/tests/qemuxml2argvdata/clock-absolute.xml +++ b/tests/qemuxml2argvdata/clock-absolute.xml @@ -8,7 +8,7 @@ hvm - + destroy restart destroy diff --git a/tests/qemuxml2xmloutdata/clock-absolute.x86_64-latest.xml b/te= sts/qemuxml2xmloutdata/clock-absolute.x86_64-latest.xml index b313a74039..eea68677d5 100644 --- a/tests/qemuxml2xmloutdata/clock-absolute.x86_64-latest.xml +++ b/tests/qemuxml2xmloutdata/clock-absolute.x86_64-latest.xml @@ -11,7 +11,7 @@ qemu64 - + destroy restart destroy --=20 2.37.3