[PATCH] mm: riscv: fix an unsafe pte read in huge_pte_alloc()

Palmer Dabbelt palmer at rivosinc.com
Wed Jul 5 16:38:27 PDT 2023


On Mon, 03 Jul 2023 12:00:44 -0700, John Hubbard wrote:
> The WARN_ON_ONCE() statement in riscv's huge_pte_alloc() is susceptible
> to false positives, because the pte is read twice at the C language
> level, locklessly, within the same conditional statement. Depending on
> compiler behavior, this can lead to generated machine code that actually
> reads the pte just once, or twice. Reading twice will expose the code to
> changing pte values and cause incorrect behavior.
> 
> [...]

Applied, thanks!

[1/1] mm: riscv: fix an unsafe pte read in huge_pte_alloc()
      https://git.kernel.org/palmer/c/62ba41d27612

Best regards,
-- 
Palmer Dabbelt <palmer at rivosinc.com>




More information about the linux-riscv mailing list