qemu/accel
Jessica Clarke e2faabee78 accel/tcg: Forward probe size on to notdirty_write
Without this, we just dirty a single byte, and so if the caller writes
more than one byte to the host memory then we won't have invalidated any
translation blocks that start after the first byte and overlap those
writes. In particular, AArch64's DC ZVA implementation uses probe_access
(via probe_write), and so we don't invalidate the entire block, only the
TB overlapping the first byte (and, in the unusual case an unaligned VA
is given to the instruction, we also probe that specific address in
order to get the right VA reported on an exception, so will invalidate a
TB overlapping that address too). Since our IC IVAU implementation is a
no-op for system emulation that relies on the softmmu already having
detected self-modifying code via this mechanism, this means we have
observably wrong behaviour when jumping to code that has been DC ZVA'ed.
In practice this is an unusual thing for software to do, as in reality
the OS will DC ZVA the page and the application will go and write actual
instructions to it that aren't UDF #0, but you can write a test that
clearly shows the faulty behaviour.

For functions other than probe_access it's not clear what size to use
when 0 is passed in. Arguably a size of 0 shouldn't dirty at all, since
if you want to actually write then you should pass in a real size, but I
have conservatively kept the implementation as dirtying the first byte
in that case so as to avoid breaking any assumptions about that
behaviour.

Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
Message-Id: <20231104031232.3246614-1-jrtc27@jrtc27.com>
[rth: Move the dirtysize computation next to notdirty_write.]
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2023-11-14 10:40:54 -08:00
..
hvf accel/tcg: Move can_do_io to CPUNegativeOffsetState 2023-10-03 08:01:02 -07:00
kvm kvm: i386: require KVM_CAP_SET_VCPU_EVENTS and KVM_CAP_X86_ROBUST_SINGLESTEP 2023-10-25 19:53:30 +02:00
qtest meson: Replace CONFIG_SOFTMMU -> CONFIG_SYSTEM_ONLY 2023-06-20 10:01:30 +02:00
stubs accel/tcg: Factor tcg_cpu_reset_hold() out 2023-11-07 12:13:27 +01:00
tcg accel/tcg: Forward probe size on to notdirty_write 2023-11-14 10:40:54 -08:00
xen accel/xen: Fix DM state change notification in dm_restrict mode 2023-03-23 09:56:54 +00:00
accel-blocker.c
accel-system.c accel: Rename accel_softmmu* -> accel_system* 2023-10-07 19:02:57 +02:00
accel-system.h accel: Rename accel_softmmu* -> accel_system* 2023-10-07 19:02:57 +02:00
accel-target.c accel: Rename accel_softmmu* -> accel_system* 2023-10-07 19:02:57 +02:00
accel-user.c
dummy-cpus.c accel/tcg: Move can_do_io to CPUNegativeOffsetState 2023-10-03 08:01:02 -07:00
Kconfig accel: Remove HAX accelerator 2023-08-31 19:46:43 +02:00
meson.build accel: Rename accel_softmmu* -> accel_system* 2023-10-07 19:02:57 +02:00