]> git.baikalelectronics.ru Git - kernel.git/commit
riscv: Fixup race condition on PG_dcache_clean in flush_icache_pte
authorGuo Ren <guoren@linux.alibaba.com>
Fri, 27 Jan 2023 03:53:06 +0000 (22:53 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Feb 2023 11:50:33 +0000 (12:50 +0100)
commit51430d2ce7bb7ff3353b73a344a4de0359554b17
tree20cef99ac5aad24131b0bd15a22019cc4145c5dd
parente45ca87e7abc29a28f8bed040cf8d6e4f00ea21b
riscv: Fixup race condition on PG_dcache_clean in flush_icache_pte

commit 950b879b7f0251317d26bae0687e72592d607532 upstream.

In commit 4e5fb32dac98 ("arm64: Fix race condition on PG_dcache_clean
in __sync_icache_dcache()"), we found RISC-V has the same issue as the
previous arm64. The previous implementation didn't guarantee the correct
sequence of operations, which means flush_icache_all() hasn't been
called when the PG_dcache_clean was set. That would cause a risk of page
synchronization.

Fixes: 0ec38a285d65 ("RISC-V: Flush I$ when making a dirty page executable")
Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Signed-off-by: Guo Ren <guoren@kernel.org>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20230127035306.1819561-1-guoren@kernel.org
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/riscv/mm/cacheflush.c