Re: [PATCH 4/4] KVM: riscv: Fix Spectre-v1 in PMU counter access

From: Lukas Gerlach

Date: Fri Feb 27 2026 - 10:14:10 EST


Thanks for the review!

> This one also covers a non-speculation bug, since the previous condition
> used cidx > RISCV_KVM_MAX_COUNTER. :) I'll send a patch for that.

Nice catch, thanks for sending the fix.

> I noticed a few other places where mis-speculation is possible,
> see below; can you explain why they don't need protection?

They do, I missed those. Will send a v2 incorporating all four sites.

Thanks,
Lukas