2021-10-19 07:34:26

by Christophe Leroy

[permalink] [raw]
Subject: [PATCH v3 00/22] powerpc: Add KUAP support for BOOKE and 40x

On booke/40x we don't have segments like book3s/32.
On booke/40x we don't have access protection groups like 8xx.

Use the PID register to provide user access protection.
Kernel address space can be accessed with any PID.
User address space has to be accessed with the PID of the user.
User PID is always not null.

Everytime the kernel is entered, set PID register to 0 and
restore PID register when returning to user.

Everytime kernel needs to access user data, PID is restored
for the access.

In TLB miss handlers, check the PID and bail out to data storage
exception when PID is 0 and accessed address is in user space.

Note that also forbids execution of user text by kernel except
when user access is unlocked. But this shouldn't be a problem
as the kernel is not supposed to ever run user text.

This series has:
- First five patches remove the complexity due to too much configurability of KUEP (ref https://github.com/linuxppc/issues/issues/379)
- Two following patches have already been submitted and are not directly related to KUAP but would conflict otherwise
- Patch 8 removes 'nosmep' kernel parameter.
- Following patches aim at refactoring the KUAP interface to reduce redundant platform specific code.
- Then comes patches 14 and 15 that add generic support frame for booke type processors
- Followed by the assembly modification for each of the 4 booke family types
- Last patch removes CONFIG_PPC_HAVE_KUAP and CONFIG_PPC_HAVE_KUEP now that all powerpc platforms have KUAP and KUEP.

Changes in v3:
- Added the first five patches plus patch 8 to reduce the configurability of KUEP
- Patch 4 also adds missing KUEP support to book3e in 32 bits PTE mode.
- Modified 6 and 7 to also remove configurability of KUEP
- Patch 19 links KUEP to KUAP
- Last patch now removes both CONFIG_PPC_HAVE_KUAP and CONFIG_PPC_HAVE_KUEP

Changes in v2:
- Rebased on top of today's merge (trivial conflict with d93f9e23744b ("powerpc/32s: Fix kuap_kernel_restore()"))
- Fix missing check in bad_kuap_fault() which led to KUAP fault on platforms where KUAP was disabled (CI g5_defconfig)
- New patch to fix PPC_KUAP_DEBUG dependency

Christophe Leroy (22):
Revert "powerpc: Inline setup_kup()"
powerpc/8xx: Activate KUEP at all time
powerpc/44x: Activate KUEP at all time
powerpc/book3e: Activate KUEP at all time
powerpc/32s: Remove capability to disable KUEP at boottime
powerpc/32s: Do kuep_lock() and kuep_unlock() in assembly
powerpc/32s: Save content of sr0 to avoid 'mfsr'
powerpc/kuep: Remove 'nosmep' boot time parameter except for book3s/64
powerpc/kuap: Add a generic intermediate layer
powerpc/kuap: Check KUAP activation in generic functions
powerpc/kuap: Remove __kuap_assert_locked()
powerpc/kuap: Add kuap_lock()
powerpc/nohash: Move setup_kuap out of 8xx.c
powerpc/config: Add CONFIG_BOOKE_OR_40x
powerpc/kuap: Prepare for supporting KUAP on BOOK3E/64
powerpc/kuap: Make PPC_KUAP_DEBUG depend on PPC_KUAP only
powerpc: Add KUAP support for BOOKE and 40x
powerpc/kuap: Wire-up KUAP on 44x
powerpc/kuap: Wire-up KUAP on 40x
powerpc/kuap: Wire-up KUAP on 85xx in 32 bits mode.
powerpc/kuap: Wire-up KUAP on book3e/64
powerpc: Remove CONFIG_PPC_HAVE_KUAP and CONFIG_PPC_HAVE_KUEP

.../admin-guide/kernel-parameters.txt | 2 +-
arch/powerpc/include/asm/book3s/32/kup.h | 108 ++++------------
arch/powerpc/include/asm/book3s/32/mmu-hash.h | 82 +++++++++++-
arch/powerpc/include/asm/book3s/64/kup.h | 56 ++++----
arch/powerpc/include/asm/hw_irq.h | 8 +-
arch/powerpc/include/asm/interrupt.h | 13 +-
arch/powerpc/include/asm/irq.h | 2 +-
arch/powerpc/include/asm/kup.h | 122 ++++++++++++++----
arch/powerpc/include/asm/nohash/32/kup-8xx.h | 50 ++-----
arch/powerpc/include/asm/nohash/32/mmu-44x.h | 1 -
arch/powerpc/include/asm/nohash/32/mmu-8xx.h | 6 +-
arch/powerpc/include/asm/nohash/kup-booke.h | 110 ++++++++++++++++
arch/powerpc/include/asm/processor.h | 12 ++
arch/powerpc/include/asm/ptrace.h | 2 +-
arch/powerpc/include/asm/reg.h | 4 +-
arch/powerpc/kernel/asm-offsets.c | 3 +-
arch/powerpc/kernel/entry_32.S | 31 ++++-
arch/powerpc/kernel/head_32.h | 6 +
arch/powerpc/kernel/head_40x.S | 8 ++
arch/powerpc/kernel/head_44x.S | 26 ++--
arch/powerpc/kernel/head_book3s_32.S | 4 +
arch/powerpc/kernel/head_fsl_booke.S | 13 ++
arch/powerpc/kernel/interrupt.c | 3 +-
arch/powerpc/kernel/irq.c | 2 +-
arch/powerpc/kernel/kgdb.c | 4 +-
arch/powerpc/kernel/process.c | 9 +-
arch/powerpc/kernel/setup.h | 2 +-
arch/powerpc/kernel/setup_32.c | 2 +-
arch/powerpc/kernel/time.c | 2 +-
arch/powerpc/mm/book3s32/Makefile | 1 -
arch/powerpc/mm/book3s32/kuap.c | 5 +-
arch/powerpc/mm/book3s32/kuep.c | 20 ---
arch/powerpc/mm/book3s32/mmu_context.c | 15 +--
arch/powerpc/mm/init-common.c | 21 +++
arch/powerpc/mm/mmu_context.c | 9 ++
arch/powerpc/mm/nohash/44x.c | 16 ---
arch/powerpc/mm/nohash/8xx.c | 33 -----
arch/powerpc/mm/nohash/Makefile | 2 +-
arch/powerpc/mm/nohash/kup.c | 33 +++++
arch/powerpc/mm/nohash/mmu_context.c | 6 +-
arch/powerpc/mm/nohash/tlb_low_64e.S | 40 +++++-
arch/powerpc/platforms/Kconfig.cputype | 30 ++---
42 files changed, 606 insertions(+), 318 deletions(-)
create mode 100644 arch/powerpc/include/asm/nohash/kup-booke.h
delete mode 100644 arch/powerpc/mm/book3s32/kuep.c
create mode 100644 arch/powerpc/mm/nohash/kup.c

--
2.31.1


2021-10-19 07:34:36

by Christophe Leroy

[permalink] [raw]
Subject: [PATCH v3 09/22] powerpc/kuap: Add a generic intermediate layer

Make the following functions generic to all platforms.
- bad_kuap_fault()
- kuap_assert_locked()
- kuap_save_and_lock() (PPC32 only)
- kuap_kernel_restore()
- kuap_get_and_assert_locked()

And for all platforms except book3s/64
- allow_user_access()
- prevent_user_access()
- prevent_user_access_return()
- restore_user_access()

Prepend __ in front of the name of platform specific ones.

For now the generic just calls the platform specific, but
next patch will move redundant parts of specific functions
into the generic one.

Signed-off-by: Christophe Leroy <[email protected]>
---
arch/powerpc/include/asm/book3s/32/kup.h | 22 +++---
arch/powerpc/include/asm/book3s/64/kup.h | 10 ++-
arch/powerpc/include/asm/kup.h | 71 +++++++++++++++++---
arch/powerpc/include/asm/nohash/32/kup-8xx.h | 20 +++---
4 files changed, 86 insertions(+), 37 deletions(-)

diff --git a/arch/powerpc/include/asm/book3s/32/kup.h b/arch/powerpc/include/asm/book3s/32/kup.h
index e3db5ed4b255..9e9b2692070c 100644
--- a/arch/powerpc/include/asm/book3s/32/kup.h
+++ b/arch/powerpc/include/asm/book3s/32/kup.h
@@ -77,7 +77,7 @@ static inline void kuap_unlock(unsigned long addr, bool ool)
kuap_unlock_all_ool();
}

-static inline void kuap_save_and_lock(struct pt_regs *regs)
+static inline void __kuap_save_and_lock(struct pt_regs *regs)
{
unsigned long kuap = current->thread.kuap;

@@ -96,7 +96,7 @@ static inline void kuap_user_restore(struct pt_regs *regs)
{
}

-static inline void kuap_kernel_restore(struct pt_regs *regs, unsigned long kuap)
+static inline void __kuap_kernel_restore(struct pt_regs *regs, unsigned long kuap)
{
if (kuap_is_disabled())
return;
@@ -114,7 +114,7 @@ static inline void kuap_kernel_restore(struct pt_regs *regs, unsigned long kuap)
kuap_unlock(regs->kuap, false);
}

-static inline unsigned long kuap_get_and_assert_locked(void)
+static inline unsigned long __kuap_get_and_assert_locked(void)
{
unsigned long kuap = current->thread.kuap;

@@ -126,13 +126,13 @@ static inline unsigned long kuap_get_and_assert_locked(void)
return kuap;
}

-static inline void kuap_assert_locked(void)
+static inline void __kuap_assert_locked(void)
{
- kuap_get_and_assert_locked();
+ __kuap_get_and_assert_locked();
}

-static __always_inline void allow_user_access(void __user *to, const void __user *from,
- u32 size, unsigned long dir)
+static __always_inline void __allow_user_access(void __user *to, const void __user *from,
+ u32 size, unsigned long dir)
{
if (kuap_is_disabled())
return;
@@ -146,7 +146,7 @@ static __always_inline void allow_user_access(void __user *to, const void __user
kuap_unlock_one((__force u32)to);
}

-static __always_inline void prevent_user_access(unsigned long dir)
+static __always_inline void __prevent_user_access(unsigned long dir)
{
u32 kuap = current->thread.kuap;

@@ -162,7 +162,7 @@ static __always_inline void prevent_user_access(unsigned long dir)
kuap_lock(kuap, true);
}

-static inline unsigned long prevent_user_access_return(void)
+static inline unsigned long __prevent_user_access_return(void)
{
unsigned long flags = current->thread.kuap;

@@ -177,7 +177,7 @@ static inline unsigned long prevent_user_access_return(void)
return flags;
}

-static inline void restore_user_access(unsigned long flags)
+static inline void __restore_user_access(unsigned long flags)
{
if (kuap_is_disabled())
return;
@@ -189,7 +189,7 @@ static inline void restore_user_access(unsigned long flags)
}

static inline bool
-bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write)
+__bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write)
{
unsigned long kuap = regs->kuap;

diff --git a/arch/powerpc/include/asm/book3s/64/kup.h b/arch/powerpc/include/asm/book3s/64/kup.h
index 170339969b7c..03d61c5205a4 100644
--- a/arch/powerpc/include/asm/book3s/64/kup.h
+++ b/arch/powerpc/include/asm/book3s/64/kup.h
@@ -268,8 +268,7 @@ static inline void kuap_user_restore(struct pt_regs *regs)
*/
}

-static inline void kuap_kernel_restore(struct pt_regs *regs,
- unsigned long amr)
+static inline void __kuap_kernel_restore(struct pt_regs *regs, unsigned long amr)
{
if (mmu_has_feature(MMU_FTR_BOOK3S_KUAP)) {
if (unlikely(regs->amr != amr)) {
@@ -287,7 +286,7 @@ static inline void kuap_kernel_restore(struct pt_regs *regs,
*/
}

-static inline unsigned long kuap_get_and_assert_locked(void)
+static inline unsigned long __kuap_get_and_assert_locked(void)
{
if (mmu_has_feature(MMU_FTR_BOOK3S_KUAP)) {
unsigned long amr = mfspr(SPRN_AMR);
@@ -298,7 +297,7 @@ static inline unsigned long kuap_get_and_assert_locked(void)
return 0;
}

-static inline void kuap_assert_locked(void)
+static inline void __kuap_assert_locked(void)
{
if (IS_ENABLED(CONFIG_PPC_KUAP_DEBUG) && mmu_has_feature(MMU_FTR_BOOK3S_KUAP))
WARN_ON_ONCE(mfspr(SPRN_AMR) != AMR_KUAP_BLOCKED);
@@ -339,8 +338,7 @@ static inline void set_kuap(unsigned long value)
isync();
}

-static inline bool bad_kuap_fault(struct pt_regs *regs, unsigned long address,
- bool is_write)
+static inline bool __bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write)
{
if (!mmu_has_feature(MMU_FTR_BOOK3S_KUAP))
return false;
diff --git a/arch/powerpc/include/asm/kup.h b/arch/powerpc/include/asm/kup.h
index fa8513b7acca..f2a6fdb45d33 100644
--- a/arch/powerpc/include/asm/kup.h
+++ b/arch/powerpc/include/asm/kup.h
@@ -41,17 +41,17 @@ void setup_kuap(bool disabled);
static inline void setup_kuap(bool disabled) { }

static inline bool
-bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write)
+__bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write)
{
return false;
}

-static inline void kuap_assert_locked(void) { }
-static inline void kuap_save_and_lock(struct pt_regs *regs) { }
+static inline void __kuap_assert_locked(void) { }
+static inline void __kuap_save_and_lock(struct pt_regs *regs) { }
static inline void kuap_user_restore(struct pt_regs *regs) { }
-static inline void kuap_kernel_restore(struct pt_regs *regs, unsigned long amr) { }
+static inline void __kuap_kernel_restore(struct pt_regs *regs, unsigned long amr) { }

-static inline unsigned long kuap_get_and_assert_locked(void)
+static inline unsigned long __kuap_get_and_assert_locked(void)
{
return 0;
}
@@ -62,14 +62,65 @@ static inline unsigned long kuap_get_and_assert_locked(void)
* platforms.
*/
#ifndef CONFIG_PPC_BOOK3S_64
-static inline void allow_user_access(void __user *to, const void __user *from,
- unsigned long size, unsigned long dir) { }
-static inline void prevent_user_access(unsigned long dir) { }
-static inline unsigned long prevent_user_access_return(void) { return 0UL; }
-static inline void restore_user_access(unsigned long flags) { }
+static inline void __allow_user_access(void __user *to, const void __user *from,
+ unsigned long size, unsigned long dir) { }
+static inline void __prevent_user_access(unsigned long dir) { }
+static inline unsigned long __prevent_user_access_return(void) { return 0UL; }
+static inline void __restore_user_access(unsigned long flags) { }
#endif /* CONFIG_PPC_BOOK3S_64 */
#endif /* CONFIG_PPC_KUAP */

+static __always_inline bool
+bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write)
+{
+ return __bad_kuap_fault(regs, address, is_write);
+}
+
+static __always_inline void kuap_assert_locked(void)
+{
+ __kuap_assert_locked();
+}
+
+#ifdef CONFIG_PPC32
+static __always_inline void kuap_save_and_lock(struct pt_regs *regs)
+{
+ __kuap_save_and_lock(regs);
+}
+#endif
+
+static __always_inline void kuap_kernel_restore(struct pt_regs *regs, unsigned long amr)
+{
+ __kuap_kernel_restore(regs, amr);
+}
+
+static __always_inline unsigned long kuap_get_and_assert_locked(void)
+{
+ return __kuap_get_and_assert_locked();
+}
+
+#ifndef CONFIG_PPC_BOOK3S_64
+static __always_inline void allow_user_access(void __user *to, const void __user *from,
+ unsigned long size, unsigned long dir)
+{
+ __allow_user_access(to, from, size, dir);
+}
+
+static __always_inline void prevent_user_access(unsigned long dir)
+{
+ __prevent_user_access(dir);
+}
+
+static __always_inline unsigned long prevent_user_access_return(void)
+{
+ return __prevent_user_access_return();
+}
+
+static __always_inline void restore_user_access(unsigned long flags)
+{
+ __restore_user_access(flags);
+}
+#endif /* CONFIG_PPC_BOOK3S_64 */
+
static __always_inline void allow_read_from_user(const void __user *from, unsigned long size)
{
barrier_nospec();
diff --git a/arch/powerpc/include/asm/nohash/32/kup-8xx.h b/arch/powerpc/include/asm/nohash/32/kup-8xx.h
index 882a0bc7887a..a5db84164afd 100644
--- a/arch/powerpc/include/asm/nohash/32/kup-8xx.h
+++ b/arch/powerpc/include/asm/nohash/32/kup-8xx.h
@@ -20,7 +20,7 @@ static __always_inline bool kuap_is_disabled(void)
return static_branch_unlikely(&disable_kuap_key);
}

-static inline void kuap_save_and_lock(struct pt_regs *regs)
+static inline void __kuap_save_and_lock(struct pt_regs *regs)
{
if (kuap_is_disabled())
return;
@@ -33,7 +33,7 @@ static inline void kuap_user_restore(struct pt_regs *regs)
{
}

-static inline void kuap_kernel_restore(struct pt_regs *regs, unsigned long kuap)
+static inline void __kuap_kernel_restore(struct pt_regs *regs, unsigned long kuap)
{
if (kuap_is_disabled())
return;
@@ -41,7 +41,7 @@ static inline void kuap_kernel_restore(struct pt_regs *regs, unsigned long kuap)
mtspr(SPRN_MD_AP, regs->kuap);
}

-static inline unsigned long kuap_get_and_assert_locked(void)
+static inline unsigned long __kuap_get_and_assert_locked(void)
{
unsigned long kuap;

@@ -56,14 +56,14 @@ static inline unsigned long kuap_get_and_assert_locked(void)
return kuap;
}

-static inline void kuap_assert_locked(void)
+static inline void __kuap_assert_locked(void)
{
if (IS_ENABLED(CONFIG_PPC_KUAP_DEBUG) && !kuap_is_disabled())
kuap_get_and_assert_locked();
}

-static inline void allow_user_access(void __user *to, const void __user *from,
- unsigned long size, unsigned long dir)
+static inline void __allow_user_access(void __user *to, const void __user *from,
+ unsigned long size, unsigned long dir)
{
if (kuap_is_disabled())
return;
@@ -71,7 +71,7 @@ static inline void allow_user_access(void __user *to, const void __user *from,
mtspr(SPRN_MD_AP, MD_APG_INIT);
}

-static inline void prevent_user_access(unsigned long dir)
+static inline void __prevent_user_access(unsigned long dir)
{
if (kuap_is_disabled())
return;
@@ -79,7 +79,7 @@ static inline void prevent_user_access(unsigned long dir)
mtspr(SPRN_MD_AP, MD_APG_KUAP);
}

-static inline unsigned long prevent_user_access_return(void)
+static inline unsigned long __prevent_user_access_return(void)
{
unsigned long flags;

@@ -93,7 +93,7 @@ static inline unsigned long prevent_user_access_return(void)
return flags;
}

-static inline void restore_user_access(unsigned long flags)
+static inline void __restore_user_access(unsigned long flags)
{
if (kuap_is_disabled())
return;
@@ -102,7 +102,7 @@ static inline void restore_user_access(unsigned long flags)
}

static inline bool
-bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write)
+__bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write)
{
if (kuap_is_disabled())
return false;
--
2.31.1

2021-10-19 07:34:46

by Christophe Leroy

[permalink] [raw]
Subject: [PATCH v3 14/22] powerpc/config: Add CONFIG_BOOKE_OR_40x

We have many functionnalities common to 40x and BOOKE, it leads to
many places with #if defined(CONFIG_BOOKE) || defined(CONFIG_40x).

We are going to add a few more with KUAP for booke/40x, so create
a new symbol which is defined when either BOOKE or 40x is defined.

Signed-off-by: Christophe Leroy <[email protected]>
---
arch/powerpc/include/asm/hw_irq.h | 8 ++++----
arch/powerpc/include/asm/irq.h | 2 +-
arch/powerpc/include/asm/ptrace.h | 2 +-
arch/powerpc/include/asm/reg.h | 4 ++--
arch/powerpc/kernel/asm-offsets.c | 2 +-
arch/powerpc/kernel/entry_32.S | 2 +-
arch/powerpc/kernel/irq.c | 2 +-
arch/powerpc/kernel/kgdb.c | 4 ++--
arch/powerpc/kernel/setup.h | 2 +-
arch/powerpc/kernel/setup_32.c | 2 +-
arch/powerpc/kernel/time.c | 2 +-
arch/powerpc/platforms/Kconfig.cputype | 5 +++++
12 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index 21cc571ea9c2..276e9dd7348b 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -61,7 +61,7 @@

static inline void __hard_irq_enable(void)
{
- if (IS_ENABLED(CONFIG_BOOKE) || IS_ENABLED(CONFIG_40x))
+ if (IS_ENABLED(CONFIG_BOOKE_OR_40x))
wrtee(MSR_EE);
else if (IS_ENABLED(CONFIG_PPC_8xx))
wrtspr(SPRN_EIE);
@@ -73,7 +73,7 @@ static inline void __hard_irq_enable(void)

static inline void __hard_irq_disable(void)
{
- if (IS_ENABLED(CONFIG_BOOKE) || IS_ENABLED(CONFIG_40x))
+ if (IS_ENABLED(CONFIG_BOOKE_OR_40x))
wrtee(0);
else if (IS_ENABLED(CONFIG_PPC_8xx))
wrtspr(SPRN_EID);
@@ -85,7 +85,7 @@ static inline void __hard_irq_disable(void)

static inline void __hard_EE_RI_disable(void)
{
- if (IS_ENABLED(CONFIG_BOOKE) || IS_ENABLED(CONFIG_40x))
+ if (IS_ENABLED(CONFIG_BOOKE_OR_40x))
wrtee(0);
else if (IS_ENABLED(CONFIG_PPC_8xx))
wrtspr(SPRN_NRI);
@@ -97,7 +97,7 @@ static inline void __hard_EE_RI_disable(void)

static inline void __hard_RI_enable(void)
{
- if (IS_ENABLED(CONFIG_BOOKE) || IS_ENABLED(CONFIG_40x))
+ if (IS_ENABLED(CONFIG_BOOKE_OR_40x))
return;

if (IS_ENABLED(CONFIG_PPC_8xx))
diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h
index 2b3278534bc1..13f0409dd617 100644
--- a/arch/powerpc/include/asm/irq.h
+++ b/arch/powerpc/include/asm/irq.h
@@ -36,7 +36,7 @@ extern int distribute_irqs;

struct pt_regs;

-#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
+#ifdef CONFIG_BOOKE_OR_40x
/*
* Per-cpu stacks for handling critical, debug and machine check
* level interrupts.
diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
index 6e560f035614..42f89e2d8f04 100644
--- a/arch/powerpc/include/asm/ptrace.h
+++ b/arch/powerpc/include/asm/ptrace.h
@@ -291,7 +291,7 @@ static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc)

static inline bool cpu_has_msr_ri(void)
{
- return !IS_ENABLED(CONFIG_BOOKE) && !IS_ENABLED(CONFIG_40x);
+ return !IS_ENABLED(CONFIG_BOOKE_OR_40x);
}

static inline bool regs_is_unrecoverable(struct pt_regs *regs)
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index e9d27265253b..50478738c8f1 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -18,9 +18,9 @@
#include <asm/feature-fixups.h>

/* Pickup Book E specific registers. */
-#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
+#ifdef CONFIG_BOOKE_OR_40x
#include <asm/reg_booke.h>
-#endif /* CONFIG_BOOKE || CONFIG_40x */
+#endif

#ifdef CONFIG_FSL_EMB_PERFMON
#include <asm/reg_fsl_emb.h>
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 256aa669cf80..40a631ae5ba5 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -56,7 +56,7 @@
#endif

#ifdef CONFIG_PPC32
-#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
+#ifdef CONFIG_BOOKE_OR_40x
#include "head_booke.h"
#endif
#endif
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index cf3cc0e52d07..62c244ffa489 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -105,7 +105,7 @@ transfer_to_syscall:
stw r11, 0(r1)
mflr r12
stw r12, _LINK(r1)
-#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
+#ifdef CONFIG_BOOKE_OR_40x
rlwinm r9,r9,0,14,12 /* clear MSR_WE (necessary?) */
#endif
lis r12,STACK_FRAME_REGS_MARKER@ha /* exception frame marker */
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index c4f1d6b7d992..8207f97d51e8 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -811,7 +811,7 @@ void __init init_IRQ(void)
ppc_md.init_IRQ();
}

-#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
+#ifdef CONFIG_BOOKE_OR_40x
void *critirq_ctx[NR_CPUS] __read_mostly;
void *dbgirq_ctx[NR_CPUS] __read_mostly;
void *mcheckirq_ctx[NR_CPUS] __read_mostly;
diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index bdee7262c080..9f8d0fa7b718 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -48,7 +48,7 @@ static struct hard_trap_info
{ 0x0800, 0x08 /* SIGFPE */ }, /* fp unavailable */
{ 0x0900, 0x0e /* SIGALRM */ }, /* decrementer */
{ 0x0c00, 0x14 /* SIGCHLD */ }, /* system call */
-#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
+#ifdef CONFIG_BOOKE_OR_40x
{ 0x2002, 0x05 /* SIGTRAP */ }, /* debug */
#if defined(CONFIG_FSL_BOOKE)
{ 0x2010, 0x08 /* SIGFPE */ }, /* spe unavailable */
@@ -67,7 +67,7 @@ static struct hard_trap_info
{ 0x2010, 0x08 /* SIGFPE */ }, /* fp unavailable */
{ 0x2020, 0x08 /* SIGFPE */ }, /* ap unavailable */
#endif
-#else /* ! (defined(CONFIG_40x) || defined(CONFIG_BOOKE)) */
+#else /* !CONFIG_BOOKE_OR_40x */
{ 0x0d00, 0x05 /* SIGTRAP */ }, /* single-step */
#if defined(CONFIG_PPC_8xx)
{ 0x1000, 0x04 /* SIGILL */ }, /* software emulation */
diff --git a/arch/powerpc/kernel/setup.h b/arch/powerpc/kernel/setup.h
index 84058bbc8fe9..93f22da12abe 100644
--- a/arch/powerpc/kernel/setup.h
+++ b/arch/powerpc/kernel/setup.h
@@ -29,7 +29,7 @@ void setup_tlb_core_data(void);
static inline void setup_tlb_core_data(void) { }
#endif

-#if defined(CONFIG_PPC_BOOK3E) || defined(CONFIG_BOOKE) || defined(CONFIG_40x)
+#ifdef CONFIG_BOOKE_OR_40x
void exc_lvl_early_init(void);
#else
static inline void exc_lvl_early_init(void) { }
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 7ec5c47fce0e..15e7386584f9 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -175,7 +175,7 @@ void __init emergency_stack_init(void)
}
#endif

-#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
+#ifdef CONFIG_BOOKE_OR_40x
void __init exc_lvl_early_init(void)
{
unsigned int i, hw_cpu;
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 934d8ae66cc6..f7bb2866a1c4 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -738,7 +738,7 @@ static int __init get_freq(char *name, int cells, unsigned long *val)

static void start_cpu_decrementer(void)
{
-#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
+#ifdef CONFIG_BOOKE_OR_40x
unsigned int tcr;

/* Clear any pending timer interrupts */
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 68361ab7078d..f58f9edf9b28 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -280,6 +280,11 @@ config BOOKE
depends on E500 || 44x || PPC_BOOK3E
default y

+config BOOKE_OR_40x
+ bool
+ depends on BOOKE || 40x
+ default y
+
config FSL_BOOKE
bool
depends on E500 && PPC32
--
2.31.1

2021-10-19 07:34:49

by Christophe Leroy

[permalink] [raw]
Subject: [PATCH v3 02/22] powerpc/8xx: Activate KUEP at all time

On the 8xx, there is absolutely no runtime impact with KUEP. Protection
against execution of user code in kernel mode is set up at boot time
by configuring the groups with contain all user pages as having swapped
protection rights, in extenso EX for user and NA for supervisor.

Configure KUEP at startup and force selection of CONFIG_PPC_KUEP.

Signed-off-by: Christophe Leroy <[email protected]>
---
arch/powerpc/include/asm/nohash/32/mmu-8xx.h | 6 ++----
arch/powerpc/mm/nohash/8xx.c | 5 -----
arch/powerpc/platforms/Kconfig.cputype | 1 +
3 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/include/asm/nohash/32/mmu-8xx.h b/arch/powerpc/include/asm/nohash/32/mmu-8xx.h
index 997cec973406..0e93a4728c9e 100644
--- a/arch/powerpc/include/asm/nohash/32/mmu-8xx.h
+++ b/arch/powerpc/include/asm/nohash/32/mmu-8xx.h
@@ -39,12 +39,10 @@
* 0 => Kernel => 11 (all accesses performed according as user iaw page definition)
* 1 => Kernel+Accessed => 01 (all accesses performed according to page definition)
* 2 => User => 11 (all accesses performed according as user iaw page definition)
- * 3 => User+Accessed => 00 (all accesses performed as supervisor iaw page definition) for INIT
- * => 10 (all accesses performed according to swaped page definition) for KUEP
+ * 3 => User+Accessed => 10 (all accesses performed according to swaped page definition) for KUEP
* 4-15 => Not Used
*/
-#define MI_APG_INIT 0xdc000000
-#define MI_APG_KUEP 0xde000000
+#define MI_APG_INIT 0xde000000

/* The effective page number register. When read, contains the information
* about the last instruction TLB miss. When MI_RPN is written, bits in
diff --git a/arch/powerpc/mm/nohash/8xx.c b/arch/powerpc/mm/nohash/8xx.c
index baa1f8a40af8..e878e8124ee6 100644
--- a/arch/powerpc/mm/nohash/8xx.c
+++ b/arch/powerpc/mm/nohash/8xx.c
@@ -215,12 +215,7 @@ void __init setup_initial_memory_limit(phys_addr_t first_memblock_base,
#ifdef CONFIG_PPC_KUEP
void setup_kuep(bool disabled)
{
- if (disabled)
- return;
-
pr_info("Activating Kernel Userspace Execution Prevention\n");
-
- mtspr(SPRN_MI_AP, MI_APG_KUEP);
}
#endif

diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index a208997ade88..66650ec1c7e6 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -43,6 +43,7 @@ config PPC_8xx
select ARCH_SUPPORTS_HUGETLBFS
select FSL_SOC
select PPC_HAVE_KUEP
+ select PPC_KUEP
select PPC_HAVE_KUAP
select HAVE_ARCH_VMAP_STACK
select HUGETLBFS
--
2.31.1

2021-10-19 07:35:10

by Christophe Leroy

[permalink] [raw]
Subject: [PATCH v3 01/22] Revert "powerpc: Inline setup_kup()"

This reverts commit 1791ebd131c46539b024c0f2ebf12b6c88a265b9.

setup_kup() was inlined to manage conflict between PPC32 marking
setup_{kuap/kuep}() __init and PPC64 not marking them __init.

But in fact PPC32 has removed the __init mark for all but 8xx
in order to properly handle SMP.

In order to make setup_kup() grow a bit, revert the commit
mentioned above but remove __init for 8xx as well so that
we don't have to mark setup_kup() as __ref.

Also switch the order so that KUAP is initialised before KUEP
because on the 40x, KUEP will depend on the activation of KUAP.

Signed-off-by: Christophe Leroy <[email protected]>
---
arch/powerpc/include/asm/kup.h | 8 ++------
arch/powerpc/mm/init-common.c | 6 ++++++
arch/powerpc/mm/nohash/8xx.c | 4 ++--
3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/include/asm/kup.h b/arch/powerpc/include/asm/kup.h
index 1df763002726..8699ca5884b9 100644
--- a/arch/powerpc/include/asm/kup.h
+++ b/arch/powerpc/include/asm/kup.h
@@ -32,6 +32,8 @@ extern bool disable_kuap;

#include <linux/pgtable.h>

+void setup_kup(void);
+
#ifdef CONFIG_PPC_KUEP
void setup_kuep(bool disabled);
#else
@@ -78,12 +80,6 @@ static inline void restore_user_access(unsigned long flags) { }
#endif /* CONFIG_PPC_BOOK3S_64 */
#endif /* CONFIG_PPC_KUAP */

-static __always_inline void setup_kup(void)
-{
- setup_kuep(disable_kuep);
- setup_kuap(disable_kuap);
-}
-
static __always_inline void allow_read_from_user(const void __user *from, unsigned long size)
{
barrier_nospec();
diff --git a/arch/powerpc/mm/init-common.c b/arch/powerpc/mm/init-common.c
index 3a82f89827a5..b4f3437aee38 100644
--- a/arch/powerpc/mm/init-common.c
+++ b/arch/powerpc/mm/init-common.c
@@ -47,6 +47,12 @@ static int __init parse_nosmap(char *p)
}
early_param("nosmap", parse_nosmap);

+void setup_kup(void)
+{
+ setup_kuap(disable_kuap);
+ setup_kuep(disable_kuep);
+}
+
#define CTOR(shift) static void ctor_##shift(void *addr) \
{ \
memset(addr, 0, sizeof(void *) << (shift)); \
diff --git a/arch/powerpc/mm/nohash/8xx.c b/arch/powerpc/mm/nohash/8xx.c
index 0df9fe29dd56..baa1f8a40af8 100644
--- a/arch/powerpc/mm/nohash/8xx.c
+++ b/arch/powerpc/mm/nohash/8xx.c
@@ -213,7 +213,7 @@ void __init setup_initial_memory_limit(phys_addr_t first_memblock_base,
}

#ifdef CONFIG_PPC_KUEP
-void __init setup_kuep(bool disabled)
+void setup_kuep(bool disabled)
{
if (disabled)
return;
@@ -228,7 +228,7 @@ void __init setup_kuep(bool disabled)
struct static_key_false disable_kuap_key;
EXPORT_SYMBOL(disable_kuap_key);

-void __init setup_kuap(bool disabled)
+void setup_kuap(bool disabled)
{
if (disabled) {
static_branch_enable(&disable_kuap_key);
--
2.31.1

2021-10-19 07:36:01

by Christophe Leroy

[permalink] [raw]
Subject: [PATCH v3 19/22] powerpc/kuap: Wire-up KUAP on 40x

This adds KUAP support to 40x. This is done by checking
the content of SPRN_PID at the time user pgtable is loaded.

40x doesn't have KUEP, but KUAP implies KUEP because when the
PID doesn't match the page's PID, the page cannot be read nor
executed.

So KUEP is now automatically selected when KUAP is selected and
disabled when KUAP is disabled.

Signed-off-by: Christophe Leroy <[email protected]>
---
arch/powerpc/kernel/head_40x.S | 8 ++++++++
arch/powerpc/mm/nohash/kup.c | 2 ++
arch/powerpc/platforms/Kconfig.cputype | 7 +++++--
3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S
index 7d72ee5ab387..87d322dbed94 100644
--- a/arch/powerpc/kernel/head_40x.S
+++ b/arch/powerpc/kernel/head_40x.S
@@ -297,6 +297,10 @@ _ASM_NOKPROBE_SYMBOL(\name\()_virt)
3:
mfspr r11,SPRN_SPRG_THREAD
lwz r11,PGDIR(r11)
+#ifdef CONFIG_PPC_KUAP
+ rlwinm. r9, r9, 0, 0xff
+ beq 5f /* Kuap fault */
+#endif
4:
tophys(r11, r11)
rlwimi r11, r10, 12, 20, 29 /* Create L1 (pgdir/pmd) address */
@@ -377,6 +381,10 @@ _ASM_NOKPROBE_SYMBOL(\name\()_virt)
3:
mfspr r11,SPRN_SPRG_THREAD
lwz r11,PGDIR(r11)
+#ifdef CONFIG_PPC_KUAP
+ rlwinm. r9, r9, 0, 0xff
+ beq 5f /* Kuap fault */
+#endif
4:
tophys(r11, r11)
rlwimi r11, r10, 12, 20, 29 /* Create L1 (pgdir/pmd) address */
diff --git a/arch/powerpc/mm/nohash/kup.c b/arch/powerpc/mm/nohash/kup.c
index eaea52231dd6..552becf90e97 100644
--- a/arch/powerpc/mm/nohash/kup.c
+++ b/arch/powerpc/mm/nohash/kup.c
@@ -19,6 +19,8 @@ EXPORT_SYMBOL(disable_kuap_key);
void setup_kuap(bool disabled)
{
if (disabled) {
+ if (IS_ENABLED(CONFIG_40x))
+ disable_kuep = true;
if (smp_processor_id() == boot_cpuid)
static_branch_enable(&disable_kuap_key);
return;
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index e989eeca4c7e..3ea415bcf9b8 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -54,6 +54,9 @@ config 40x
select PPC_UDBG_16550
select 4xx_SOC
select HAVE_PCI
+ select PPC_HAVE_KUAP
+ select PPC_HAVE_KUEP
+ select PPC_KUEP if PPC_KUAP

config 44x
bool "AMCC 44x, 46x or 47x"
@@ -401,9 +404,9 @@ config PPC_HAVE_KUEP
bool

config PPC_KUEP
- bool "Kernel Userspace Execution Prevention"
+ bool "Kernel Userspace Execution Prevention" if !40x
depends on PPC_HAVE_KUEP
- default y
+ default y if !40x
help
Enable support for Kernel Userspace Execution Prevention (KUEP)

--
2.31.1

2021-10-19 07:36:24

by Christophe Leroy

[permalink] [raw]
Subject: [PATCH v3 18/22] powerpc/kuap: Wire-up KUAP on 44x

This adds KUAP support to 44x. This is done by checking
the content of SPRN_PID at the time it is read and written
into SPRN_MMUCR.

Signed-off-by: Christophe Leroy <[email protected]>
---
arch/powerpc/kernel/head_44x.S | 16 ++++++++++++++++
arch/powerpc/platforms/Kconfig.cputype | 1 +
2 files changed, 17 insertions(+)

diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
index 916f7e91c6de..b73a56466903 100644
--- a/arch/powerpc/kernel/head_44x.S
+++ b/arch/powerpc/kernel/head_44x.S
@@ -334,6 +334,10 @@ interrupt_base:
mfspr r12,SPRN_MMUCR
mfspr r13,SPRN_PID /* Get PID */
rlwimi r12,r13,0,24,31 /* Set TID */
+#ifdef CONFIG_PPC_KUAP
+ cmpwi r13,0
+ beq 2f /* KUAP Fault */
+#endif

4:
mtspr SPRN_MMUCR,r12
@@ -444,6 +448,10 @@ interrupt_base:
mfspr r12,SPRN_MMUCR
mfspr r13,SPRN_PID /* Get PID */
rlwimi r12,r13,0,24,31 /* Set TID */
+#ifdef CONFIG_PPC_KUAP
+ cmpwi r13,0
+ beq 2f /* KUAP Fault */
+#endif

4:
mtspr SPRN_MMUCR,r12
@@ -572,6 +580,10 @@ finish_tlb_load_44x:
3: mfspr r11,SPRN_SPRG3
lwz r11,PGDIR(r11)
mfspr r12,SPRN_PID /* Get PID */
+#ifdef CONFIG_PPC_KUAP
+ cmpwi r12,0
+ beq 2f /* KUAP Fault */
+#endif
4: mtspr SPRN_MMUCR,r12 /* Set MMUCR */

/* Mask of required permission bits. Note that while we
@@ -669,6 +681,10 @@ finish_tlb_load_44x:
3: mfspr r11,SPRN_SPRG_THREAD
lwz r11,PGDIR(r11)
mfspr r12,SPRN_PID /* Get PID */
+#ifdef CONFIG_PPC_KUAP
+ cmpwi r12,0
+ beq 2f /* KUAP Fault */
+#endif
4: mtspr SPRN_MMUCR,r12 /* Set MMUCR */

/* Make up the required permissions */
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index fad34f28bd3a..e989eeca4c7e 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -64,6 +64,7 @@ config 44x
select PHYS_64BIT
select PPC_HAVE_KUEP
select PPC_KUEP
+ select PPC_HAVE_KUAP

endchoice

--
2.31.1

2021-10-19 07:37:00

by Christophe Leroy

[permalink] [raw]
Subject: [PATCH v3 20/22] powerpc/kuap: Wire-up KUAP on 85xx in 32 bits mode.

This adds KUAP support to 85xx in 32 bits mode.
This is done by reading the content of SPRN_MAS1 and checking
the TID at the time user pgtable is loaded.

Signed-off-by: Christophe Leroy <[email protected]>
---
arch/powerpc/kernel/head_fsl_booke.S | 12 ++++++++++++
arch/powerpc/platforms/Kconfig.cputype | 1 +
2 files changed, 13 insertions(+)

diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 4622b50a5208..ac2b4dcf5fd3 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -462,6 +462,12 @@ END_BTB_FLUSH_SECTION
mfspr r11,SPRN_SPRG_THREAD
lwz r11,PGDIR(r11)

+#ifdef CONFIG_PPC_KUAP
+ mfspr r12, SPRN_MAS1
+ rlwinm. r12,r12,0,0x3fff0000
+ beq 2f /* KUAP fault */
+#endif
+
4:
/* Mask of required permission bits. Note that while we
* do copy ESR:ST to _PAGE_RW position as trying to write
@@ -571,6 +577,12 @@ END_BTB_FLUSH_SECTION
mfspr r11,SPRN_SPRG_THREAD
lwz r11,PGDIR(r11)

+#ifdef CONFIG_PPC_KUAP
+ mfspr r12, SPRN_MAS1
+ rlwinm. r12,r12,0,0x3fff0000
+ beq 2f /* KUAP fault */
+#endif
+
/* Make up the required permissions for user code */
#ifdef CONFIG_PTE_64BIT
li r13,_PAGE_PRESENT | _PAGE_BAP_UX
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 3ea415bcf9b8..611d6efc047b 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -37,6 +37,7 @@ config PPC_BOOK3S_32
config PPC_85xx
bool "Freescale 85xx"
select E500
+ select PPC_HAVE_KUAP

config PPC_8xx
bool "Freescale 8xx"
--
2.31.1

2021-12-15 00:27:03

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH v3 00/22] powerpc: Add KUAP support for BOOKE and 40x

On Tue, 19 Oct 2021 09:29:11 +0200, Christophe Leroy wrote:
> On booke/40x we don't have segments like book3s/32.
> On booke/40x we don't have access protection groups like 8xx.
>
> Use the PID register to provide user access protection.
> Kernel address space can be accessed with any PID.
> User address space has to be accessed with the PID of the user.
> User PID is always not null.
>
> [...]

Applied to powerpc/next.

[01/22] Revert "powerpc: Inline setup_kup()"
https://git.kernel.org/powerpc/c/6c1fa60d368e6b752e1612eae9bb0970e85392b2
[02/22] powerpc/8xx: Activate KUEP at all time
https://git.kernel.org/powerpc/c/13dac4e31e75ce10b2fcaad4432a24dae6c955f6
[03/22] powerpc/44x: Activate KUEP at all time
https://git.kernel.org/powerpc/c/ee2631603fdbab6f76e86ea87f7a03ebc3a1ef85
[04/22] powerpc/book3e: Activate KUEP at all time
https://git.kernel.org/powerpc/c/dc3a0e5b83a8806d7da1f343a7d2e0be386d16d2
[05/22] powerpc/32s: Remove capability to disable KUEP at boottime
https://git.kernel.org/powerpc/c/df415cd758261bceff27f34a145dd8328bbfb018
[06/22] powerpc/32s: Do kuep_lock() and kuep_unlock() in assembly
https://git.kernel.org/powerpc/c/526d4a4c77aedf1b7df1133e5cced29c70232e6e
[07/22] powerpc/32s: Save content of sr0 to avoid 'mfsr'
https://git.kernel.org/powerpc/c/70428da94c7ad692d306747a04117543827292a7
[08/22] powerpc/kuep: Remove 'nosmep' boot time parameter except for book3s/64
https://git.kernel.org/powerpc/c/6754862249d324b11f1361a5353e234325d805ec
[09/22] powerpc/kuap: Add a generic intermediate layer
https://git.kernel.org/powerpc/c/ba454f9c8e4efcc47c772b7642a5c8c6d1343cbf
[10/22] powerpc/kuap: Check KUAP activation in generic functions
https://git.kernel.org/powerpc/c/c252f3846d3114542c606618995e3cbc11775357
[11/22] powerpc/kuap: Remove __kuap_assert_locked()
https://git.kernel.org/powerpc/c/2341964e27b02b2ca1deef8a18df59d1db7b9085
[12/22] powerpc/kuap: Add kuap_lock()
https://git.kernel.org/powerpc/c/937fb7003ee1f37faed1f1a4ece46e8a14863d92
[13/22] powerpc/nohash: Move setup_kuap out of 8xx.c
https://git.kernel.org/powerpc/c/25ae981fafaa140a12e4c830992b4fe997071124
[14/22] powerpc/config: Add CONFIG_BOOKE_OR_40x
https://git.kernel.org/powerpc/c/047a6fd40199eb55ffd18091f7ceae9743d972bf
[15/22] powerpc/kuap: Prepare for supporting KUAP on BOOK3E/64
https://git.kernel.org/powerpc/c/42e03bc5240b75007682d9941ef672d12828fc70
[16/22] powerpc/kuap: Make PPC_KUAP_DEBUG depend on PPC_KUAP only
https://git.kernel.org/powerpc/c/e3c02f25b4296c48376b8edb6aadcec460e803bc
[17/22] powerpc: Add KUAP support for BOOKE and 40x
https://git.kernel.org/powerpc/c/43afcf8f0101279cf4243bb4f9f9b249ddd8613c
[18/22] powerpc/kuap: Wire-up KUAP on 44x
https://git.kernel.org/powerpc/c/f6fad4fb55936f0d613cea08341d187d691d6440
[19/22] powerpc/kuap: Wire-up KUAP on 40x
https://git.kernel.org/powerpc/c/fcf9bb6d32f8a268bc3daf3281e3beefabec4e7c
[20/22] powerpc/kuap: Wire-up KUAP on 85xx in 32 bits mode.
https://git.kernel.org/powerpc/c/4f6a025201a290316b28a2a0ef9950398bd75088
[21/22] powerpc/kuap: Wire-up KUAP on book3e/64
https://git.kernel.org/powerpc/c/57bc963837f5f1753a1d51fada54a32b8a84fdc3
[22/22] powerpc: Remove CONFIG_PPC_HAVE_KUAP and CONFIG_PPC_HAVE_KUEP
https://git.kernel.org/powerpc/c/dede19be5163cdc5b5d65a2ce7e7f6eedcb666ff

cheers