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

From: Palmer Dabbelt
Date: Wed Jul 05 2023 - 19:40:53 EST



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@xxxxxxxxxxxx>