All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] target/riscv: apply pointer masking to flh/fsh and Zcmp push/pop
@ 2026-12-04 20:17 Rishab Pradeep
  2026-12-04 20:17 ` [PATCH 1/2] target/riscv: apply pointer masking to flh/fsh Rishab Pradeep
  2026-12-04 20:17 ` [PATCH 2/2] target/riscv: apply pointer masking to Zcmp push/pop Rishab Pradeep
  0 siblings, 2 replies; 3+ messages in thread
From: Rishab Pradeep @ 2026-12-04 20:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-riscv, palmer, alistair.francis, liwei1518, daniel.barboza,
	zhiwei_liu, chao.liu, Rishab Pradeep

With pointer masking enabled, the ignore transformation applies to
every explicit memory access. flh/fsh and the Zcmp stack instructions
(cm.push, cm.pop, cm.popret, cm.popretz) form their addresses without
it, so a tagged pointer or tagged sp raises a load/store access fault,
whereas lw/flw/fld and ld/sd through the same pointer work. Spike,
Sail and Whisper mask flh/fsh as expected.

Patch 1 builds the flh/fsh address with get_address(), as flw/fsw and
fld/fsd already do. Neither instruction applied the mask before.

Patch 2 masks each access address in gen_pop() and trans_cm_push(),
recomputed from the current address on every iteration. sp is still
written back with its tag, and the cm.popret jump target is unchanged
since it is an instruction fetch, not an explicit data access.

Tested with the reproducer from the issue; both ELFs (pm_flh_fsh,
pm_zcmp_push_pop) pass with these patches and fail on master.

Based on riscv-to-apply.next (9d45369e7f), which carries the #4758 series
that adds gen_pm_adjust_addr().

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/4967

Rishab Pradeep (2):
  target/riscv: apply pointer masking to flh/fsh
  target/riscv: apply pointer masking to Zcmp push/pop

 target/riscv/tcg/insn_trans/trans_rvzce.c.inc |  8 ++++++--
 target/riscv/tcg/insn_trans/trans_rvzfh.c.inc | 14 ++------------
 2 files changed, 8 insertions(+), 14 deletions(-)

-- 
2.56.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-04 20:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 20:17 [PATCH 0/2] target/riscv: apply pointer masking to flh/fsh and Zcmp push/pop Rishab Pradeep
2026-12-04 20:17 ` [PATCH 1/2] target/riscv: apply pointer masking to flh/fsh Rishab Pradeep
2026-12-04 20:17 ` [PATCH 2/2] target/riscv: apply pointer masking to Zcmp push/pop Rishab Pradeep

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.