mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
qemu: validate: Validate maximum start time for <clock offset='absolute'>
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: assertion 'datetime != 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=2128993 Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
cca6787b15
commit
9acd9fa733
@ -1312,7 +1312,7 @@
|
||||
<value>absolute</value>
|
||||
</attribute>
|
||||
<attribute name="start">
|
||||
<ref name="unsignedInt"/>
|
||||
<ref name="unsignedLong"/>
|
||||
</attribute>
|
||||
</group>
|
||||
</choice>
|
||||
|
@ -663,6 +663,23 @@ qemuValidateDomainDefClockTimers(const virDomainDef *def,
|
||||
}
|
||||
}
|
||||
|
||||
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 <clock offset='absolute'> 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;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
|
||||
-nodefaults \
|
||||
-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
|
||||
-mon chardev=charmonitor,id=monitor,mode=control \
|
||||
-rtc base=1970-01-01T00:20:34 \
|
||||
-rtc base=9999-12-31T23:59:59 \
|
||||
-no-shutdown \
|
||||
-no-acpi \
|
||||
-boot strict=on \
|
||||
|
@ -8,7 +8,7 @@
|
||||
<type arch='x86_64' machine='pc'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<clock offset='absolute' start='1234'/>
|
||||
<clock offset='absolute' start='253402300799'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
|
@ -11,7 +11,7 @@
|
||||
<cpu mode='custom' match='exact' check='none'>
|
||||
<model fallback='forbid'>qemu64</model>
|
||||
</cpu>
|
||||
<clock offset='absolute' start='1234'/>
|
||||
<clock offset='absolute' start='253402300799'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
|
Loading…
x
Reference in New Issue
Block a user