Commit 7c161132 authored by Michael Ellerman's avatar Michael Ellerman Committed by Greg Kroah-Hartman

powerpc/perf: Ensure all EBB register state is cleared on fork()

commit 3df48c98 upstream.

In commit 330a1eb7 "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: default avatarMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 50d4ff8d
...@@ -84,6 +84,8 @@ static inline void clear_task_ebb(struct task_struct *t) ...@@ -84,6 +84,8 @@ static inline void clear_task_ebb(struct task_struct *t)
{ {
#ifdef CONFIG_PPC_BOOK3S_64 #ifdef CONFIG_PPC_BOOK3S_64
/* EBB perf events are not inherited, so clear all EBB state. */ /* 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.bescr = 0;
t->thread.mmcr2 = 0; t->thread.mmcr2 = 0;
t->thread.mmcr0 = 0; t->thread.mmcr0 = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment