[PATCH 00/12] accel/tcg: Fix cross-page pointer wrapping issue

Richard Henderson posted 12 patches 7 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250504205714.3432096-1-richard.henderson@linaro.org
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Michael Rolnik <mrolnik@gmail.com>, Helge Deller <deller@gmx.de>, Eduardo Habkost <eduardo@habkost.net>, Song Gao <gaosong@loongson.cn>, Laurent Vivier <laurent@vivier.eu>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Aurelien Jarno <aurelien@aurel32.net>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <arikalo@gmail.com>, Stafford Horne <shorne@gmail.com>, Nicholas Piggin <npiggin@gmail.com>, Daniel Henrique Barboza <danielhb413@gmail.com>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Weiwei Li <liwei1518@gmail.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Yoshinori Sato <ysato@users.sourceforge.jp>, David Hildenbrand <david@redhat.com>, Ilya Leoshkevich <iii@linux.ibm.com>, Thomas Huth <thuth@redhat.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Artyom Tarasenko <atar4qemu@gmail.com>, Bastian Koppelmann <kbastian@mail.uni-paderborn.de>, Max Filippov <jcmvbkbc@gmail.com>
include/accel/tcg/cpu-ops.h | 13 +++++++++++++
accel/tcg/cpu-exec.c        |  1 +
accel/tcg/cputlb.c          | 22 ++++++++++++++++++++++
target/alpha/cpu.c          |  1 +
target/arm/cpu.c            | 24 ++++++++++++++++++++++++
target/arm/tcg/cpu-v7m.c    |  1 +
target/avr/cpu.c            |  6 ++++++
target/hppa/cpu.c           |  1 +
target/i386/tcg/tcg-cpu.c   |  7 +++++++
target/loongarch/cpu.c      |  7 +++++++
target/m68k/cpu.c           |  1 +
target/microblaze/cpu.c     |  1 +
target/mips/cpu.c           |  9 +++++++++
target/openrisc/cpu.c       |  1 +
target/ppc/cpu_init.c       |  7 +++++++
target/riscv/tcg/tcg-cpu.c  | 26 ++++++++++++++++++++++++++
target/rx/cpu.c             |  1 +
target/s390x/cpu.c          |  9 +++++++++
target/sh4/cpu.c            |  1 +
target/sparc/cpu.c          | 13 +++++++++++++
target/tricore/cpu.c        |  1 +
target/xtensa/cpu.c         |  1 +
22 files changed, 154 insertions(+)
[PATCH 00/12] accel/tcg: Fix cross-page pointer wrapping issue
Posted by Richard Henderson 7 months, 2 weeks ago
As detailed in

https://lore.kernel.org/qemu-devel/174595764300.3422.13156465553505851834-0@git.sr.ht/

there's an issue with an unaligned access that falls off
the end of the last page.  To solve this, we need to know
about the state of the cpu, so add a new target hook.

There are arguments to the hook that are currently unused,
but would appear to come in handy for AArch64 v9.5 FEAT_CPA2,
which we do not yet implement.


r~


Richard Henderson (12):
  accel/tcg: Add TCGCPUOps.pointer_wrap
  target: Use cpu_pointer_wrap_notreached for strict align targets
  target: Use cpu_pointer_wrap_uint32 for 32-bit targets
  target/arm: Fill in TCGCPUOps.pointer_wrap
  target/i386: Fill in TCGCPUOps.pointer_wrap
  target/loongarch: Fill in TCGCPUOps.pointer_wrap
  target/mips: Fill in TCGCPUOps.pointer_wrap
  target/ppc: Fill in TCGCPUOps.pointer_wrap
  target/riscv: Fill in TCGCPUOps.pointer_wrap
  target/s390x: Fill in TCGCPUOps.pointer_wrap
  target/sparc: Fill in TCGCPUOps.pointer_wrap
  accel/tcg: Assert TCGCPUOps.pointer_wrap is set

 include/accel/tcg/cpu-ops.h | 13 +++++++++++++
 accel/tcg/cpu-exec.c        |  1 +
 accel/tcg/cputlb.c          | 22 ++++++++++++++++++++++
 target/alpha/cpu.c          |  1 +
 target/arm/cpu.c            | 24 ++++++++++++++++++++++++
 target/arm/tcg/cpu-v7m.c    |  1 +
 target/avr/cpu.c            |  6 ++++++
 target/hppa/cpu.c           |  1 +
 target/i386/tcg/tcg-cpu.c   |  7 +++++++
 target/loongarch/cpu.c      |  7 +++++++
 target/m68k/cpu.c           |  1 +
 target/microblaze/cpu.c     |  1 +
 target/mips/cpu.c           |  9 +++++++++
 target/openrisc/cpu.c       |  1 +
 target/ppc/cpu_init.c       |  7 +++++++
 target/riscv/tcg/tcg-cpu.c  | 26 ++++++++++++++++++++++++++
 target/rx/cpu.c             |  1 +
 target/s390x/cpu.c          |  9 +++++++++
 target/sh4/cpu.c            |  1 +
 target/sparc/cpu.c          | 13 +++++++++++++
 target/tricore/cpu.c        |  1 +
 target/xtensa/cpu.c         |  1 +
 22 files changed, 154 insertions(+)

-- 
2.43.0