qemu/tests
Peter Maydell 49727560c7 target/arm: Handle overflow in calculation of next timer tick
In commit edac4d8a16 back in 2015 when we added support for
the virtual timer offset CNTVOFF_EL2, we didn't correctly update
the timer-recalculation code that figures out when the timer
interrupt is next going to change state. We got it wrong in
two ways:
 * for the 0->1 transition, we didn't notice that gt->cval + offset
   can overflow a uint64_t
 * for the 1->0 transition, we didn't notice that the transition
   might now happen before the count rolls over, if offset > count

In the former case, we end up trying to set the next interrupt
for a time in the past, which results in QEMU hanging as the
timer fires continuously.

In the latter case, we would fail to update the interrupt
status when we are supposed to.

Fix the calculations in both cases.

The test case is Alex Bennée's from the bug report, and tests
the 0->1 transition overflow case.

Fixes: edac4d8a16 ("target-arm: Add CNTVOFF_EL2")
Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/60
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20231120173506.3729884-1-peter.maydell@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 8d37a1425b9954d7e445615dcad23456515e24c0)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2023-12-05 12:32:36 +03:00
..
avocado tests/avocado: Replace assertRegexpMatches() for Python 3.12 compatibility 2023-11-29 15:35:38 +03:00
bench migration/xbzrle: Use i386 host/cpuinfo.h 2023-05-23 16:51:18 -07:00
data tests: acpi: update expected blobs 2023-08-03 16:06:49 -04:00
decode decodetree: Add --output-null for meson testing 2023-05-31 19:56:42 -07:00
docker tests/docker: avoid invalid escape in Python string 2023-10-19 14:52:59 +03:00
fp tests: fp: remove unused submodules 2023-06-07 11:05:09 +02:00
guest-debug tests/tcg: ensure system-mode gdb tests start stopped 2023-08-10 11:04:34 -07:00
image-fuzzer image-fuzzer: Use OSerror.strerror instead of tuple subscript 2019-11-05 16:36:11 +01:00
include
keys
lcitool tests/lcitool: Generate distribution packages list in JSON format 2023-07-18 09:36:28 +02:00
migration tests/migration: Add -fno-stack-protector 2023-08-01 23:52:23 +02:00
multiboot Remove superfluous .gitignore files 2020-10-13 12:48:17 +02:00
perf/block/qcow2
plugin plugins: fix memory leak while parsing options 2023-07-03 12:51:58 +01:00
qapi-schema qapi: Improve error message for description following section 2023-05-22 10:03:26 +02:00
qemu-iotests vmdk: Don't corrupt desc file in vmdk_write_cid 2023-12-05 12:32:35 +03:00
qtest tests/qtest: ahci-test: add test exposing reset issue with pending callback 2023-11-19 21:15:06 +03:00
rocker
tcg target/arm: Handle overflow in calculation of next timer tick 2023-12-05 12:32:36 +03:00
tsan
uefi-test-tools Remove superfluous .gitignore files 2020-10-13 12:48:17 +02:00
unit util/uuid: Add UUID_STR_LEN definition 2023-11-09 16:39:13 +03:00
vm tests/vm: avoid invalid escape in Python string 2023-10-19 14:52:59 +03:00
vmstate-static-checker-data
dbus-vmstate-daemon.sh tests: add dbus-vmstate-test 2020-01-06 18:41:32 +04:00
Makefile.include tests: Use separate virtual environment for avocado 2023-06-06 16:29:53 +02:00
meson.build tests/decode: Convert tests to meson 2023-05-30 10:55:39 -07:00
requirements.txt tests: Use separate virtual environment for avocado 2023-06-06 16:29:53 +02:00
test-qht-par.c clean-includes: run it once more 2016-06-16 18:39:03 +02:00
vhost-user-bridge.c error handling: Use RETRY_ON_EINTR() macro where applicable 2023-01-09 13:50:47 +01:00