]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/64s/kuap: Use mmu_has_feature()
authorMichael Ellerman <mpe@ellerman.id.au>
Thu, 17 Dec 2020 00:53:06 +0000 (11:53 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Sat, 30 Jan 2021 00:39:25 +0000 (11:39 +1100)
commitd9c82e5f0e03b024712d3b90adc63286040be09a
tree79cd8aeccdf14be69adf62f05fce5b3238ffffa4
parentb45a53db7fdbb1d2b22e99a16068872d1c3c1604
powerpc/64s/kuap: Use mmu_has_feature()

In commit 97b768cf0491 ("powerpc/64s: Use early_mmu_has_feature() in
set_kuap()") we switched the KUAP code to use early_mmu_has_feature(),
to avoid a bug where we called set_kuap() before feature patching had
been done, leading to recursion and crashes.

That path, which called probe_kernel_read() from printk(), has since
been removed, see commit d1ec3df6dbcc ("vsprintf: Do not break early
boot with probing addresses").

Additionally probe_kernel_read() no longer invokes any KUAP routines,
since commit be8c573178a2 ("maccess: rename probe_kernel_{read,write}
to copy_{from,to}_kernel_nofault") and 2527a7385307 ("powerpc: use
non-set_fs based maccess routines").

So it should now be safe to use mmu_has_feature() in the KUAP
routines, because we shouldn't invoke them prior to feature patching.

This is essentially a revert of commit 97b768cf0491 ("powerpc/64s: Use
early_mmu_has_feature() in set_kuap()"), but we've since added a
second usage of early_mmu_has_feature() in get_kuap(), so we convert
that to use mmu_has_feature() as well.

Reported-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Depends-on: 2527a7385307 ("powerpc: use non-set_fs based maccess routines").
Link: https://lore.kernel.org/r/20201217005306.895685-1-mpe@ellerman.id.au
arch/powerpc/include/asm/book3s/64/kup.h