From: Rishab Pradeep <rishab@rispop.dev>
To: qemu-devel@nongnu.org
Cc: qemu-riscv@nongnu.org, palmer@dabbelt.com,
alistair.francis@wdc.com, liwei1518@gmail.com,
daniel.barboza@oss.qualcomm.com, zhiwei_liu@linux.alibaba.com,
chao.liu@processmission.com, Rishab Pradeep <rishab@rispop.dev>
Subject: [PATCH 0/2] target/riscv: apply pointer masking to flh/fsh and Zcmp push/pop
Date: Fri, 4 Dec 2026 14:17:30 -0600 [thread overview]
Message-ID: <20261204201732.254081-1-rishab@rispop.dev> (raw)
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
next reply other threads:[~2026-12-04 20:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 20:17 Rishab Pradeep [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261204201732.254081-1-rishab@rispop.dev \
--to=rishab@rispop.dev \
--cc=alistair.francis@wdc.com \
--cc=chao.liu@processmission.com \
--cc=daniel.barboza@oss.qualcomm.com \
--cc=liwei1518@gmail.com \
--cc=palmer@dabbelt.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=zhiwei_liu@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.