Re: [PATCH v2 2/3] powerpc/kprobes: un-blacklist system_call() from kprobes
From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2017-05-04 09:52:47
"Naveen N. Rao" [off-list ref] writes:
On 2017/05/04 04:03PM, Michael Ellerman wrote:quoted
Would this work?diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 767ef6d68c9e..8d0fa4a2262a 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S@@ -207,6 +207,7 @@ system_call: /* label this so stack traces look sane */ mtmsrd r11,1 #endif /* CONFIG_PPC_BOOK3E */ +syscall_exit: ld r9,TI_FLAGS(r12) li r11,-MAX_ERRNO andi. r0,r9,(_TIF_SYSCALL_DOTRACE|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK)Ah, nice. I previously incorrectly assumed that syscall_exit was not desirable throughout this function. Your earlier patch was only about what label showed up while _inside_ a syscall.
Yep. When you're somewhere in a syscall the LR on the stack points to the instruction following the bctrl that called the syscall handler, so as long as the label preceeding that is system_call then the backtrace should look good. We could even just have a nop after the bctrl and then the label, but that would be a bit gross.
So, syscall_exit post handling of a syscall is fine. This patch looks fine to me. I will test with this change and get back.
Thanks. cheers