Subject: [RFC PATCH 15/25] powerpc/book3s64/pkeys: Inherit correctly on fork.

From: "Aneesh Kumar K.V" <[email-masked]>
Date: Mon, 27 Apr 2020 13:34:56 +0530

Child thread.kuap value is inherited from the parent in copy_thread_tls. We still
need to make sure when the child returns from a fork in the kernel we start with the kernel
default AMR value.

Signed-off-by: Aneesh Kumar K.V <[email-masked]>
---
 arch/powerpc/kernel/process.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 78eedf0b5c30..fc4cc32d4726 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1698,6 +1698,11 @@ int copy_thread_tls(unsigned long clone_flags, unsigned long usp,
 
 	p->thread.tidr = 0;
 #endif
+	/*
+	 * Run with the current AMR value of the kernel
+	 */
+	kregs->kuap = AMR_KUAP_BLOCKED;
+	kregs->kuep = AMR_KUEP_BLOCKED;
 	kregs->nip = ppc_function_entry(f);
 	return 0;
 }
-- 
2.25.3