mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-16 23:20:03 +01:00
powerpc/64s/kuap: Use mmu_has_feature()
In commit8150a153c0("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 commit2ac5a3bf70("vsprintf: Do not break early boot with probing addresses"). Additionally probe_kernel_read() no longer invokes any KUAP routines, since commitfe557319aa("maccess: rename probe_kernel_{read,write} to copy_{from,to}_kernel_nofault") andc331652534("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 commit8150a153c0("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 <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Depends-on:c331652534("powerpc: use non-set_fs based maccess routines"). Link: https://lore.kernel.org/r/[email protected]
This commit is contained in:
1 parent
52f6b0a90b
commit
7613f5a66b
1 file changed
+2
-2
@@ -333,7 +333,7 @@ static inline unsigned long get_kuap(void)
|
||||
* This has no effect in terms of actually blocking things on hash,
|
||||
* so it doesn't break anything.
|
||||
*/
|
||||
if (!early_mmu_has_feature(MMU_FTR_BOOK3S_KUAP))
|
||||
if (!mmu_has_feature(MMU_FTR_BOOK3S_KUAP))
|
||||
return AMR_KUAP_BLOCKED;
|
||||
|
||||
return mfspr(SPRN_AMR);
|
||||
@@ -341,7 +341,7 @@ static inline unsigned long get_kuap(void)
|
||||
|
||||
static inline void set_kuap(unsigned long value)
|
||||
{
|
||||
if (!early_mmu_has_feature(MMU_FTR_BOOK3S_KUAP))
|
||||
if (!mmu_has_feature(MMU_FTR_BOOK3S_KUAP))
|
||||
return;
|
||||
|
||||
/*
|
||||
|
||||
Reference in new issue
Block a user