]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
powerpc/pkeys: Save the pkey registers before fork
authorRam Pai <linuxram@us.ibm.com>
Tue, 17 Jul 2018 13:51:05 +0000 (06:51 -0700)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 24 Jul 2018 11:34:47 +0000 (21:34 +1000)
When a thread forks the contents of AMR, IAMR, UAMOR registers in the
newly forked thread are not inherited.

Save the registers before forking, for content of those
registers to be automatically copied into the new thread.

Fixes: cf43d3b26452 ("powerpc: Enable pkey subsystem")
Cc: stable@vger.kernel.org # v4.16+
Signed-off-by: Ram Pai <linuxram@us.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/process.c

index 27f0caee55ea79652746e50887aabe9dce82ca23..eca92aac2e175f3c4150620d148f957a78ad21da 100644 (file)
@@ -583,6 +583,7 @@ static void save_all(struct task_struct *tsk)
                __giveup_spe(tsk);
 
        msr_check_and_clear(msr_all_available);
+       thread_pkey_regs_save(&tsk->thread);
 }
 
 void flush_all_to_thread(struct task_struct *tsk)