Re: [PATCH 1/2] powerpc/jprobes: Save and restore the parameter save area

2017-05-30 Thread Naveen N. Rao
On 2017/05/18 03:22PM, Michael Ellerman wrote: > "Naveen N. Rao" writes: > > > As pointed out in x86 setjmp_pre_handler(), we need to save and restore > > the parameter save area since the jprobe hook might overwrite it. Since > > there is no easy way to ident

Re: [PATCH 1/2] powerpc/jprobes: Save and restore the parameter save area

2017-05-30 Thread Naveen N. Rao
On 2017/05/17 10:12AM, Masami Hiramatsu wrote: > On Mon, 15 May 2017 23:35:03 +0530 > "Naveen N. Rao" wrote: > > diff --git a/arch/powerpc/include/asm/kprobes.h > > b/arch/powerpc/include/asm/kprobes.h > > index a83821f33ea3..b6960ef213ac 100644 > >

Re: [PATCH 2/2] powerpc/jprobes: Validate break handler invocation as being due to a jprobe_return()

2017-05-30 Thread Naveen N. Rao
On 2017/05/17 10:21AM, Masami Hiramatsu wrote: > On Mon, 15 May 2017 23:35:04 +0530 > "Naveen N. Rao" wrote: > > > Fix a circa 2005 FIXME by implementing a check to ensure that we > > actually got into the jprobe break handler() due to the trap in > > jp

Re: [RFC][PATCH] powerpc/64s: stop using r14 register

2017-05-30 Thread Naveen N. Rao
On 2017/05/22 12:00AM, Nicholas Piggin wrote: > I'd like to take over the r14 register for use as a per-cpu kernel > register similar to the way r13 is used for the paca. > > r14 being the last non-volatile register gcc allocates, appears with > about 0.5% the frequency as r31 in (static) instruct

Re: [RFC][PATCH] powerpc/64s: stop using r14 register

2017-05-30 Thread Naveen N. Rao
On 2017/05/31 10:53AM, Nicholas Piggin wrote: > On Wed, 31 May 2017 00:38:17 +0530 > "Naveen N. Rao" wrote: > > > On 2017/05/22 12:00AM, Nicholas Piggin wrote: > > > I'd like to take over the r14 register for use as a per-cpu kernel > > > regi

[PATCH v2 0/4] ftrace/kprobe fixes

2017-06-01 Thread Naveen N. Rao
This is v2 of some of the patches from: https://www.mail-archive.com/linuxppc-dev@lists.ozlabs.org/msg11.html The first two patches should probably go to -stable. The others can go into v4.12. Thanks, Naveen Naveen N. Rao (4): powerpc/kprobes: Pause function_graph tracing during jprobes

[PATCH v2 1/4] powerpc/kprobes: Pause function_graph tracing during jprobes handling

2017-06-01 Thread Naveen N. Rao
ot;powerpc64: port of the function graph tracer") Signed-off-by: Naveen N. Rao --- v2: No changes since v1. arch/powerpc/kernel/kprobes.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index e1fb95385a9e..0554d6e6

[PATCH v2 3/4] powerpc/kprobes_on_ftrace: Skip livepatch_handler() for jprobes

2017-06-01 Thread Naveen N. Rao
on. In this case, we simply skip the livepatch_handler and branch to the new NIP. Otherwise, the livepatch_handler is invoked. Fixes: ead514d5fb30a ("powerpc/kprobes: Add support for KPROBES_ON_FTRACE") Signed-off-by: Naveen N. Rao --- v2: Changed to use current_kprobe->addr to d

[PATCH v2 2/4] powerpc/ftrace: Pass the correct stack pointer for DYNAMIC_FTRACE_WITH_REGS

2017-06-01 Thread Naveen N. Rao
. Also, use SAVE_10GPRS() to simplify the code. Fixes: 153086644fd1f ("powerpc/ftrace: Add support for -mprofile-kernel ftrace ABI") Signed-off-by: Naveen N. Rao --- v2: No changes since v1. arch/powerpc/kernel/trace/ftrace_64_mprofile.S | 20 1 file changed, 12 insert

[PATCH v2 4/4] powerpc/xmon: Disable ftrace while in xmon

2017-06-01 Thread Naveen N. Rao
Disable ftrace when we enter xmon so as not to clobber/pollute the trace buffer. In addition, we cannot have function_graph enabled while in xmon since we use setjmp/longjmp which confuses the function call history maintained by function_graph. Signed-off-by: Naveen N. Rao --- v2: Disable ftrace

Re: [PATCH v3 2/9] powerpc/kprobes: Move kprobes over to patch_instruction

2017-06-06 Thread Naveen N. Rao
Hi Balbir, On 2017/06/06 02:29PM, Balbir Singh wrote: > arch_arm/disarm_probe use direct assignment for copying > instructions, replace them with patch_instruction > > Signed-off-by: Balbir Singh > --- > arch/powerpc/kernel/kprobes.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >

Re: [PATCH v3 3/9] powerpc/kprobes/optprobes: Move over to patch_instruction

2017-06-06 Thread Naveen N. Rao
On 2017/06/06 02:29PM, Balbir Singh wrote: > With text moving to read-only migrate optprobes to using > the patch_instruction infrastructure. Without this optprobes > will fail and complain. > > Signed-off-by: Balbir Singh > --- > arch/powerpc/kernel/optprobes.c | 58 > +

Re: [PATCH v3 3/9] powerpc/kprobes/optprobes: Move over to patch_instruction

2017-06-07 Thread Naveen N. Rao
On 2017/06/07 03:46PM, Balbir Singh wrote: > On Wed, 2017-06-07 at 00:42 +0530, Naveen N. Rao wrote: > > On 2017/06/06 02:29PM, Balbir Singh wrote: > > > With text moving to read-only migrate optprobes to using > > > the patch_instruction infrastructure. Without this op

[PATCH] powerpc/kprobes: Don't save/restore DAR/DSISR to/from pt_regs for optprobes

2017-06-08 Thread Naveen N. Rao
We don't save/restore these across a trap, or with KPROBES_ON_FTRACE. Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/optprobes_head.S | 8 1 file changed, 8 deletions(-) diff --git a/arch/powerpc/kernel/optprobes_head.S b/arch/powerpc/kernel/optprobes_head.S index 4937bef

[PATCH] kernel/kprobes: Add test to validate pt_regs

2017-06-08 Thread Naveen N. Rao
* helpers and define HAVE_KPROBES_REGS_SANITY_TEST. Signed-off-by: Naveen N. Rao --- arch/powerpc/include/asm/kprobes.h | 4 + arch/powerpc/lib/Makefile | 3 +- arch/powerpc/lib/test_kprobe_regs.S | 62 arch/powerpc/lib/test_kprobes.c | 115

[PATCH] powerpc64/hw_breakpoints: Handle data breakpoints in radix mode

2017-06-13 Thread Naveen N. Rao
elated code") Reported-by: Shriya R. Kulkarni Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/exceptions-64s.S | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index ae418b85c17c..

Re: [PATCH] powerpc64/hw_breakpoints: Handle data breakpoints in radix mode

2017-06-13 Thread Naveen N. Rao
Hi Aneesh, On 2017/06/14 08:38AM, Aneesh Kumar K.V wrote: > "Naveen N. Rao" writes: > > > On P9, trying to use data breakpoints throws the splat shown below (*). > > This is because the check for a data breakpoint in DSISR is in > > do_hash_page(). Move this

Re: [PATCH] powerpc64/hw_breakpoints: Handle data breakpoints in radix mode

2017-06-14 Thread Naveen N. Rao
On 2017/06/14 04:41PM, Michael Ellerman wrote: > "Aneesh Kumar K.V" writes: > > On Wednesday 14 June 2017 10:41 AM, Naveen N. Rao wrote: > >> On 2017/06/14 08:38AM, Aneesh Kumar K.V wrote: > >>> "Naveen N. Rao" writes: > >>>>

[PATCH] powerpc/uprobes: Implement arch_uretprobe_is_alive()

2017-06-14 Thread Naveen N. Rao
'probe_bz5274:*' -aR ./bz5274 Reported-by: Gustavo Luiz Duarte Reported-by: z...@redhat.com Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/uprobes.c | 9 + 1 file changed, 9 insertions(+) diff --git a/arch/powerpc/kernel/uprobes.c b/arch/powerpc/kernel/uprobes.c index 003b2

Re: [PATCH] ppc64/perf: Fix oops when kthread execs user process

2017-06-15 Thread Naveen N. Rao
.4 > kernel but I'm able to reproduce it with 4.4 kernel. Hmm... are you sure it's the same issue? The above commit only went into v4.7, which means we weren't able to use --call-graph=dwarf till v4.7. Apart from that: Acked-by: Naveen N. Rao - Naveen > > arch/powe

Re: [PATCH v2 3/4] powerpc/kprobes_on_ftrace: Skip livepatch_handler() for jprobes

2017-06-15 Thread Naveen N. Rao
On 2017/06/15 09:19PM, Michael Ellerman wrote: > "Naveen N. Rao" writes: > > > diff --git a/arch/powerpc/kernel/trace/ftrace_64_mprofile.S > > b/arch/powerpc/kernel/trace/ftrace_64_mprofile.S > > index fa0921410fa4..e6837e85ec28 100644 > > --- a/arch/p

Re: [PATCH 1/2] powerpc: Fix emulation of mcrf in emulate_step()

2017-06-15 Thread Naveen N. Rao
On 2017/06/15 09:46AM, Anton Blanchard wrote: > From: Anton Blanchard > > The mcrf emulation code was looking at the CR fields in the reverse > order. It also relied on reserved fields being zero which is somewhat > fragile, so fix that too. Yikes! Amazing catch! Acked-by

Re: [PATCH 2/2] powerpc: Fix emulation of mfocrf in emulate_step()

2017-06-15 Thread Naveen N. Rao
lation code currently puts the entire CR into the destination GPR. > Fix it. > > Cc: sta...@vger.kernel.org > Signed-off-by: Anton Blanchard Acked-by: Naveen N. Rao > --- > arch/powerpc/lib/sstep.c | 13 + > 1 file changed, 13 insertions(+) > > diff --g

Re: [PATCH] powerpc64/hw_breakpoints: Handle data breakpoints in radix mode

2017-06-18 Thread Naveen N. Rao
On 2017/06/16 03:16PM, Michael Ellerman wrote: > "Naveen N. Rao" writes: > > > diff --git a/arch/powerpc/kernel/exceptions-64s.S > > b/arch/powerpc/kernel/exceptions-64s.S > > index ae418b85c17c..17ee701b8336 100644 > > --- a/arch/powerpc/kernel/except

Re: [PATCH] powerpc64/hw_breakpoints: Handle data breakpoints in radix mode

2017-06-19 Thread Naveen N. Rao
On 2017/06/19 03:21PM, Aneesh Kumar K.V wrote: > "Naveen N. Rao" writes: > > > On 2017/06/16 03:16PM, Michael Ellerman wrote: > >> "Naveen N. Rao" writes: > >> > >> > diff --git a/arch/powerpc/kernel/exceptions-64s.S > >

[PATCH v2] powerpc64/exceptions: Refactor code to eliminate a few memory loads

2017-06-19 Thread Naveen N. Rao
memory loads and register move operations in handle_page_fault(), handle_dabr_fault() and label '77'. Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/exceptions-64s.S | 38 +--- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/ar

Re: [PATCH] powerpc/time: Fix tracing in time.c

2017-06-20 Thread Naveen N . Rao
ting: Timer and ftrace selftests run with different trace clocks. > > CC: Naveen N. Rao > Signed-off-by: Santosh Sivaraj Thanks for doing this! Apart from the minor nit below: Acked-by: Naveen N. Rao > --- > arch/powerpc/kernel/Makefile | 2 -- > arch/powerpc/kernel/time.c

[PATCH v3 0/6] powerpc: build out kprobes blacklist -- series 3

2017-06-21 Thread Naveen N. Rao
a local symbol. - Patch 5 additionally blacklists __replay_interrupt. (*) https://www.mail-archive.com/linuxppc-dev@lists.ozlabs.org/msg117562.html - Naveen Naveen N. Rao (6): powerpc64/elfv1: Validate function pointer address in the function descriptor powerpc/64s: Convert

[PATCH v3 1/6] powerpc64/elfv1: Validate function pointer address in the function descriptor

2017-06-21 Thread Naveen N. Rao
received, rather than the dereferenced value. Signed-off-by: Naveen N. Rao --- arch/powerpc/include/asm/code-patching.h | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/code-patching.h b/arch/powerpc/include/asm/code-patching.h index

[PATCH v3 2/6] powerpc/64s: Convert .L__replay_interrupt_return to a local label

2017-06-21 Thread Naveen N. Rao
bol visible. Fix the same by instead using the local label '1'. Fixes: Commit b48bbb82e2b835 ("powerpc/64s: Don't unbalance the return branch predictor in __replay_interrupt()") Suggested-by: Nicholas Piggin Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/exceptions-

[PATCH v3 3/6] powerpc/64s: Blacklist system_call() and system_call_common() from kprobes

2017-06-21 Thread Naveen N. Rao
Convert some of the symbols into private symbols and blacklist system_call_common() and system_call() from kprobes. We can't take a trap at parts of these functions as either MSR_RI is unset or the kernel stack pointer is not yet setup. Reviewed-by: Masami Hiramatsu Signed-off-by: Naveen N

[PATCH v3 4/6] powerpc/64s: Un-blacklist system_call() from kprobes

2017-06-21 Thread Naveen N. Rao
probing on rfi and mtmsr instructions (checked for in arch_prepare_kprobe()). Suggested-by: Michael Ellerman Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/entry_64.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/

[PATCH v3 5/6] powerpc/64s: Blacklist functions invoked on a trap

2017-06-21 Thread Naveen N. Rao
Blacklist all functions involved while handling a trap. We: - convert some of the symbols into private symbols, - remove the duplicate 'restore' symbol, and - blacklist most functions involved while handling a trap. Reviewed-by: Masami Hiramatsu Signed-off-by: Naveen N. Rao --- ar

[PATCH v3 6/6] powerpc/64s: Blacklist rtas entry/exit from kprobes

2017-06-21 Thread Naveen N. Rao
We can't take traps with relocation off, so blacklist enter_rtas() and rtas_return_loc(). However, instead of blacklisting all of enter_rtas(), introduce a new symbol __enter_rtas from where on we can't take a trap and blacklist that. Signed-off-by: Naveen N. Rao --- arch/powe

[PATCH 0/2] A couple of small updates/fixes for kprobes tracer

2017-06-21 Thread Naveen N. Rao
for powerpc. Thanks, Naveen Naveen N. Rao (2): trace/kprobes: Sanitize derived event names selftests/ftrace: Update multiple kprobes test for powerpc kernel/trace/trace_kprobe.c | 9 + tools/testing/selftests/ftrace/test.d/kprobe

[PATCH 1/2] trace/kprobes: Sanitize derived event names

2017-06-21 Thread Naveen N. Rao
vents trace_kprobe: Failed to allocate trace_probe.(-22) -sh: write error: Invalid argument After this patch: # echo 'p kobject_example:foo_store' > kprobe_events # cat kprobe_events p:kprobes/p_kobject_example_foo_store_0 kobject_example:foo_store Signed-off-by: Navee

[PATCH 2/2] selftests/ftrace: Update multiple kprobes test for powerpc

2017-06-21 Thread Naveen N. Rao
names properly in the presence of ':' and '.', such names are accepted by kprobe_events and constitutes a good test for those symbols. Signed-off-by: Naveen N. Rao --- tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc | 8 1 file changed, 4 insertions(+), 4 d

Re: [PATCH v3 1/6] powerpc64/elfv1: Validate function pointer address in the function descriptor

2017-06-22 Thread Naveen N. Rao
On 2017/06/22 11:06PM, Nicholas Piggin wrote: > On Thu, 22 Jun 2017 20:59:49 +1000 > Michael Ellerman wrote: > > > Nicholas Piggin writes: > > > > > On Thu, 22 Jun 2017 00:08:37 +0530 > > > "Naveen N. Rao" wrote: > > > > >

Re: [PATCH v3 3/6] powerpc/64s: Blacklist system_call() and system_call_common() from kprobes

2017-06-22 Thread Naveen N. Rao
On 2017/06/22 11:08PM, Nicholas Piggin wrote: > On Thu, 22 Jun 2017 21:07:46 +1000 > Michael Ellerman wrote: > > > Nicholas Piggin writes: > > > > > On Thu, 22 Jun 2017 00:08:39 +0530 > > > "Naveen N. Rao" wrote: > > > > > &

Re: [PATCH v3 4/6] powerpc/64s: Un-blacklist system_call() from kprobes

2017-06-22 Thread Naveen N. Rao
On 2017/06/22 11:14PM, Nicholas Piggin wrote: > On Thu, 22 Jun 2017 21:14:21 +1000 > Michael Ellerman wrote: > > > Nicholas Piggin writes: > > > > > On Thu, 22 Jun 2017 00:08:40 +0530 > > > "Naveen N. Rao" wrote: > > > > >

Re: [PATCH v3 6/6] powerpc/64s: Blacklist rtas entry/exit from kprobes

2017-06-22 Thread Naveen N. Rao
On 2017/06/22 01:48PM, Nicholas Piggin wrote: > On Thu, 22 Jun 2017 00:08:42 +0530 > "Naveen N. Rao" wrote: > > > We can't take traps with relocation off, so blacklist enter_rtas() and > > rtas_return_loc(). However, instead of blacklisting all of ente

Re: [PATCH 2/2] selftests/ftrace: Update multiple kprobes test for powerpc

2017-06-22 Thread Naveen N. Rao
On 2017/06/22 06:07PM, Masami Hiramatsu wrote: > On Thu, 22 Jun 2017 00:20:28 +0530 > "Naveen N. Rao" wrote: > > > KPROBES_ON_FTRACE is only available on powerpc64le. Update comment to > > clarify this. > > > > Also, we should use an offset of 8 to

Re: [PATCH 1/2] trace/kprobes: Sanitize derived event names

2017-06-22 Thread Naveen N. Rao
On 2017/06/22 06:29PM, Masami Hiramatsu wrote: > On Thu, 22 Jun 2017 00:20:27 +0530 > "Naveen N. Rao" wrote: > > > When we derive event names, convert some expected symbols (such as ':' > > used to specify module:name and '.' present in some s

Re: [PATCH] kallsyms: optimize kallsyms_lookup_name() for a few cases

2017-06-27 Thread Naveen N. Rao
On 2017/04/27 11:21AM, Masami Hiramatsu wrote: > On Thu, 27 Apr 2017 01:38:10 +0530 > "Naveen N. Rao" wrote: > > > Michael Ellerman wrote: > > > "Naveen N. Rao" writes: > > >> diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c > >

Re: [PATCH 2/2] selftests/ftrace: Update multiple kprobes test for powerpc

2017-06-28 Thread Naveen N. Rao
On 2017/06/24 08:06PM, Masami Hiramatsu wrote: > On Sat, 24 Jun 2017 02:30:21 +0900 > Masami Hiramatsu wrote: > > > On Thu, 22 Jun 2017 22:33:25 +0530 > > "Naveen N. Rao" wrote: > > > > > On 2017/06/22 06:07PM, Masami Hiramatsu wrote: > > &g

Re: [PATCH 2/2] selftests/ftrace: Update multiple kprobes test for powerpc

2017-06-28 Thread Naveen N. Rao
On 2017/06/28 11:16PM, Masami Hiramatsu wrote: > > > diff --git > > > a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc > > > b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc > > > new file mode 100644 > > > index 000..d259031 > > > --- /dev/null > > > +++ b

[PATCH v4 0/7] powerpc: build out kprobes blacklist -- series 3

2017-06-29 Thread Naveen N. Rao
nuxppc-dev@lists.ozlabs.org/msg119596.html (*) series 2: https://www.mail-archive.com/linuxppc-dev@lists.ozlabs.org/msg117562.html - Naveen Naveen N. Rao (7): powerpc64/elfv1: Only dereference function descriptor for non-text symbols powerpc/64s: Convert .L__replay_interrupt_return to a local label

[PATCH v4 1/7] powerpc64/elfv1: Only dereference function descriptor for non-text symbols

2017-06-29 Thread Naveen N. Rao
Piggin Signed-off-by: Naveen N. Rao --- arch/powerpc/include/asm/code-patching.h | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/code-patching.h b/arch/powerpc/include/asm/code-patching.h index abef812de7f8..5482928eea1b 100644 --- a/arch

[PATCH v4 3/7] powerpc/64s: Blacklist system_call() and system_call_common() from kprobes

2017-06-29 Thread Naveen N. Rao
iggin Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/entry_64.S | 29 +++-- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index da9486e2fd89..ef8e6615b8ba 100644 --- a/arch/powerpc/k

[PATCH v4 2/7] powerpc/64s: Convert .L__replay_interrupt_return to a local label

2017-06-29 Thread Naveen N. Rao
bol visible. Fix the same by instead using the local label '1'. Fixes: Commit b48bbb82e2b835 ("powerpc/64s: Don't unbalance the return branch predictor in __replay_interrupt()") Suggested-by: Nicholas Piggin Reviewed-by: Nicholas Piggin Signed-off-by: Naveen N. Rao ---

[PATCH v4 4/7] powerpc/64s: Move system_call() symbol to just after setting MSR_EE

2017-06-29 Thread Naveen N. Rao
have since been made private or removed entirely. So, let's move system_call() slightly higher up, right after the mtmsr instruction that enables interrupts. Convert existing references to system_call to a local syscall symbol. Suggested-by: Nicholas Piggin Signed-off-by: Naveen N. Rao ---

[PATCH v4 6/7] powerpc/64s: Blacklist functions invoked on a trap

2017-06-29 Thread Naveen N. Rao
Blacklist all functions involved while handling a trap. We: - convert some of the symbols into private symbols, and - blacklist most functions involved while handling a trap. Reviewed-by: Masami Hiramatsu Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/entry_64.S | 35

[PATCH v4 5/7] powerpc/64s: Un-blacklist system_call() from kprobes

2017-06-29 Thread Naveen N. Rao
probing on rfi and mtmsr instructions (checked for in arch_prepare_kprobe()). Suggested-by: Michael Ellerman Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/entry_64.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/

[PATCH v4 7/7] powerpc/64s: Blacklist rtas entry/exit from kprobes

2017-06-29 Thread Naveen N. Rao
We can't take traps with relocation off, so blacklist enter_rtas() and rtas_return_loc(). However, instead of blacklisting all of enter_rtas(), introduce a new symbol __enter_rtas from where on we can't take a trap and blacklist that. Signed-off-by: Naveen N. Rao --- arch/powe

Re: [PATCH v4 1/7] powerpc64/elfv1: Only dereference function descriptor for non-text symbols

2017-06-29 Thread Naveen N. Rao
On 2017/06/29 08:49PM, Nicholas Piggin wrote: > On Thu, 29 Jun 2017 16:11:04 +0530 > "Naveen N. Rao" wrote: > > > Currently, we assume that the function pointer we receive in > > ppc_function_entry() points to a function descriptor. However, this is > &g

Re: [PATCH v4 5/7] powerpc/64s: Un-blacklist system_call() from kprobes

2017-06-29 Thread Naveen N. Rao
On 2017/06/29 08:55PM, Nicholas Piggin wrote: > On Thu, 29 Jun 2017 16:11:08 +0530 > "Naveen N. Rao" wrote: > > > It is actually safe to probe system_call() in entry_64.S, but only till > > we unset MSR_RI. To allow this, add a new symbol system_call_exit() >

Re: [PATCH v4 7/7] powerpc/64s: Blacklist rtas entry/exit from kprobes

2017-06-29 Thread Naveen N. Rao
On 2017/06/29 09:01PM, Nicholas Piggin wrote: > On Thu, 29 Jun 2017 16:11:10 +0530 > "Naveen N. Rao" wrote: > > > We can't take traps with relocation off, so blacklist enter_rtas() and > > rtas_return_loc(). However, instead of blacklisting all of ente

Re: [PATCH 2/2] selftests/ftrace: Update multiple kprobes test for powerpc

2017-06-29 Thread Naveen N. Rao
On 2017/06/29 09:57AM, Masami Hiramatsu wrote: > On Thu, 29 Jun 2017 00:13:24 +0530 > "Naveen N. Rao" wrote: > > > On 2017/06/28 11:16PM, Masami Hiramatsu wrote: > > > > > diff --git > > > > > a/tools/testing/selftests/ftrace/test.

[PATCH v2 1/4] trace/kprobes: Sanitize derived event names

2017-06-29 Thread Naveen N. Rao
vents trace_kprobe: Failed to allocate trace_probe.(-22) -sh: write error: Invalid argument After this patch: # echo 'p kobject_example:foo_store' > kprobe_events # cat kprobe_events p:kprobes/p_kobject_example_foo_store_0 kobject_example:foo_store Acked-by:

[PATCH v2 0/4] A fix and a few new tests for kprobe tracer

2017-06-29 Thread Naveen N. Rao
Hiramatsu (1): selftests/ftrace: Add a testcase for kprobe event naming Naveen N. Rao (3): trace/kprobes: Sanitize derived event names selftests/ftrace: Add a test to probe module functions selftests/ftrace: Update multiple kprobes test for powerpc kernel/trace/trace_kprobe.c

[PATCH v2 2/4] selftests/ftrace: Add a test to probe module functions

2017-06-29 Thread Naveen N. Rao
Add a kprobes test to ensure that we are able to add a probe on a module function using 'p :' format, without having to specify a probe name. Suggested-by: Masami Hiramatsu Acked-by: Masami Hiramatsu Signed-off-by: Naveen N. Rao --- .../testing/selftests/ftrace/test.d/kprobe/probe

[PATCH v2 3/4] selftests/ftrace: Update multiple kprobes test for powerpc

2017-06-29 Thread Naveen N. Rao
or 16 will fall on ftrace location. Offset 8 is currently guaranteed to not be the ftrace location. Signed-off-by: Naveen N. Rao --- tools/testing/selftests/ftrace/test.d/kprobe/multiple_kprobes.tc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/f

[PATCH v2 4/4] selftests/ftrace: Add a testcase for kprobe event naming

2017-06-29 Thread Naveen N. Rao
group name. Signed-off-by: Masami Hiramatsu [Updated tests to use vfs_read and symbols with '.isra.', added check for kprobe_events and a command to clear it on exit] Signed-off-by: Naveen N. Rao --- .../ftrace/test.d/kprobe/kprobe_eventname.tc | 32 ++ 1 fi

Re: [PATCH v4 7/7] powerpc/64s: Blacklist rtas entry/exit from kprobes

2017-06-29 Thread Naveen N. Rao
On 2017/06/29 10:13PM, Nicholas Piggin wrote: > On Thu, 29 Jun 2017 17:24:14 +0530 > "Naveen N. Rao" wrote: > > > On 2017/06/29 09:01PM, Nicholas Piggin wrote: > > > On Thu, 29 Jun 2017 16:11:10 +0530 > > > "Naveen N. Rao" wrote: > &g

[PATCH v5 0/7] powerpc: build out kprobes blacklist -- series 3

2017-06-29 Thread Naveen N. Rao
@lists.ozlabs.org/msg117562.html - Naveen Naveen N. Rao (7): powerpc64/elfv1: Only dereference function descriptor for non-text symbols powerpc/64s: Convert .L__replay_interrupt_return to a local label powerpc/64s: Blacklist system_call() and system_call_common() from kprobes powerpc

[PATCH v5 1/7] powerpc64/elfv1: Only dereference function descriptor for non-text symbols

2017-06-29 Thread Naveen N. Rao
Piggin Reviewed-by: Nicholas Piggin Signed-off-by: Naveen N. Rao --- arch/powerpc/include/asm/code-patching.h | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/code-patching.h b/arch/powerpc/include/asm/code-patching.h index abef812de7f8

[PATCH v5 2/7] powerpc/64s: Convert .L__replay_interrupt_return to a local label

2017-06-29 Thread Naveen N. Rao
bol visible. Fix the same by instead using the local label '1'. Fixes: Commit b48bbb82e2b835 ("powerpc/64s: Don't unbalance the return branch predictor in __replay_interrupt()") Suggested-by: Nicholas Piggin Reviewed-by: Nicholas Piggin Signed-off-by: Naveen N. Rao ---

[PATCH v5 3/7] powerpc/64s: Blacklist system_call() and system_call_common() from kprobes

2017-06-29 Thread Naveen N. Rao
iggin Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/entry_64.S | 29 +++-- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index da9486e2fd89..ef8e6615b8ba 100644 --- a/arch/powerpc/k

[PATCH v5 4/7] powerpc/64s: Move system_call() symbol to just after setting MSR_EE

2017-06-29 Thread Naveen N. Rao
d-off-by: Naveen N. Rao --- arch/powerpc/kernel/entry_64.S | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index ef8e6615b8ba..c39436706555 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/k

[PATCH v5 5/7] powerpc/64s: Un-blacklist system_call() from kprobes

2017-06-29 Thread Naveen N. Rao
It is actually safe to probe system_call() in entry_64.S, but only till we unset MSR_RI. To allow this, add a new symbol system_call_exit() after the mtmsrd and blacklist that. Suggested-by: Michael Ellerman Reviewed-by: Nicholas Piggin Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel

[PATCH v5 6/7] powerpc/64s: Blacklist functions invoked on a trap

2017-06-29 Thread Naveen N. Rao
Blacklist all functions involved while handling a trap. We: - convert some of the symbols into private symbols, and - blacklist most functions involved while handling a trap. Reviewed-by: Masami Hiramatsu Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/entry_64.S | 35

[PATCH v5 7/7] powerpc/64s: Blacklist rtas entry/exit from kprobes

2017-06-29 Thread Naveen N. Rao
We can't take traps with relocation off, so blacklist enter_rtas() and rtas_return_loc(). However, instead of blacklisting all of enter_rtas(), introduce a new symbol __enter_rtas from where on we can't take a trap and blacklist that. Signed-off-by: Naveen N. Rao --- arch/powe

Re: [PATCH v5 3/7] powerpc/64s: Blacklist system_call() and system_call_common() from kprobes

2017-07-02 Thread Naveen N. Rao
On 2017/07/02 10:40PM, Nicholas Piggin wrote: > On Sat, 01 Jul 2017 12:24:02 +1000 > Michael Ellerman wrote: > > > "Naveen N. Rao" writes: > > > > > Convert some of the symbols into private symbols and blacklist > > > system_call_common(

Re: [PATCH v2 2/4] selftests/ftrace: Add a test to probe module functions

2017-07-07 Thread Naveen N. Rao
On 2017/07/03 12:51PM, Masami Hiramatsu wrote: > On Mon, 3 Jul 2017 12:27:33 +0900 > Masami Hiramatsu wrote: > > > On Thu, 29 Jun 2017 19:05:37 +0530 > > "Naveen N. Rao" wrote: > > > > > Add a kprobes test to ensure that we are able to add a probe

Re: [PATCH] powerpc/livepatch: Fix livepatch stack access

2017-09-20 Thread Naveen N . Rao
g task stack and livepatch stack into r1 register. > Using r11 register also avoids disabling/enabling irq's while setting > up the livepatch stack. > > Signed-off-by: Kamalesh Babulal > Cc: Balbir Singh > Cc: Naveen N. Rao > Cc: linuxppc-dev@lists.ozlabs.org > --- > arch/powerpc/kernel/trace/ftrace_64_mprofile.S | 45 > +- > 1 file changed, 15 insertions(+), 30 deletions(-) Reviewed-by: Naveen N. Rao - Naveen

Re: [PATCH] powerpc/livepatch: Fix livepatch stack access

2017-09-21 Thread Naveen N . Rao
On 2017/09/21 09:00PM, Balbir Singh wrote: > On Thu, Sep 21, 2017 at 8:02 PM, Michael Ellerman wrote: > > Kamalesh Babulal writes: > > > >> While running stress test with livepatch module loaded, kernel > >> bug was triggered. > >> > >> cpu 0x5: Vector: 400 (Instruction Access) at [c000eb9d3b

[PATCH v2 0/6] powerpc/kprobes: More fixes

2017-09-22 Thread Naveen N. Rao
detection of jprobe in ftrace_caller() and that this is only for KPROBES_ON_FTRACE. - Naveen Naveen N. Rao (6): powerpc/kprobes: Some cosmetic updates to try_to_emulate() powerpc/kprobes: Do not suppress instruction emulation if a single run failed powerpc/kprobes: Clean up jprobe

[PATCH v2 2/6] powerpc/kprobes: Do not suppress instruction emulation if a single run failed

2017-09-22 Thread Naveen N. Rao
at least once, then we single step only this probe hit and continue to try emulating the instruction in subsequent probe hits. Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/kprobes.c | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel

[PATCH v2 1/6] powerpc/kprobes: Some cosmetic updates to try_to_emulate()

2017-09-22 Thread Naveen N. Rao
1. This is only used in kprobes.c, so make it static. 2. Remove the un-necessary (ret == 0) comparison in the else clause. Reviewed-by: Masami Hiramatsu Reviewed-by: Kamalesh Babulal Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/kprobes.c | 4 ++-- 1 file changed, 2 insertions(+), 2

[PATCH v2 4/6] powerpc/kprobes: Fix warnings from __this_cpu_read() on preempt kernels

2017-09-22 Thread Naveen N. Rao
ng the check done by __this_cpu_read(). Fixes: c05b8c4474c030 ("powerpc/kprobes: Skip livepatch_handler() for jprobes") Reported-by: Kamalesh Babulal Tested-by: Kamalesh Babulal Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/kprobes-ftrace.c | 8 ++-- 1 file changed, 6 inser

[PATCH v2 3/6] powerpc/kprobes: Clean up jprobe detection in livepatch handler

2017-09-22 Thread Naveen N. Rao
patch renames is_current_kprobe_addr() to __is_active_jprobe() and adds a comment to (hopefully) better clarify the purpose of this helper. The helper has also now been moved to kprobes-ftrace.c so that it is only available for KPROBES_ON_FTRACE. Signed-off-by: Naveen N. Rao --- arch/powerpc/include/

[PATCH v2 5/6] powerpc/jprobes: Disable preemption when triggered through ftrace

2017-09-22 Thread Naveen N. Rao
ble it. Fixes: ead514d5fb30a0 ("powerpc/kprobes: Add support for KPROBES_ON_FTRACE") Acked-by: Masami Hiramatsu Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/kprobes-ftrace.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/kprobes-

[PATCH v2 6/6] powerpc/jprobes: Validate break handler invocation as being due to a jprobe_return()

2017-09-22 Thread Naveen N. Rao
Fix a circa 2005 FIXME by implementing a check to ensure that we actually got into the jprobe break handler() due to the trap in jprobe_return(). Acked-by: Masami Hiramatsu Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/kprobes.c | 20 +--- 1 file changed, 9 insertions

Re: [PATCH 1/3] powerpc/lib/sstep: Add XER bits introduced in POWER ISA v3.0

2017-09-29 Thread Naveen N. Rao
viour of all these instructions needs to > be updated to set these new bits accordingly. > > Signed-off-by: Sandipan Das For this series: Acked-by: Naveen N. Rao > --- > arch/powerpc/lib/sstep.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/powerpc/lib/

Re: [PATCH] kernel/module_64.c: Add REL24 relocation support of livepatch symbols

2017-10-03 Thread Naveen N . Rao
store/restore TOC/LR values, other than > the stub setup and branch. The additional instructions sequences to handle > klp_stub increases the stub size and current ppc64_stub_insn[] is not > sufficient to hold them. This patch also introduces new > ppc64le_klp_stub_entry[], along with the helpers to f

Re: [PATCH v2] kernel/module_64.c: Add REL24 relocation support of livepatch symbols

2017-10-04 Thread Naveen N . Rao
the base of > the regular stack and is used to store/restore TOC/LR values, other than > the stub setup and branch. The additional instructions sequences to > handle klp_stub increases the stub size and current ppc64_stub_insn[] > is not sufficient to hold them. This patch also introd

Re: [PATCH 1/2] powerpc/vdso64: Coarse timer support preparatory patch

2017-10-06 Thread Naveen N. Rao
Hi Santosh, On 2017/09/18 09:23AM, Santosh Sivaraj wrote: > Reorganize code to make it easy to introduce CLOCK_REALTIME_COARSE and > CLOCK_MONOTONIC_COARSE timer support. > > Signed-off-by: Santosh Sivaraj > --- > arch/powerpc/kernel/vdso64/gettimeofday.S | 14 -- > 1 file changed,

Re: [PATCH 2/2] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-10-06 Thread Naveen N. Rao
On 2017/09/18 09:23AM, Santosh Sivaraj wrote: > Current vDSO64 implementation does not have support for coarse clocks > (CLOCK_MONOTONIC_COARSE, CLOCK_REALTIME_COARSE), for which it falls back > to system call, increasing the response time, vDSO implementation reduces > the cycle time. Below is a b

Re: [PATCH 2/2] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-10-06 Thread Naveen N. Rao
On 2017/09/18 09:23AM, Santosh Sivaraj wrote: > Current vDSO64 implementation does not have support for coarse clocks > (CLOCK_MONOTONIC_COARSE, CLOCK_REALTIME_COARSE), for which it falls back > to system call, increasing the response time, vDSO implementation reduces > the cycle time. Below is a b

Re: [PATCH v4] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-10-09 Thread Naveen N. Rao
On 2017/10/09 08:09AM, Santosh Sivaraj wrote: > Current vDSO64 implementation does not have support for coarse clocks > (CLOCK_MONOTONIC_COARSE, CLOCK_REALTIME_COARSE), for which it falls back > to system call, increasing the response time, vDSO implementation reduces > the cycle time. Below is a b

Re: [PATCH] powerpc/lib/sstep: Fix count leading zeros instructions

2017-10-09 Thread Naveen N. Rao
On 2017/10/09 11:07AM, Sandipan Das wrote: > According to the GCC documentation, the behaviour of __builtin_clz() > and __builtin_clzl() is undefined if the value of the input argument > is zero. Without handling this special case, these builtins have been > used for emulating the following instruc

Re: [PATCH v2] powerpc/lib/sstep: Fix count leading zeros instructions

2017-10-09 Thread Naveen N. Rao
nge analyse_instr so it doesn't modify > *regs") > Signed-off-by: Sandipan Das Reviewed-by: Naveen N. Rao > --- > v2: Make zero-checking condition more compact. > Add details of original commit that is being fixed here. > --- > arch/powerpc/lib/sstep.c | 6 --

Re: [PATCH v4] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-10-10 Thread Naveen N. Rao
On 2017/10/10 09:03AM, Santosh Sivaraj wrote: > * Naveen N. Rao wrote (on 2017-10-09 > 10:39:18 +): > > > On 2017/10/09 08:09AM, Santosh Sivaraj wrote: [snip] > > > + add r3,r3,r0 > > > + ld r0,CFG_TB_UPDATE_COUNT(r3) > > > + cmpld c

Re: [PATCH v6] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-10-11 Thread Naveen N. Rao
Hi Santosh, This seems to have gone from v4 to v6 -- did I miss v5? On 2017/10/10 11:10PM, Santosh Sivaraj wrote: > Current vDSO64 implementation does not have support for coarse clocks > (CLOCK_MONOTONIC_COARSE, CLOCK_REALTIME_COARSE), for which it falls back > to system call, increasing the resp

Re: [PATCH v5] powerpc/vdso64: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2017-10-11 Thread Naveen N. Rao
t; CLOCK_REALTIME_COARSE (Naveen) > - Reorder instructions to get proper dependency setup (Naveen) > > arch/powerpc/kernel/asm-offsets.c | 2 + > arch/powerpc/kernel/vdso64/gettimeofday.S | 68 > ++- > 2 files changed, 59 insertions(+), 11 deletions(-) Looks good to me. Reviewed-by: Naveen N. Rao

[PATCH 1/4] powerpc/kprobes: Disable preemption before invoking probe handler for optprobes

2017-10-23 Thread Naveen N. Rao
ed if CONFIG_PREEMPT was enabled. Commit a30b85df7d599f ("kprobes: Use synchronize_rcu_tasks() for optprobe with CONFIG_PREEMPT=y") changes this. Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/optprobes.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch

[PATCH 2/4] powerpc/kprobes: Do not disable interrupts for optprobes and kprobes_on_ftrace

2017-10-23 Thread Naveen N. Rao
Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/kprobes-ftrace.c | 10 ++ arch/powerpc/kernel/optprobes.c | 10 -- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/arch/powerpc/kernel/kprobes-ftrace.c b/arch/powerpc/kernel/kprobes-ftrace.c ind

[PATCH 3/4] powerpc/kprobes: Blacklist emulate_update_regs() from kprobes

2017-10-23 Thread Naveen N. Rao
Signed-off-by: Naveen N. Rao --- arch/powerpc/lib/sstep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c index 8c3955e183d4..70274b7b4773 100644 --- a/arch/powerpc/lib/sstep.c +++ b/arch/powerpc/lib/sstep.c @@ -2717,6 +2717,7 @@ void emul

[PATCH 4/4] powerpc/kprobes: refactor kprobe_lookup_name for safer string operations

2017-10-23 Thread Naveen N. Rao
Use safer string manipulation functions when dealing with a user-provided string in kprobe_lookup_name(). Reported-by: David Laight Signed-off-by: Naveen N. Rao --- arch/powerpc/kernel/kprobes.c | 47 ++- 1 file changed, 20 insertions(+), 27 deletions

Re: [PATCH 1/4] powerpc/kprobes: Disable preemption before invoking probe handler for optprobes

2017-10-27 Thread Naveen N. Rao
On 2017/10/25 02:18AM, Masami Hiramatsu wrote: > On Mon, 23 Oct 2017 22:07:38 +0530 > "Naveen N. Rao" wrote: > > > Per Documentation/kprobes.txt, probe handlers need to be invoked with > > preemption disabled. Update optimized_callback() to do so. Also move >

<    5   6   7   8   9   10   11   12   13   14   >