From: Michael Ellerman Date: Tue, 10 Jun 2014 06:46:21 +0000 (+1000) Subject: powerpc/perf: Ensure all EBB register state is cleared on fork() X-Git-Tag: v3.15.4~20 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=feb6334d1c3b1678a6eaa5a6f93ba0cc6bd8d953;p=thirdparty%2Fkernel%2Fstable.git powerpc/perf: Ensure all EBB register state is cleared on fork() commit 3df48c981d5a9610e02e9270b1bc4274fb536710 upstream. In commit 330a1eb "Core EBB support for 64-bit book3s" I messed up clear_task_ebb(). It clears some but not all of the task's Event Based Branch (EBB) registers when we duplicate a task struct. That allows a child task to observe the EBBHR & EBBRR of its parent, which it should not be able to do. Fix it by clearing EBBHR & EBBRR. Signed-off-by: Michael Ellerman Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Greg Kroah-Hartman --- diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h index 0e83e7d8c73f5..b5fad8afe8378 100644 --- a/arch/powerpc/include/asm/switch_to.h +++ b/arch/powerpc/include/asm/switch_to.h @@ -84,6 +84,8 @@ static inline void clear_task_ebb(struct task_struct *t) { #ifdef CONFIG_PPC_BOOK3S_64 /* EBB perf events are not inherited, so clear all EBB state. */ + t->thread.ebbrr = 0; + t->thread.ebbhr = 0; t->thread.bescr = 0; t->thread.mmcr2 = 0; t->thread.mmcr0 = 0;