[PATCH v3 0/4] target/riscv: Correct undefined behaviors in x-rv128

frederic.petrot@univ-grenoble-alpes.fr posted 4 patches 2 weeks, 2 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20261106161843.2075117-1-frederic.petrot@univ-grenoble-alpes.fr
Maintainers: Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Chao Liu <chao.liu@processmission.com>
There is a newer version of this series
target/riscv/cpu.c                    |   1 +
target/riscv/cpu.h                    |   4 +
target/riscv/machine.c                |   4 +
target/riscv/tcg/cpu_helper.c         |  20 +++-
target/riscv/tcg/csr.c                | 131 +++++++++++++++++++++-----
target/riscv/tcg/csr.h                |   3 +
target/riscv/tcg/pmp.c                |  38 ++++++++
tests/tcg/riscv64/system/meson.build  |  14 +++
tests/tcg/riscv64/test-rv128-mcause.S | 101 ++++++++++++++++++++
tests/tcg/riscv64/test-rv128-scause.S |  94 ++++++++++++++++++
10 files changed, 382 insertions(+), 28 deletions(-)
create mode 100644 tests/tcg/riscv64/test-rv128-mcause.S
create mode 100644 tests/tcg/riscv64/test-rv128-scause.S
[PATCH v3 0/4] target/riscv: Correct undefined behaviors in x-rv128
Posted by frederic.petrot@univ-grenoble-alpes.fr 2 weeks, 2 days ago
From: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>

Peter reported undefined behaviors in x-rv128 pmp configuration
registers accesses detected by the clang sanitizer.
This series introduces a 128-bit version of these accesses, and
corrects other out-of-bound shifts within the handling of interrupts
that were triggered afterwards.

Changes in v3:
- Extract the "interrupt" bitfield in the different versions of the
  cause register in a separate field of cpu.h and build the cause
  registers value on demand,
- Add these new fields into the machine migration state,
- Check that the pmp registers used in rv128 are only those allowed,
- Add tcg tests for mcause and scause accesses.

Changes in v2:
- I messed up and directly assigned a 0 to an Int128, so v2 corrects
  that.

Frédéric Pétrot (4):
  target/riscv: fix pmp sanitize error for x-rv128
  target/riscv: fix riscv_cpu_do_interrupt sanitize error for x-rv128
  target/riscv: Update machine state
  target/riscv: [ms]cause tcg tests for x-rv128

 target/riscv/cpu.c                    |   1 +
 target/riscv/cpu.h                    |   4 +
 target/riscv/machine.c                |   4 +
 target/riscv/tcg/cpu_helper.c         |  20 +++-
 target/riscv/tcg/csr.c                | 131 +++++++++++++++++++++-----
 target/riscv/tcg/csr.h                |   3 +
 target/riscv/tcg/pmp.c                |  38 ++++++++
 tests/tcg/riscv64/system/meson.build  |  14 +++
 tests/tcg/riscv64/test-rv128-mcause.S | 101 ++++++++++++++++++++
 tests/tcg/riscv64/test-rv128-scause.S |  94 ++++++++++++++++++
 10 files changed, 382 insertions(+), 28 deletions(-)
 create mode 100644 tests/tcg/riscv64/test-rv128-mcause.S
 create mode 100644 tests/tcg/riscv64/test-rv128-scause.S

-- 
2.43.0