Re: [PATCH v4 14/15] kprobes: remove dependency on CONFIG_MODULES

2024-04-17 Thread Masami Hiramatsu
static int trace_kprobe_module_callback(struct notifier_block *nb, > unsigned long val, void *data) > @@ -704,6 +712,7 @@ static struct notifier_block trace_kprobe_module_nb = { > .notifier_call = trace_kprobe_module_callback, > .priority = 1 /* Invoked after kprobe module callback */ > }; > +#endif > > static int count_symbols(void *data, unsigned long unused) > { > @@ -1933,8 +1942,10 @@ static __init int init_kprobe_trace_early(void) > if (ret) > return ret; > > +#ifdef CONFIG_MODULES > if (register_module_notifier(_kprobe_module_nb)) > return -EINVAL; > +#endif > > return 0; > } > -- > 2.43.0 > > -- Masami Hiramatsu

Re: [PATCH 3/3] kprobes: Allow probing on any address belonging to ftrace

2022-02-20 Thread Masami Hiramatsu
opcode_t *)ftrace_addr; As I said, this must be if (ftrace_addr != addr) return -EILSEQ; This will prevent users from being confused by the results of probing that 'func' and 'func+4' are the same. (now only 'func' is allowed to be probed.) Thank you, > +#endif > + > if (addr) > return addr; > > -- > 2.35.1 > -- Masami Hiramatsu

Re: [PATCH 1/3] powerpc/ftrace: Reserve instructions from function entry for ftrace

2022-02-20 Thread Masami Hiramatsu
rec, unsigned > long old_addr, > /* >* Out of range jumps are called from modules. >*/ > - if (!rec->arch.mod) { > + if (!ftrace_mod_addr_get(rec)) { > pr_err("No module loaded\n"); > return -EINVAL; > } > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c > index f9feb197b2daaf..68f20cf34b0c47 100644 > --- a/kernel/trace/ftrace.c > +++ b/kernel/trace/ftrace.c > @@ -1510,6 +1510,7 @@ ftrace_ops_test(struct ftrace_ops *ops, unsigned long > ip, void *regs) > } > > > +#ifndef ftrace_cmp_recs > static int ftrace_cmp_recs(const void *a, const void *b) > { > const struct dyn_ftrace *key = a; > @@ -1521,6 +1522,7 @@ static int ftrace_cmp_recs(const void *a, const void *b) > return 1; > return 0; > } > +#endif > > static struct dyn_ftrace *lookup_rec(unsigned long start, unsigned long end) > { > -- > 2.35.1 > -- Masami Hiramatsu

Re: [PATCH 1/2] kprobes: Allow architectures to override optinsn page allocation

2021-05-12 Thread Masami Hiramatsu
3: warning: no previous prototype for > >> 'free_optinsn_page' [-Wmissing-prototypes] > 329 | void __weak free_optinsn_page(void *page) > | ^~~~~~~~~ Ah, we need a prototype for those in include/linux/kprobes.h as same as alloc_insn_page() and free_insn_page(). Thank you, -- Masami Hiramatsu

Re: [PATCH 2/2] powerpc/kprobes: Replace ppc_optinsn by common optinsn

2021-05-12 Thread Masami Hiramatsu
obes, extable: Identify > kprobes trampolines as kernel text area") > This looks good to me. Acked-by: Masami Hiramatsu > Suggested-by: Masami Hiramatsu > Signed-off-by: Christophe Leroy > --- > arch/powerpc/kernel/optprobes.c | 23 +-- > 1 file c

Re: [PATCH 1/2] kprobes: Allow architectures to override optinsn page allocation

2021-05-12 Thread Masami Hiramatsu
ee_optinsn_page(), that > fall back on alloc_insn_page() and free_insn_page() when not > overriden by the architecture. > Looks good to me :) Acked-by: Masami Hiramatsu > Suggested-by: Masami Hiramatsu > Signed-off-by: Christophe Leroy > --- > kernel/kprobes.c | 14 -- &g

Re: [PATCH 05/11 v3] kprobes/ftrace: Add recursion protection to the ftrace callback

2020-11-06 Thread Masami Hiramatsu
ttps://lkml.kernel.org/r/20201028115613.140212...@goodmis.org > Looks good to me. Acked-by: Masami Hiramatsu Thank you! > Cc: Andrew Morton > Cc: Masami Hiramatsu > Cc: Guo Ren > Cc: "James E.J. Bottomley" > Cc: Helge Deller > Cc: Michael Ellerman > Cc: Benjami

Re: [PATCH 05/11 v2] kprobes/ftrace: Add recursion protection to the ftrace callback

2020-11-03 Thread Masami Hiramatsu
nel.org/r/20201028115613.140212...@goodmis.org > > Cc: Andrew Morton > Cc: Masami Hiramatsu > Cc: Guo Ren > Cc: "James E.J. Bottomley" > Cc: Helge Deller > Cc: Michael Ellerman > Cc: Benjamin Herrenschmidt > Cc: Paul Mackerras > Cc: Heiko Carstens &

Re: [PATCH 5/9] kprobes/ftrace: Add recursion protection to the ftrace callback

2020-11-01 Thread Masami Hiramatsu
On Thu, 29 Oct 2020 09:40:01 -0400 Steven Rostedt wrote: > On Thu, 29 Oct 2020 16:58:03 +0900 > Masami Hiramatsu wrote: > > > Hi Steve, > > > > On Wed, 28 Oct 2020 07:52:49 -0400 > > Steven Rostedt wrote: > > > > > From: "Steven Rost

Re: [PATCH 5/9] kprobes/ftrace: Add recursion protection to the ftrace callback

2020-10-29 Thread Masami Hiramatsu
obe_ctlblk *kcb; > + int bit; > > - /* Preempt is disabled by ftrace */ > + bit = ftrace_test_recursion_trylock(); > + if (bit < 0) > + return; > + > + preempt_disable_notrace(); > p = get_kprobe((kprobe_opcode_t *)ip); > if (unlikely(!p) || kprobe_disabled(p)) > - return; > + goto out; > > kcb = get_kprobe_ctlblk(); > if (kprobe_running()) { > @@ -52,6 +57,9 @@ void kprobe_ftrace_handler(unsigned long ip, unsigned long > parent_ip, >*/ > __this_cpu_write(current_kprobe, NULL); > } > +out: > + preempt_enable_notrace(); > + ftrace_test_recursion_unlock(bit); > } > NOKPROBE_SYMBOL(kprobe_ftrace_handler); > > -- > 2.28.0 > > -- Masami Hiramatsu

Re: [PATCH v2 1/3] module: Rename module_alloc() to text_alloc() and move to kernel proper

2020-07-14 Thread Masami Hiramatsu
xt happens to be in arch specific code. > > If you want something special for ftrace, you could just add your own > function. But for x86, a text_alloc_immediate() would work. > (BTW, I like the function names over the enums) kprobes will need the text_alloc_immediate() too, since it will use the trampoline buffer where jumps to/from kernel code/modules. Thanks, -- Masami Hiramatsu

Re: [PATCH v3] powerpc/kprobes: Ignore traps that happened in real mode

2020-02-18 Thread Masami Hiramatsu
red to handle events in real mode and functions > running in real mode should have been blacklisted, so kprobe_handler() > can safely bail out telling 'this trap is not mine' for any trap that > happened while in real-mode. > > If the trap happened with MSR_IR or MSR_DR cleared,

Re: [PATCH] powerpc/kprobes: Fix trap address when trap happened in real mode

2020-02-18 Thread Masami Hiramatsu
proposal below ? If a trap is > >> encoutered in real mode, if checks if the matching virtual address > >> corresponds to a valid kprobe. If it is, it skips it. If not, it returns > >> 0 to tell "it's no me". You are also talking about incrementing the > >> missed count. Who do we do that ? > > > > I rather like your first patch. If there is a kprobes, we can not skip > > the instruction, because there is an instruction which must be executed. > > (or single-skipped, but I'm not sure the emulator works correctly on > > real mode) > > Oops, yes of course. Thank you, -- Masami Hiramatsu

Re: [PATCH] powerpc/kprobes: Fix trap address when trap happened in real mode

2020-02-18 Thread Masami Hiramatsu
about incrementing the > missed count. Who do we do that ? I rather like your first patch. If there is a kprobes, we can not skip the instruction, because there is an instruction which must be executed. (or single-skipped, but I'm not sure the emulator works correctly on real mode) Thank you, > > > > @@ -264,6 +265,13 @@ int kprobe_handler(struct pt_regs *regs) > if (user_mode(regs)) > return 0; > > +if (!(regs->msr & MSR_IR)) { > +if (!get_kprobe(phys_to_virt(regs->nip))) > +return 0; > +regs->nip += 4; > +return 1; > +} > + > /* >* We don't want to be preempted for the entire >* duration of kprobe processing > > > > > > BTW, can the emulater handle the real mode code correctly? > > I don't know, how do I test that ? > > Christophe -- Masami Hiramatsu

Re: [PATCH] powerpc/kprobes: Fix trap address when trap happened in real mode

2020-02-17 Thread Masami Hiramatsu
On Mon, 17 Feb 2020 16:38:50 +0100 Christophe Leroy wrote: > > > Le 17/02/2020 à 11:27, Masami Hiramatsu a écrit : > > On Mon, 17 Feb 2020 10:03:22 +0100 > > Christophe Leroy wrote: > > > >> > >> > >> Le 16/02/2020 à 13:34, Masami Hirama

Re: [PATCH] powerpc/kprobes: Fix trap address when trap happened in real mode

2020-02-17 Thread Masami Hiramatsu
On Mon, 17 Feb 2020 10:03:22 +0100 Christophe Leroy wrote: > > > Le 16/02/2020 à 13:34, Masami Hiramatsu a écrit : > > On Sat, 15 Feb 2020 11:28:49 +0100 > > Christophe Leroy wrote: > > > >> Hi, > >> > >> Le 14/02/2020 à 14:54, Masami Hi

Re: [PATCH] powerpc/kprobes: Fix trap address when trap happened in real mode

2020-02-16 Thread Masami Hiramatsu
On Sat, 15 Feb 2020 11:28:49 +0100 Christophe Leroy wrote: > Hi, > > Le 14/02/2020 à 14:54, Masami Hiramatsu a écrit : > > Hi, > > > > On Fri, 14 Feb 2020 12:47:49 + (UTC) > > Christophe Leroy wrote: > > > >> When a program check exceptio

Re: [PATCH] powerpc/kprobes: Fix trap address when trap happened in real mode

2020-02-14 Thread Masami Hiramatsu
> > DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; > @@ -264,6 +265,9 @@ int kprobe_handler(struct pt_regs *regs) > if (user_mode(regs)) > return 0; > > + if (!(regs->msr & MSR_IR)) > + addr = phys_to_virt(regs->nip); > + > /* >* We don't want to be preempted for the entire >* duration of kprobe processing > -- > 2.25.0 > -- Masami Hiramatsu

Re: [PATCH v4 2/9] perf/core: open access for CAP_SYS_PERFMON privileged process

2020-01-11 Thread Masami Hiramatsu
t" > > From: Arnaldo Carvalho de Melo > Message-ID: > > On January 10, 2020 9:23:27 PM GMT-03:00, Song Liu > wrote: > > > > > >> On Jan 10, 2020, at 3:47 PM, Masami Hiramatsu > >wrote: > >> > >> On Fri, 10 Jan 2020 13:45:31 -0

Re: [PATCH v4 2/9] perf/core: open access for CAP_SYS_PERFMON privileged process

2020-01-10 Thread Masami Hiramatsu
On Fri, 10 Jan 2020 13:45:31 -0300 Arnaldo Carvalho de Melo wrote: > Em Sat, Jan 11, 2020 at 12:52:13AM +0900, Masami Hiramatsu escreveu: > > On Fri, 10 Jan 2020 15:02:34 +0100 Peter Zijlstra > > wrote: > > > Again, this only allows attaching to previously

Re: [PATCH v4 2/9] perf/core: open access for CAP_SYS_PERFMON privileged process

2020-01-10 Thread Masami Hiramatsu
eating kprobes, right? > > That is; I don't think CAP_SYS_PERFMON should be allowed to create > kprobes. > > As might be clear; I don't actually know what the user-ABI is for > creating kprobes. There are 2 ABIs nowadays, ftrace and ebpf. perf-probe uses ftrace interface to define new kprobe events, and those events are treated as completely same as tracepoint events. On the other hand, ebpf tries to define new probe event via perf_event interface. Above one is that interface. IOW, it creates new kprobe. Thank you, -- Masami Hiramatsu

Re: [PATCH v2 0/3] arm/arm64: Add support for function error injection

2019-08-06 Thread Masami Hiramatsu
asm-generic header (Will); > * Used APIs to access pt_regs elements (Will); > * Fixed typos in the comments (Will). This looks good to me. Reviewed-by: Masami Hiramatsu Thank you! > > > Leo Yan (3): > error-injection: Consolidate override function definitio

Re: [PATCH] mm/kprobes: Add generic kprobe_fault_handler() fallback definition

2019-07-11 Thread Masami Hiramatsu
s stud > >> definitions for generic kporbe_fault_handler() and kprobes_built_in() can > >> just be dropped. Only on x86 it needs to be added back locally as it gets > >> used in a !CONFIG_KPROBES function do_general_protection(). > > > > If you want to remove kprobes_built_in(), you should replace it with > > IS_ENABLED(CONFIG_KPROBES), instead of this... > > Apart from kprobes_built_in() the intent was to remove !CONFIG_KPROBES > stub for kprobe_fault_handler() as well which required making generic > kprobe_page_fault() to be empty in such case. No, I meant that "IS_ENABLED(CONFIG_KPROBES)" is generic and is equal to what kprobes_built_in() does. Thank you, -- Masami Hiramatsu

Re: [PATCH] mm/kprobes: Add generic kprobe_fault_handler() fallback definition

2019-07-05 Thread Masami Hiramatsu
lerman > Cc: Heiko Carstens > Cc: Vasily Gorbik > Cc: Christian Borntraeger > Cc: Yoshinori Sato > Cc: Rich Felker > Cc: "David S. Miller" > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: Borislav Petkov > Cc: "H. Peter Anvin" > Cc: "

Re: [PATCH v2 7/7] powerpc/kprobes: Allow probing on any ftrace address

2019-06-27 Thread Masami Hiramatsu
ocation() > > In addition, we update kprobe_ftrace_handler() to detect this scenarios > and to pass the proper nip to the pre and post probe handlers. > > Signed-off-by: Naveen N. Rao Looks good to me. Reviewed-by: Masami Hiramatsu Thank you! > --- > arch/powerpc/kern

Re: [PATCH 7/7] powerpc/kprobes: Allow probing on any ftrace address

2019-06-21 Thread Masami Hiramatsu
_handler returns !0, it changes regs->nip. We have to > @@ -57,6 +82,11 @@ NOKPROBE_SYMBOL(kprobe_ftrace_handler); > > int arch_prepare_kprobe_ftrace(struct kprobe *p) > { > + if ((unsigned long)p->addr & 0x03) { > + printk("Attempt to register kprobe at an unaligned address\n"); > + return -EILSEQ; > + } > + > p->ainsn.insn = NULL; > p->ainsn.boostable = -1; > return 0; > -- > 2.22.0 > -- Masami Hiramatsu

Re: [PATCH 6/7] kprobes/ftrace: Use ftrace_location() when [dis]arming probes

2019-06-21 Thread Masami Hiramatsu
e_function() to > identify the filter IP. This looks good to me. Acked-by: Masami Hiramatsu Thank you! > > Signed-off-by: Naveen N. Rao > --- > kernel/kprobes.c | 10 +- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/kernel/kprobes.c

[PATCH -tip v6 24/27] bpf: error-inject: kprobes: Clear current_kprobe and enable preempt in kprobe

2018-06-19 Thread Masami Hiramatsu
: for powerpc and x86, this removes all preempt_disable from kprobe_ftrace_handler because ftrace callbacks are called under preempt disabled. Signed-off-by: Masami Hiramatsu Acked-by: "Naveen N. Rao" Cc: Vineet Gupta Cc: Russell King Cc: Catalin Marinas Cc: Will Deacon Cc: Tony Luck C

[PATCH -tip v6 18/27] powerpc/kprobes: Don't call the ->break_handler() in powerpc kprobes code

2018-06-19 Thread Masami Hiramatsu
Don't call the ->break_handler() from the powerpc kprobes code, because it was only used by jprobes which got removed. This also removes skip_singlestep() and embeds it in the caller, kprobe_ftrace_handler(), which simplifies regs->nip operation around there. Signed-off-by: Masami Hir

[PATCH -tip v6 07/27] powerpc/kprobes: Remove jprobe powerpc implementation

2018-06-19 Thread Masami Hiramatsu
Remove arch dependent setjump/longjump functions and unused fields in kprobe_ctlblk for jprobes from arch/powerpc. This also reverts commits related __is_active_jprobe() function. Signed-off-by: Masami Hiramatsu Acked-by: "Naveen N. Rao" Cc: Benjamin Herrenschmidt Cc: Paul Mac

Re: [RFC PATCH -tip v5 18/27] powerpc/kprobes: Don't call the ->break_handler() in arm kprobes code

2018-06-07 Thread Masami Hiramatsu
On Thu, 07 Jun 2018 22:07:26 +0530 "Naveen N. Rao" wrote: > Masami Hiramatsu wrote: > > On Thu, 07 Jun 2018 17:07:00 +0530 > > "Naveen N. Rao" wrote: > > > >> Masami Hiramatsu wrote: > >> &

Re: [RFC PATCH -tip v5 18/27] powerpc/kprobes: Don't call the ->break_handler() in arm kprobes code

2018-06-07 Thread Masami Hiramatsu
On Thu, 07 Jun 2018 17:07:00 +0530 "Naveen N. Rao" wrote: > Masami Hiramatsu wrote: > > Don't call the ->break_handler() from the arm kprobes code, > ^^^ powerpc > > > because it was only used by jprobes which got

Re: [RFC PATCH -tip v5 07/27] powerpc/kprobes: Remove jprobe powerpc implementation

2018-06-07 Thread Masami Hiramatsu
On Thu, 07 Jun 2018 17:01:23 +0530 "Naveen N. Rao" wrote: > Masami Hiramatsu wrote: > > Remove arch dependent setjump/longjump functions > > and unused fields in kprobe_ctlblk for jprobes > > from arch/powerpc. This also reverts commits > > related __is_acti

[RFC PATCH -tip v5 24/27] bpf: error-inject: kprobes: Clear current_kprobe and enable preempt in kprobe

2018-06-04 Thread Masami Hiramatsu
: for powerpc and x86, this removes all preempt_disable from kprobe_ftrace_handler because ftrace callbacks are called under preempt disabled. Signed-off-by: Masami Hiramatsu Cc: Vineet Gupta Cc: Russell King Cc: Catalin Marinas Cc: Will Deacon Cc: Tony Luck Cc: Fenghua Yu Cc: Ralf Baechle Cc

[RFC PATCH -tip v5 18/27] powerpc/kprobes: Don't call the ->break_handler() in arm kprobes code

2018-06-04 Thread Masami Hiramatsu
Don't call the ->break_handler() from the arm kprobes code, because it was only used by jprobes which got removed. This also makes skip_singlestep() a static function since only ftrace-kprobe.c is using this function. Signed-off-by: Masami Hiramatsu Cc: Benjamin Herrenschmidt Cc: P

[RFC PATCH -tip v5 07/27] powerpc/kprobes: Remove jprobe powerpc implementation

2018-06-04 Thread Masami Hiramatsu
Remove arch dependent setjump/longjump functions and unused fields in kprobe_ctlblk for jprobes from arch/powerpc. This also reverts commits related __is_active_jprobe() function. Signed-off-by: Masami Hiramatsu Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: "Nav

Re: [PATCH 1/2] error-injection: Simplify arch specific helpers

2018-06-01 Thread Masami Hiramatsu
On Thu, 31 May 2018 15:39:03 +0530 "Naveen N. Rao" wrote: > Masami Hiramatsu wrote: > > On Tue, 29 May 2018 18:06:02 +0530 > > "Naveen N. Rao" wrote: > > > >> We already have an arch-independent way to set the instruction pointer > >>

Re: [PATCH 1/2] error-injection: Simplify arch specific helpers

2018-05-30 Thread Masami Hiramatsu
t pt_regs *, regs, unsigned long, rc) > { > regs_set_return_value(regs, rc); > - override_function_with_return(regs); > + instruction_pointer_set(regs, (unsigned long)_return_func); > return 0; > } > > diff --git a/lib/error-inject.c b/lib/error-inject.c > index c0d4600f4896..7fdc92b5babc 100644 > --- a/lib/error-inject.c > +++ b/lib/error-inject.c > @@ -20,6 +20,14 @@ struct ei_entry { > void *priv; > }; > > +asm( > + ".type just_return_func, @function\n" > + ".globl just_return_func\n" > + "just_return_func:\n" > + ARCH_FUNC_RET "\n" > + ".size just_return_func, .-just_return_func\n" > +); > + > bool within_error_injection_list(unsigned long addr) > { > struct ei_entry *ent; > -- > 2.17.0 > -- Masami Hiramatsu

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

2017-10-25 Thread Masami Hiramatsu
ing earlier. However, this function was not added > to the kprobes blacklist. Add it so as to prevent it from being probed. > Looks good to me. Acked-by: Masami Hiramatsu <mhira...@kernel.org> Thank you! > Signed-off-by: Naveen N. Rao <naveen.n@linux.vnet.ibm.com> >

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

2017-10-25 Thread Masami Hiramatsu
; + ret = strscpy(dot_name + len, c, KSYM_NAME_LEN); > + if (ret > 0) > + addr = (kprobe_opcode_t *)kallsyms_lookup_name(dot_name); > + > + /* Fallback to the original non-dot symbol lookup */ > + if (!addr && dot_appended) > addr = (kprobe_opcode_t *)kallsyms_lookup_name(name); Then we can remove dot_appended. Thank you, > - } > #else > addr = (kprobe_opcode_t *)kallsyms_lookup_name(name); > #endif > -- > 2.14.2 > -- Masami Hiramatsu <mhira...@kernel.org>

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

2017-10-24 Thread Masami Hiramatsu
b2e3d783964 ("kprobes/x86: Remove > IRQ disabling from ftrace-based/optimized kprobes"). Do the same for > powerpc. Yes, and this requires to make preempt disable :) Acked-by: Masami Hiramatsu <mhira...@kernel.org> Thank you! > > Signed-off-by: Naveen N. Rao <navee

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

2017-10-24 Thread Masami Hiramatsu
Actually, if you local_irq_save(), it also disables preempt. So unless you enables irqs, it should be safe. Acked-by: Masami Hiramatsu <mhira...@kernel.org> Thank you, > Signed-off-by: Naveen N. Rao <naveen.n@linux.vnet.ibm.com> > --- > arch/powerpc/kernel/optprobes.c |

Re: [PATCH 4/5] powerpc/jprobes: Disable preemption when triggered through ftrace

2017-09-14 Thread Masami Hiramatsu
On Thu, 14 Sep 2017 15:55:39 +0530 "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote: > On 2017/09/13 05:05PM, Masami Hiramatsu wrote: > > On Thu, 14 Sep 2017 02:50:35 +0530 > > "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote: > &

Re: [PATCH 3/5] powerpc/kprobes: Fix warnings from __this_cpu_read() on preempt kernels

2017-09-14 Thread Masami Hiramatsu
On Thu, 14 Sep 2017 12:17:20 +0530 "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote: > On 2017/09/13 05:36PM, Masami Hiramatsu wrote: > > On Thu, 14 Sep 2017 02:50:34 +0530 > > "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote: >

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

2017-09-14 Thread Masami Hiramatsu
On Thu, 14 Sep 2017 12:08:07 +0530 "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote: > On 2017/09/13 04:53PM, Masami Hiramatsu wrote: > > On Thu, 14 Sep 2017 02:50:33 +0530 > > "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote: > &g

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

2017-09-13 Thread Masami Hiramatsu
On Thu, 14 Sep 2017 02:50:36 +0530 "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> 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 > jprobe_return(). > Looks good to me.

Re: [PATCH 3/5] powerpc/kprobes: Fix warnings from __this_cpu_read() on preempt kernels

2017-09-13 Thread Masami Hiramatsu
obe_running(); > - return (p && (unsigned long)p->addr == addr) ? 1 : 0; > + if (!preemptible()) { > + struct kprobe *p = raw_cpu_read(current_kprobe); > + return (p && (unsigned long)p->addr == addr) ? 1 : 0; > + } > + > + return 0; > } > > bool arch_within_kprobe_blacklist(unsigned long addr) > -- > 2.14.1 > -- Masami Hiramatsu <mhira...@kernel.org>

Re: [PATCH 4/5] powerpc/jprobes: Disable preemption when triggered through ftrace

2017-09-13 Thread Masami Hiramatsu
3d22001b 39299240 8129 2f89 409effc8 3c82ffcb > 3c62ffcb > [3.149879] 3884bc68 3863bc18 4803d5fd 6000 <0fe0> 4ba8 > 6000 6000 > [3.149890] ---[ end trace 432dd46b4ce3d29f ]--- > [3.166003] Kprobe smoke test: passed successfully

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

2017-09-13 Thread Masami Hiramatsu
+ * then this is just an error with the current run. We return > + * 0 so that this is now single-stepped, but continue to try > + * emulating it in subsequent probe hits. > + */ > + if (unlikely(p->ainsn.boostable != 1)) > + p->ainsn.boostable = -1; > + } > > return ret; > } > -- > 2.14.1 > -- Masami Hiramatsu <mhira...@kernel.org>

Re: [PATCH 1/5] powerpc/kprobes: Some cosmetic updates to try_to_emulate()

2017-09-13 Thread Masami Hiramatsu
.@linux.vnet.ibm.com> Reviewed-by: Masami Hiramatsu <mhira...@kernel.org> Thanks! > --- > arch/powerpc/kernel/kprobes.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c > in

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

2017-07-02 Thread Masami Hiramatsu
On Mon, 3 Jul 2017 12:27:33 +0900 Masami Hiramatsu <mhira...@kernel.org> wrote: > On Thu, 29 Jun 2017 19:05:37 +0530 > "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote: > > > Add a kprobes test to ensure that we are able to add a probe on a > >

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

2017-07-02 Thread Masami Hiramatsu
On Thu, 29 Jun 2017 19:05:39 +0530 "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote: > From: Masami Hiramatsu <mhira...@kernel.org> > > Add a testcase for kprobe event naming. This testcase > checks whether the kprobe events can automatically ganerate &

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

2017-07-02 Thread Masami Hiramatsu
on ftrace location. The current offset of 4 will fall before the > function local entry point and won't fire, while an offset of 12 or 16 > will fall on ftrace location. Offset 8 is currently guaranteed to not be > the ftrace location. OK, looks good to me. Acked-by: Masami Hiramatsu <mhi

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

2017-07-02 Thread Masami Hiramatsu
On Thu, 29 Jun 2017 19:05:37 +0530 "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote: > 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

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

2017-06-28 Thread Masami Hiramatsu
On Thu, 29 Jun 2017 00:13:24 +0530 "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote: > On 2017/06/28 11:16PM, Masami Hiramatsu wrote: > > > > diff --git > > > > a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_eventname.tc > > &

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

2017-06-28 Thread Masami Hiramatsu
On Wed, 28 Jun 2017 14:58:46 +0530 "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote: > On 2017/06/24 08:06PM, Masami Hiramatsu wrote: > > On Sat, 24 Jun 2017 02:30:21 +0900 > > Masami Hiramatsu <mhira...@kernel.org> wrote: > > > > > On

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

2017-06-24 Thread Masami Hiramatsu
On Sat, 24 Jun 2017 02:30:21 +0900 Masami Hiramatsu <mhira...@kernel.org> wrote: > On Thu, 22 Jun 2017 22:33:25 +0530 > "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote: > > > On 2017/06/22 06:07PM, Masami Hiramatsu wrote: > > > On Thu, 2

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

2017-06-23 Thread Masami Hiramatsu
On Fri, 23 Jun 2017 00:33:45 +0530 "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote: > On 2017/06/22 06:29PM, Masami Hiramatsu wrote: > > On Thu, 22 Jun 2017 00:20:27 +0530 > > "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote: >

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

2017-06-23 Thread Masami Hiramatsu
On Thu, 22 Jun 2017 22:33:25 +0530 "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote: > On 2017/06/22 06:07PM, Masami Hiramatsu wrote: > > On Thu, 22 Jun 2017 00:20:28 +0530 > > "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote:

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

2017-06-22 Thread Masami Hiramatsu
s not rejected. Oops, ok, this is my mistake. Acked-by: Masami Hiramatsu <mhira...@kernel.org> This must be marked as bugfix for stable trees. Could you also add a testcase for this (module name) bug? MODNAME=`lsmod | head -n 2 | tail -n 1 | cut -f 1 -d " "` FUNCNAME=`grep -m

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

2017-06-22 Thread Masami Hiramatsu
i}+${OFFS} ; done > kprobe_events ||: > +grep t /proc/kallsyms | cut -f3 -d" " | head -n 256 | \ > +while read i; do echo p ${i}+${OFFS} ; done > kprobe_events ||: > > echo 1 > events/kprobes/enable > echo 0 > events/kprobes/enable > -- > 2.13.1 > -- Masami Hiramatsu <mhira...@kernel.org>

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

2017-06-13 Thread Masami Hiramatsu
On Wed, 14 Jun 2017 11:40:08 +0900 Masami Hiramatsu <mhira...@kernel.org> wrote: > On Fri, 9 Jun 2017 00:53:08 +0530 > "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote: > > > Add a test to verify that the registers passed in pt_regs

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

2017-06-13 Thread Masami Hiramatsu
t... skipping optprobe test\n"); Yes, this may take a while... you may need to wait for optimizer, like wait_for_kprobe_optimizer(). Thank you, > + unregister_kprobe(); > + goto summary; > + } > + > + preh_val = 0; > + arch_kprobe_regs_function(); > + unregister_kprobe(); > + > + if (preh_val == 0) { > + pr_err("optprobe pre_handler regs validation failed\n"); > + handler_errors++; > + } > + > +summary: > + if (errors) > + pr_err("BUG: %d out of %d tests failed\n", errors, num_tests); > + else if (handler_errors) > + pr_err("BUG: %d error(s) running handlers\n", handler_errors); > + else > + pr_info("passed successfully\n"); > +} > +#endif > +#endif > + > int init_test_probes(void) > { > int ret; > @@ -378,12 +539,34 @@ int init_test_probes(void) > errors++; > #endif /* CONFIG_KRETPROBES */ > > +#ifdef HAVE_KPROBES_REGS_SANITY_TEST > + num_tests++; > + ret = test_kprobe_regs(); > + if (ret < 0) > + errors++; > + > +#ifdef CONFIG_KPROBES_ON_FTRACE > + num_tests++; > + ret = test_kp_on_ftrace_regs(); > + if (ret < 0) > + errors++; > +#endif > + > +#ifdef CONFIG_OPTPROBES > + num_tests++; > + test_optprobe_regs_setup(); > + schedule_delayed_work(_optprobe_regs_work, 10); > +#endif > +#endif > + > +#if !defined(HAVE_KPROBES_REGS_SANITY_TEST) || !defined(CONFIG_OPTPROBES) > if (errors) > pr_err("BUG: %d out of %d tests failed\n", errors, num_tests); > else if (handler_errors) > pr_err("BUG: %d error(s) running handlers\n", handler_errors); > else > pr_info("passed successfully\n"); > +#endif > > return 0; > } > -- > 2.12.2 > -- Masami Hiramatsu <mhira...@kernel.org>

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

2017-06-08 Thread Masami Hiramatsu
seems good to me, but I weould like to leave it for PPC64 maintainer too. Reviewed-by: Masami Hiramatsu <mhira...@kernel.org> Thanks! > > Fixes: ead514d5fb30a ("powerpc/kprobes: Add support for > KPROBES_ON_FTRACE") > Signed-off-by: Naveen N. Rao <naveen.n@l

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

2017-06-08 Thread Masami Hiramatsu
cing before invoking the jprobe hook and re-enable it > when returning back to the original jprobe'd function. > > Fixes: 6794c78243bfd ("powerpc64: port of the function graph tracer") > Signed-off-by: Naveen N. Rao <naveen.n@linux.vnet.ibm.com> Acked-by: Ma

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

2017-05-16 Thread Masami Hiramatsu
IOW, please return silently, or just add a debug message. Thank you, > + } > + > memcpy(regs, >jprobe_saved_regs, sizeof(struct pt_regs)); > sp = kernel_stack_pointer(regs); > memcpy((void *)sp, >jprobes_stack, MIN_STACK_SIZE(sp)); > -- > 2.12.2 > -- Masami Hiramatsu <mhira...@kernel.org>

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

2017-05-16 Thread Masami Hiramatsu
Could you add CUR_STACK_SIZE(addr) as x86 does instead of repeating similar code? Thank you, -- Masami Hiramatsu <mhira...@kernel.org>

Re: [PATCH 0/4] powerpc: build out kprobes blacklist

2017-04-26 Thread Masami Hiramatsu
s into private -- these are labels that I > felt are not necessary to read stack traces. If any of those are > important to have, please let me know. At least from the viewpoint of kprobe-blacklist macros, it seems good to me :) Reviewed-by: Masami Hiramatsu <mhira...@kernel.org> for this

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

2017-04-26 Thread Masami Hiramatsu
t the code too > much. > > Thanks for the review! > - Naveen > > -- > [PATCH v2] kallsyms: optimize kallsyms_lookup_name() for a few cases > > 1. Fail early for invalid/zero length symbols. > 2. Detect names of the form and skip checking for kernel > sym

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

2017-04-25 Thread Masami Hiramatsu
addr = (kprobe_opcode_t *)kallsyms_lookup_name(dot_name); > + > + /* Fallback to the original non-dot symbol lookup */ > + if (!addr && dot_appended) > addr = (kprobe_opcode_t *)kallsyms_lookup_name(name); > - } > #else > addr = (kprobe_opcode_t *)kallsyms_lookup_name(name); > #endif > -- > 2.12.1 > -- Masami Hiramatsu <mhira...@kernel.org>

Re: [PATCH v3 3/7] kprobes: validate the symbol name length

2017-04-24 Thread Masami Hiramatsu
rn about > > "longer" string (for performance reason), we can focus on > > such case. > > (BTW, could you also check the name != NULL at first?) > > > > So, what I think it can be; > > > > if (strnlen(s+1, KSYM_NAME_LEN) == KSYM_NAME_LEN || > > (size_t)(s - name) >= MODULE_NAME_LEN) > > return false; > > Sure, thanks. I clearly need to refactor this code better! > > - Naveen > > -- Masami Hiramatsu <mhira...@kernel.org>

Re: [PATCH v4 3/7] kprobes: validate the symbol name provided during probe registration

2017-04-21 Thread Masami Hiramatsu
b/kernel/trace/trace_kprobe.c > @@ -704,6 +704,10 @@ static int create_trace_kprobe(int argc, char **argv) > pr_info("Return probe must be used without offset.\n"); > return -EINVAL; > } > + if (!is_valid_kprobe_symbol_name(symbol)) { > + pr_info("Symbol name is too long.\n"); > + return -EINVAL; > + } > } > argc -= 2; argv += 2; > > -- > 2.12.1 > -- Masami Hiramatsu <mhira...@kernel.org>

Re: [PATCH v3 6/7] powerpc: kprobes: emulate instructions on kprobe handler re-entry

2017-04-21 Thread Masami Hiramatsu
> felt that Michael Ellerman prefers to keep functional changes separate > > from refactoring. I'm fine with either approach. > > > > Michael? > > Yeah I'd definitely like this to be two patches. Otherwise when reading > the combined diff it's much harder to s

Re: [PATCH v3 3/7] kprobes: validate the symbol name length

2017-04-21 Thread Masami Hiramatsu
turn ERR_PTR(-ENOENT); > >> diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c > >> index 5f688cc724f0..bf73e5f31128 100644 > >> --- a/kernel/trace/trace_kprobe.c > >> +++ b/kernel/trace/trace_kprobe.c > >> @@ -704,6 +704,10 @@ static int create_trace_kprobe(int argc, char **argv) > >>pr_info("Return probe must be used without offset.\n"); > >>return -EINVAL; > >>} > >> + if (!is_valid_kprobe_symbol_name(symbol)) { > >> + pr_info("Symbol name is too long.\n"); > >> + return -EINVAL; > >> + } > >>} > >>argc -= 2; argv += 2; > >> > >> -- > >> 2.12.1 > >> > > > > Thanks, > > > > -- > > Masami Hiramatsu <mhira...@kernel.org> > > > > > -- Masami Hiramatsu <mhira...@kernel.org>

Re: [PATCH v3 5/7] powerpc: kprobes: factor out code to emulate instruction into a helper

2017-04-19 Thread Masami Hiramatsu
* good to catch them, just in case... > - */ > - printk("Can't step on instruction %x\n", insn); > - BUG(); > - } else if (ret == 0) > - /* This instruction can't be boosted */ > - p->ainsn.boostable = -1; > + } > } > prepare_singlestep(p, regs); > kcb->kprobe_status = KPROBE_HIT_SS; > -- > 2.12.1 > -- Masami Hiramatsu <mhira...@kernel.org>

Re: [PATCH v3 7/7] powerpc: kprobes: remove duplicate saving of msr

2017-04-19 Thread Masami Hiramatsu
On Wed, 19 Apr 2017 18:21:06 +0530 "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote: > set_current_kprobe() already saves regs->msr into kprobe_saved_msr. Remove > the redundant save. > Looks good to me. Reviewed-by: Masami Hiramatsu <mhira...@kernel

Re: [PATCH v3 6/7] powerpc: kprobes: emulate instructions on kprobe handler re-entry

2017-04-19 Thread Masami Hiramatsu
if (ret > 0) { > + restore_previous_kprobe(kcb); > + return 1; > + } > + } > return 1; > } else { > if (*addr != BREAKPOINT_INSTRUCTION) { > -- > 2.12.1 > -- Masami Hiramatsu <mhira...@kernel.org>

Re: [PATCH v3 3/7] kprobes: validate the symbol name length

2017-04-19 Thread Masami Hiramatsu
;); > return -EINVAL; > } > + if (!is_valid_kprobe_symbol_name(symbol)) { > + pr_info("Symbol name is too long.\n"); > + return -EINVAL; > + } > } > argc -= 2; argv += 2; > > -- > 2.12.1 > Thanks, -- Masami Hiramatsu <mhira...@kernel.org>

Re: [PATCH v2 5/5] powerpc: kprobes: emulate instructions on kprobe handler re-entry

2017-04-12 Thread Masami Hiramatsu
); > + > + if (ret > 0) { > + restore_previous_kprobe(kcb); > + return 1; > + } > + } > return 1; > } else { > if (*addr != BREAKPOINT_INSTRUCTION) { > -- > 2.12.1 > -- Masami Hiramatsu <mhira...@kernel.org>

Re: [PATCH v2 4/5] powerpc: kprobes: factor out code to emulate instruction into a helper

2017-04-12 Thread Masami Hiramatsu
mtmsr(d)/rfi(d), etc. > - * So, we should never get here... but, its still > - * good to catch them, just in case... > - */ > - printk("Can't step on instruction %x\n", insn); > - BUG(); > - } else if (ret == 0) > - /* This instruction can't be boosted */ > - p->ainsn.boostable = -1; > + } > } > prepare_singlestep(p, regs); > kcb->kprobe_status = KPROBE_HIT_SS; > -- > 2.12.1 > -- Masami Hiramatsu <mhira...@kernel.org>

Re: [PATCH v2 3/5] powerpc: introduce a new helper to obtain function entry points

2017-04-12 Thread Masami Hiramatsu
e("optimized_callback", 0); > - emulate_step_addr = kprobe_lookup_name("emulate_step", 0); > + op_callback_addr = (kprobe_opcode_t > *)ppc_kallsyms_lookup_name("optimized_callback"); > + emulate_step_addr = (kprobe_opcode_t > *)ppc_kallsyms_lookup_name("emulate_step"); > if (!op_callback_addr || !emulate_step_addr) { > - WARN(1, "kprobe_lookup_name() failed\n"); > + WARN(1, "Unable to lookup > optimized_callback()/emulate_step()\n"); > goto error; > } > > -- > 2.12.1 > -- Masami Hiramatsu <mhira...@kernel.org>

Re: [PATCH v2 2/5] powerpc: kprobes: fix handling of function offsets on ABIv2

2017-04-12 Thread Masami Hiramatsu
(struct kprobe_ctlblk, kprobe_ctlblk); > > struct kretprobe_blackpoint kretprobe_blacklist[] = {{NULL, NULL}}; > > -kprobe_opcode_t *kprobe_lookup_name(const char *name) > +kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset) Hmm, if we do this change, it is natural that kprobe_lookup_name() returns the address + offset. Thank you, -- Masami Hiramatsu <mhira...@kernel.org>

Re: [PATCH v2 1/5] kprobes: convert kprobe_lookup_name() to a function

2017-04-12 Thread Masami Hiramatsu
nction. Looks good to me. Acked-by: Masami Hiramatsu <mhira...@kernel.org> Thanks! > > Suggested-by: Masami Hiramatsu <mhira...@kernel.org> > Signed-off-by: Naveen N. Rao <naveen.n@linux.vnet.ibm.com> > --- > arch/powerpc/include/asm/kprobes.h | 53 -

Re: [PATCH v2 0/5] powerpc: a few kprobe fixes and refactoring

2017-04-12 Thread Masami Hiramatsu
| 6 +- > include/linux/kprobes.h | 1 + > kernel/kprobes.c | 21 +++--- > 6 files changed, 147 insertions(+), 90 deletions(-) > > -- > 2.12.1 > -- Masami Hiramatsu <mhira...@kernel.org>

Re: [PATCH v5 5/5] perf: powerpc: choose local entry point with kretprobes

2017-03-08 Thread Masami Hiramatsu
so as to ensure the probe gets hit. Do it only > if the kernel supports specifying offsets with kretprobes. Acked-by: Masami Hiramatsu <mhira...@kernel.org> This patch is OK. And I found that most of functions in sym-handling.c are used only when libelf is supported. (e.g. probe-event.

Re: [PATCH] powerpc: kprobes: convert __kprobes to NOKPROBE_SYMBOL()

2017-03-08 Thread Masami Hiramatsu
OKPROBE_SYMBOL() or nokprobe_inline. The latter > forces inlining, in which case the caller needs to be added to > NOKPROBE_SYMBOL(). Acked-by: Masami Hiramatsu <mhira...@kernel.org> OK, this is a good starting point so far. please consider that those functions really have to be protected by

Re: [PATCH 5/6] perf: probes: move ftrace README parsing logic into trace-event-parse.c

2017-03-07 Thread Masami Hiramatsu
ce_readme_table[i].avail = > + strglobmatch(buf, > ftrace_readme_table[i].pattern); > + scanned = true; > + > + fclose(fp); > + free(buf); > + > +result: > + if (type >= FTRACE_README_END) > + return false; > + > + return ftrace_readme_table[type].avail; > +} > + > +bool kretprobe_offset_is_supported(void) > +{ > + return scan_ftrace_readme(FTRACE_README_KRETPROBE_OFFSET); > +} > + > +bool probe_type_x_is_supported(void) > +{ > + return scan_ftrace_readme(FTRACE_README_PROBE_TYPE_X); > +} > diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h > index 1fbc044f9eb0..ecda2d822daf 100644 > --- a/tools/perf/util/trace-event.h > +++ b/tools/perf/util/trace-event.h > @@ -37,6 +37,10 @@ int parse_ftrace_file(struct pevent *pevent, char *buf, > unsigned long size); > int parse_event_file(struct pevent *pevent, >char *buf, unsigned long size, char *sys); > > +int open_trace_file(const char *trace_file, bool readwrite); > +bool kretprobe_offset_is_supported(void); > +bool probe_type_x_is_supported(void); > + > unsigned long long > raw_field_value(struct event_format *event, const char *name, void *data); > > -- > 2.11.1 > -- Masami Hiramatsu <mhira...@kernel.org>

Re: [PATCH 5/6] perf: probes: move ftrace README parsing logic into trace-event-parse.c

2017-03-07 Thread Masami Hiramatsu
ed = true; > + > + fclose(fp); > + free(buf); > + > +result: > + if (type >= FTRACE_README_END) > + return false; > + > + return ftrace_readme_table[type].avail; > +} > + > +bool kretprobe_offset_is_supported(void) > +{ > + return scan_ftrace_readme(FTRACE_README_KRETPROBE_OFFSET); > +} > + > +bool probe_type_x_is_supported(void) > +{ > + return scan_ftrace_readme(FTRACE_README_PROBE_TYPE_X); > +} > diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h > index 1fbc044f9eb0..ecda2d822daf 100644 > --- a/tools/perf/util/trace-event.h > +++ b/tools/perf/util/trace-event.h > @@ -37,6 +37,10 @@ int parse_ftrace_file(struct pevent *pevent, char *buf, > unsigned long size); > int parse_event_file(struct pevent *pevent, >char *buf, unsigned long size, char *sys); > > +int open_trace_file(const char *trace_file, bool readwrite); > +bool kretprobe_offset_is_supported(void); > +bool probe_type_x_is_supported(void); > + > unsigned long long > raw_field_value(struct event_format *event, const char *name, void *data); > > -- > 2.11.1 > -- Masami Hiramatsu <mhira...@kernel.org>

Re: [PATCH v4 2/3] perf: kretprobes: offset from reloc_sym if kernel supports it

2017-03-06 Thread Masami Hiramatsu
On Mon, 6 Mar 2017 20:34:10 +0530 "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote: > On 2017/03/04 09:49AM, Masami Hiramatsu wrote: > > On Thu, 2 Mar 2017 23:25:06 +0530 > > "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote: > >

Re: [PATCH v4 2/3] perf: kretprobes: offset from reloc_sym if kernel supports it

2017-03-06 Thread Masami Hiramatsu
tch is fine? OK, looks good to me:) Acked-by: Masami Hiramatsu <mhira...@kernel.org> Thanks! > > Thanks, > Naveen > > -- > trace/kprobes: fix check for kretprobe offset within function entry > > perf specifies an offset from _text and since this offset is fed > d

Re: [PATCH v4 2/3] perf: kretprobes: offset from reloc_sym if kernel supports it

2017-03-03 Thread Masami Hiramatsu
On Sat, 4 Mar 2017 11:35:51 +0900 Masami Hiramatsu <mhira...@kernel.org> wrote: > On Sat, 4 Mar 2017 09:49:11 +0900 > Masami Hiramatsu <mhira...@kernel.org> wrote: > > > On Thu, 2 Mar 2017 23:25:06 +0530 > > "Naveen N. Rao" <naveen.n@linux.vnet.

Re: [PATCH v4 2/3] perf: kretprobes: offset from reloc_sym if kernel supports it

2017-03-03 Thread Masami Hiramatsu
On Sat, 4 Mar 2017 11:35:51 +0900 Masami Hiramatsu <mhira...@kernel.org> wrote: > On Sat, 4 Mar 2017 09:49:11 +0900 > Masami Hiramatsu <mhira...@kernel.org> wrote: > > > On Thu, 2 Mar 2017 23:25:06 +0530 > > "Naveen N. Rao" <naveen.n@linux.vnet.

Re: [PATCH v4 2/3] perf: kretprobes: offset from reloc_sym if kernel supports it

2017-03-03 Thread Masami Hiramatsu
On Sat, 4 Mar 2017 09:49:11 +0900 Masami Hiramatsu <mhira...@kernel.org> wrote: > On Thu, 2 Mar 2017 23:25:06 +0530 > "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote: > > > We indicate support for accepting sym+offset with kretprobes through a >

Re: [PATCH v4 3/3] perf: powerpc: choose local entry point with kretprobes

2017-03-03 Thread Masami Hiramatsu
so as to ensure the probe gets hit. Do it only > if the kernel supports specifying offsets with kretprobes. Looks good to me. Acked-by: Masami Hiramatsu <mhira...@kernel.org> Thanks! > > Signed-off-by: Naveen N. Rao <naveen.n@linux.vnet.ibm.com> > --- > tools/perf/a

Re: [PATCH v4 2/3] perf: kretprobes: offset from reloc_sym if kernel supports it

2017-03-03 Thread Masami Hiramatsu
*probe_cache__find_by_name(struct > probe_cache *pcache, > const char *group, const char *event); > int probe_cache__show_all_caches(struct strfilter *filter); > bool probe_type_is_available(enum probe_type type); > +bool kretprobe_offset_is_supported(void); > #else/* ! HAVE_LIBELF_SUPPORT */ > static inline struct probe_cache *probe_cache__new(const char *tgt > __maybe_unused) > { > -- > 2.11.1 > -- Masami Hiramatsu <mhira...@kernel.org>

Re: [PATCH v4 1/3] perf: probe: factor out the ftrace README scanning

2017-03-03 Thread Masami Hiramatsu
t. > > Since we are only interested in availability of probe argument type x, > we will only scan for that. Ah, OK, this can simplify and shorten the actual scanning time. If there are any needs for checking those in the future, we can add it again at that moment. Acked-by: Masami Hiramats

Re: [PATCH v2 3.5/5] trace/kprobes: Add back warning about offset in return probes

2017-02-27 Thread Masami Hiramatsu
On Mon, 27 Feb 2017 11:52:04 -0500 "Steven Rostedt (VMware)" <rost...@goodmis.org> wrote: > Let's not remove the warning about offsets and return probes when the > offset is invalid. Agreed, This looks good to me. Acked-by: Masami Hiramatsu <mhira...@kernel.org&g

Re: [PATCH v2 4/5] perf: kretprobes: offset from reloc_sym if kernel supports it

2017-02-24 Thread Masami Hiramatsu
On Fri, 24 Feb 2017 17:11:03 -0300 Arnaldo Carvalho de Melo <a...@kernel.org> wrote: > Em Sat, Feb 25, 2017 at 02:29:17AM +0900, Masami Hiramatsu escreveu: > > On Fri, 24 Feb 2017 00:46:08 +0530 > > "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrot

Re: [PATCH v2 4/5] perf: kretprobes: offset from reloc_sym if kernel supports it

2017-02-24 Thread Masami Hiramatsu
On Fri, 24 Feb 2017 00:46:08 +0530 "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote: > On 2017/02/23 06:10PM, Masami Hiramatsu wrote: > > On Wed, 22 Feb 2017 19:23:40 +0530 > > "Naveen N. Rao" <naveen.n@linux.vnet.ibm.com> wrote: > >

Re: [PATCH v3 2/2] perf: kretprobes: offset from reloc_sym if kernel supports it

2017-02-24 Thread Masami Hiramatsu
nel_get_ref_reloc_sym(); > if (!reloc_sym) { > pr_warning("Relocated base symbol is not found!\n"); > diff --git a/tools/perf/util/probe-event.h b/tools/perf/util/probe-event.h > index 5d4e94061402..449d4f311355 100644 > --- a/tools/perf/util/probe-e

  1   2   >