]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/64s: Fix stf mitigation patching w/strict RWX & hash
authorMichael Ellerman <mpe@ellerman.id.au>
Thu, 13 May 2021 14:08:00 +0000 (00:08 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 14 May 2021 07:27:37 +0000 (17:27 +1000)
commit86b5e8472b6c676abe282b54dfec9bf71b342070
treee87e6b90e7fa12a56f765b7cd181939ecaad1d6b
parentbe47a194ddce6eb7db9b15203f95681d0d57c246
powerpc/64s: Fix stf mitigation patching w/strict RWX & hash

The stf entry barrier fallback is unsafe to execute in a semi-patched
state, which can happen when enabling/disabling the mitigation with
strict kernel RWX enabled and using the hash MMU.

See the previous commit for more details.

Fix it by changing the order in which we patch the instructions.

Note the stf barrier fallback is only used on Power6 or earlier.

Fixes: a7b8a922658f ("powerpc/mm/64s: Allow STRICT_KERNEL_RWX again")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210513140800.1391706-2-mpe@ellerman.id.au
arch/powerpc/lib/feature-fixups.c