Skip to content

Commit

Permalink
powerpc/book3s64/pkeys: Inherit correctly on fork.
Browse files Browse the repository at this point in the history
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@linux.ibm.com>
Reviewed-by: Sandipan Das <sandipan@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201127044424.40686-12-aneesh.kumar@linux.ibm.com
  • Loading branch information
Aneesh Kumar K.V authored and Michael Ellerman committed Dec 3, 2020
1 parent 8e56092 commit f643fca
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions arch/powerpc/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -1760,6 +1760,16 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
childregs->ppr = DEFAULT_PPR;

p->thread.tidr = 0;
#endif
/*
* Run with the current AMR value of the kernel
*/
#ifdef CONFIG_PPC_PKEY
if (mmu_has_feature(MMU_FTR_BOOK3S_KUAP))
kregs->amr = AMR_KUAP_BLOCKED;

if (mmu_has_feature(MMU_FTR_BOOK3S_KUEP))
kregs->iamr = AMR_KUEP_BLOCKED;
#endif
kregs->nip = ppc_function_entry(f);
return 0;
Expand Down

0 comments on commit f643fca

Please sign in to comment.