On 22/10/25 13:52, Nikita Novikov wrote:
Recent debugging of misaligned access handling on RISC-V revealed that we
always call `tlb_fill` with `memop_size == 0`. This behavior effectively
disables natural alignment checks in `riscv_tlb_fill_align()`, because we
have to fall back from `memop_size` to `size` when computing the alignment bits.

With `memop_size == 0`, misaligned cross-page stores end up reported as
`store access fault` (AF, cause=7) instead of the expected
`store page fault` (PF, cause=15), since the “misalign” path triggers before
the second page translation can fault. This breaks misaligned accesses at
page boundaries.

After switching to pass the real `l->memop` into `tlb_fill`, the cross-page
faults are no longer mis-classified as AF.

Fixes: ec03dd972378 ("accel/tcg: Hoist first page lookup above pointer_wrap")

Signed-off-by: Nikita Novikov <[email protected]>
---
  accel/tcg/cputlb.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Good catch!

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>


Reply via email to