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

Aneesh Kumar K.V aneesh.kumar at linux.ibm.com
Mon Apr 27 18:04:56 AEST 2020


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 <aneesh.kumar at linux.ibm.com>
---
 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



More information about the Linuxppc-dev mailing list