]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
riscv: mm: Unconditionally sfence.vma for spurious fault
authorVivian Wang <wangruikang@iscas.ac.cn>
Tue, 3 Mar 2026 05:29:49 +0000 (13:29 +0800)
committerPaul Walmsley <pjw@kernel.org>
Sun, 7 Jun 2026 05:48:15 +0000 (23:48 -0600)
commit1b2c6b56a9fa0dcbef461039937de22b1cbecc7d
treeb02abbf2d0059111b09d01fd34dace24d7c38fc6
parent26c171fc48539ac88d3697792b1fde9334af836c
riscv: mm: Unconditionally sfence.vma for spurious fault

Svvptc does not guarantee that it's safe to just return here. Since we
have already cleared our bit, if, theoretically, the bounded timeframe
for the accessed page to become valid still hasn't happened after sret,
we could fault again and actually crash.

Hopefully, these spurious faults should be rare enough that this is an
acceptable slowdown.

Cc: stable@vger.kernel.org
Fixes: 503638e0babf ("riscv: Stop emitting preventive sfence.vma for new vmalloc mappings")
Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
Link: https://patch.msgid.link/20260303-handle-kfence-protect-spurious-fault-v2-5-f80d8354d79d@iscas.ac.cn
Signed-off-by: Paul Walmsley <pjw@kernel.org>
arch/riscv/kernel/entry.S