qemu/system
Thomas Huth 991a955c0f system/rtc: Fix a possible year-2038 integer overflow problem
rtc_realtime_clock_offset is initialized with:

  rtc_realtime_clock_offset = qemu_clock_get_ms(QEMU_CLOCK_REALTIME) / 1000;

And QEMU_CLOCK_REALTIME might be based on gettimeofday() in certain
cases (see get_clock_realtime() in include/qemu/timer.h). So this
counter will exceed 32 bits in the year 2038, thus we should not
store this value in a normal integer variable. Change it to a time_t
to fix the problem.
And while we're at it, also adjust the nearby rtc_host_datetime_offset
variable to be on the safe side in the related code.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit ae84c738e4)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2026-06-14 08:51:01 +03:00
..
arch_init.c system: Replace arch_type global by qemu_arch_available() helper 2025-03-11 20:03:26 +01:00
async-teardown.c qemu/osdep: Add excluded fd parameter to qemu_close_all_open_fd() 2024-08-05 08:21:59 +10:00
balloon.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
bootdevice.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
cpu-timers.c cpus: properly kick CPUs out of inner execution loop 2025-09-17 19:00:55 +02:00
cpus.c bql: Fix bql_locked status with condvar APIs 2025-11-03 11:59:32 +01:00
datadir.c pc-bios: Move device tree files in their own subdir 2025-04-25 17:09:58 +02:00
device_tree-stub.c hw/core/machine.c: Make -machine dumpdtb=file.dtb with no DTB an error 2025-02-25 15:32:57 +00:00
device_tree.c hw/core/loader: capture Error from load_image_targphys 2025-10-28 08:19:18 +01:00
dirtylimit.c Miscellaneous patches for 2025-04-24 2025-04-24 13:44:57 -04:00
dma-helpers.c include/exec: Split out icount.h 2025-04-23 14:08:44 -07:00
exit-with-parent.c Implement -run-with exit-with-parent=on 2025-11-03 10:05:39 +00:00
globals-target.c system: Extract target-specific globals to their own compilation unit 2025-03-11 20:03:26 +01:00
globals.c system: drop the -old-param option 2025-09-16 17:31:54 +01:00
ioport.c include/system: Move exec/ioport.h to system/ioport.h 2025-04-23 14:08:21 -07:00
main.c system/main: comment lock rationale 2025-05-28 08:07:59 +01:00
memory-internal.h system/memory: Remove DEVICE_HOST_ENDIAN definition 2025-04-25 17:09:58 +02:00
memory.c system/physmem: Extract API out of 'system/ram_addr.h' header 2025-10-07 05:03:56 +02:00
memory_ldst.c.inc system/physmem: Drop 'cpu_' prefix in Physical Memory API 2025-10-07 05:03:56 +02:00
memory_mapping.c include/system: Move exec/address-spaces.h to system/address-spaces.h 2025-04-23 14:08:21 -07:00
meson.build Implement -run-with exit-with-parent=on 2025-11-03 10:05:39 +00:00
physmem.c system/physmem: mark io_mem_unassigned lockless 2025-11-03 16:04:10 -05:00
qdev-monitor.c qdev: add qdev_find_default_bus() 2025-10-29 22:53:41 +04:00
qemu-seccomp.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
qtest.c qtest: Allow and ignore blank lines in input 2025-11-25 22:41:37 +01:00
ram-block-attributes.c ram-block-attributes: Unify the retrieval of the block size 2025-11-03 16:04:10 -05:00
rtc.c system/rtc: Fix a possible year-2038 integer overflow problem 2026-06-14 08:51:01 +03:00
runstate-action.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
runstate-hmp-cmds.c qapi: Move include/qapi/qmp/ to include/qobject/ 2025-02-10 15:33:16 +01:00
runstate.c audio: move audio.h under include/qemu/ 2025-10-30 22:56:51 +04:00
tpm-hmp-cmds.c system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
tpm.c tpm: "qemu -tpmdev help" should return success 2025-07-15 10:22:33 +04:00
trace-events ram-block-attributes: Introduce RamBlockAttributes to manage RAMBlock with guest_memfd 2025-06-23 16:03:59 -04:00
trace.h system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
vl.c Implement -run-with exit-with-parent=on 2025-11-03 10:05:39 +00:00
watchpoint.c include/exec: Split out watchpoint.h 2025-04-23 14:08:36 -07:00