qemu-e2k/accel/tcg
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
..
atomic_common.c.inc
atomic_template.h
cpu-exec-common.c accel/tcg: Make cpu-exec-common.c a target agnostic unit 2023-10-04 11:03:54 -07:00
cpu-exec.c accel/tcg: Remove CF_LAST_IO 2023-11-14 10:40:54 -08:00
cputlb.c accel/tcg: Forward probe size on to notdirty_write 2023-11-14 10:40:54 -08:00
debuginfo.c
debuginfo.h
icount-common.c system: Rename softmmu/ directory as system/ 2023-10-08 21:08:08 +02:00
internal-common.h accel/tcg: Move HMP info jit and info opcount code 2023-11-06 08:27:21 -08:00
internal-target.h accel/tcg: Make cpu-exec-common.c a target agnostic unit 2023-10-04 11:03:54 -07:00
ldst_atomicity.c.inc accel/tcg: Fix condition for store_atom_insert_al16 2023-11-06 08:27:21 -08:00
ldst_common.c.inc
meson.build accel/tcg: Make cpu-exec-common.c a target agnostic unit 2023-10-04 11:03:54 -07:00
monitor.c accel/tcg: Move HMP info jit and info opcount code 2023-11-06 08:27:21 -08:00
perf.c
perf.h
plugin-gen.c plugins: Remove an extra parameter 2023-10-31 14:10:21 +00:00
plugin-helpers.h
tb-context.h
tb-hash.h
tb-jmp-cache.h
tb-maint.c accel/tcg: Remove CF_LAST_IO 2023-11-14 10:40:54 -08:00
tcg-accel-ops-icount.c
tcg-accel-ops-icount.h
tcg-accel-ops-mttcg.c tcg: Split out tcg init functions to tcg/startup.h 2023-10-04 11:03:54 -07:00
tcg-accel-ops-mttcg.h
tcg-accel-ops-rr.c tcg: Split out tcg init functions to tcg/startup.h 2023-10-04 11:03:54 -07:00
tcg-accel-ops-rr.h
tcg-accel-ops.c accel/tcg: Factor tcg_cpu_reset_hold() out 2023-11-07 12:13:27 +01:00
tcg-accel-ops.h
tcg-all.c tcg: Split out tcg init functions to tcg/startup.h 2023-10-04 11:03:54 -07:00
tcg-runtime-gvec.c
tcg-runtime.c
tcg-runtime.h
trace-events
trace.h
translate-all.c accel/tcg: Remove CF_LAST_IO 2023-11-14 10:40:54 -08:00
translator.c accel/tcg: Remove CF_LAST_IO 2023-11-14 10:40:54 -08:00
user-exec-stub.c accel: Introduce cpu_exec_reset_hold() 2023-11-07 12:13:27 +01:00
user-exec.c tcg: Correct invalid mentions of 'softmmu' by 'system-mode' 2023-10-07 19:02:33 +02:00