[PATCH 5/6] tracing/boot,kprobe,synth: Initialize boot-time tracing earlier

2020-09-10 Thread Masami Hiramatsu
Initialize boot-time tracing in core_initcall_sync instead of fs_initcall, and initialize required tracers (kprobes and synth) in core_initcall. This will allow the boot-time tracing to trace __init code from the beginning of postcore_initcall stage. Signed-off-by: Masami Hiramatsu --- kernel

[PATCH 4/6] tracing: Enable creating new instance early boot

2020-09-10 Thread Masami Hiramatsu
Enable creating new trace_array instance in early boot stage. If the instances directory is not created, postpone it until the tracefs is initialized. Signed-off-by: Masami Hiramatsu --- kernel/trace/trace.c | 53 kernel/trace/trace.h

[PATCH 6/6] Documentation: tracing: Add the startup timing of boot-time tracing

2020-09-10 Thread Masami Hiramatsu
Add the note about when to start the boot-time tracing. This will be needed for the people who wants to trace earlier boot sequence. Signed-off-by: Masami Hiramatsu --- Documentation/trace/boottime-trace.rst | 14 ++ 1 file changed, 14 insertions(+) diff --git a/Documentation

[PATCH v3 2/8] tracing/boot: Add per-instance tracing_on option support

2020-09-10 Thread Masami Hiramatsu
Add per-instance tracing_on option, which will be useful with traceon/traceoff event trigger actions. For example, if we disable tracing_on by default and set traceon and traceoff on a pair of events, we can trace functions between the pair of events. Signed-off-by: Masami Hiramatsu --- kernel

[PATCH v3 5/8] tracing/uprobes: Support perf-style return probe

2020-09-10 Thread Masami Hiramatsu
Support perf-style return probe ("SYMBOL%return") for uprobe events as same as kprobe events does. Signed-off-by: Masami Hiramatsu --- kernel/trace/trace.c|2 +- kernel/trace/trace_uprobe.c | 15 ++- 2 files changed, 15 insertions(+), 2 deletions(-)

[PATCH v3 8/8] selftests/ftrace: Add %return suffix tests

2020-09-10 Thread Masami Hiramatsu
Add kprobe %return suffix testcase and syntax error tests for %return suffix. Signed-off-by: Masami Hiramatsu --- .../ftrace/test.d/kprobe/kprobe_syntax_errors.tc |6 ++ .../test.d/kprobe/kretprobe_return_suffix.tc | 21 .../ftrace/test.d/kprobe

[PATCH v3 7/8] Documentation: tracing: boot: Add an example of tracing function-calls

2020-09-10 Thread Masami Hiramatsu
Add an example of tracing function calls on a specific function. Signed-off-by: Masami Hiramatsu --- Documentation/trace/boottime-trace.rst | 20 1 file changed, 20 insertions(+) diff --git a/Documentation/trace/boottime-trace.rst b/Documentation/trace/boottime

[PATCH v3 6/8] Documentation: tracing: Add %return suffix description

2020-09-10 Thread Masami Hiramatsu
Add a description of the %return suffix option for kprobe event and uprobe event. Signed-off-by: Masami Hiramatsu --- Changes in v3 - Add description for uprobe events too. Changes in v2 - Use a tab for indentation as other lines do. --- Documentation/trace/kprobetrace.rst |2

[PATCH v3 3/8] Documentation: tracing: Add tracing_on option to boot-time tracer

2020-09-10 Thread Masami Hiramatsu
Add tracing_on option description to the boot-time tracer. Signed-off-by: Masami Hiramatsu --- Documentation/trace/boottime-trace.rst |4 1 file changed, 4 insertions(+) diff --git a/Documentation/trace/boottime-trace.rst b/Documentation/trace/boottime-trace.rst index dcb390075ca1

[PATCH v3 4/8] tracing/kprobes: Support perf-style return probe

2020-09-10 Thread Masami Hiramatsu
Support perf-style return probe ("SYMBOL%return") for kprobe events. This will allow boot-time tracing user to define a return probe event. Signed-off-by: Masami Hiramatsu --- Changes in v3: - Update README so that user can notice the kernel supports this feature. - Add a new err

[PATCH v3 1/8] kprobes: tracing/kprobes: Fix to kill kprobes on initmem after boot

2020-09-10 Thread Masami Hiramatsu
access non-exist text area to disable or remove it. Fixes: 970988e19eb0 ("tracing/kprobe: Add kprobe_event= boot parameter") Cc: sta...@vger.kernel.org Signed-off-by: Masami Hiramatsu --- Changes in v2: - Fix kprobe_free_init_mem() not depending on CONFIG_DEBUG_FS. --- include/linux

[PATCH v3 0/8] tracing/boot: Add new options for tracing specific period

2020-09-10 Thread Masami Hiramatsu
__raw_spin_lock_init(); 0) 7.575 us|} 0) |proc_register() { 0) | _raw_spin_lock_irqsave() { 0) 0.187 us|preempt_count_add(); ... Thank you, --- Masami Hiramatsu (8): kprobes: tracing/kprobes: Fix to kill kpr

Re: [PATCH v2 4/6] tracing/kprobes: Support perf-style return probe

2020-09-09 Thread Masami Hiramatsu
On Tue, 1 Sep 2020 16:57:10 +0900 Masami Hiramatsu wrote: > Support perf-style return probe ("SYMBOL%return") in kprobe events. > This will allow boot-time tracing user to define a return probe event. > Hmm, I think I should add this for uprobe event too. I'll update the

Re: kernel BUG at /usr/src/kernel/lib/dynamic_debug.c:267!

2020-09-08 Thread Masami Hiramatsu
5829] DR0: DR1: 0000 DR2: > > [ 634.592964] DR3: DR6: fffe0ff0 DR7: > 0400 > > full test log, > https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20200908/testrun/3171064/suite/linux-log-parser/test/check-kernel-bug-1743477/log > > -- > Linaro LKFT > https://lkft.linaro.org -- Masami Hiramatsu

Re: [PATCH v5 00/21] kprobes: Unify kretprobe trampoline handlers and make kretprobe lockless

2020-09-08 Thread Masami Hiramatsu
On Wed, 9 Sep 2020 00:09:23 +0900 Masami Hiramatsu wrote: > > > Of course make it lockless then warning is gone. > > > But even without the lockless patch, this warning can be false-positive > > > because we prohibit nested kprobe call, right? > > > > Yes

Re: [PATCH v5 00/21] kprobes: Unify kretprobe trampoline handlers and make kretprobe lockless

2020-09-08 Thread Masami Hiramatsu
On Tue, 8 Sep 2020 12:37:36 +0200 pet...@infradead.org wrote: > On Thu, Sep 03, 2020 at 10:39:54AM +0900, Masami Hiramatsu wrote: > > > > There's a bug, that might make it miss it. I have a patch. I'll send it > > > shortly. > > > > OK, I've confirmed that

Re: [PATCH v5 00/21] kprobes: Unify kretprobe trampoline handlers and make kretprobe lockless

2020-09-07 Thread Masami Hiramatsu
On Mon, 07 Sep 2020 13:44:19 -0400 f...@redhat.com (Frank Ch. Eigler) wrote: > Masami Hiramatsu writes: > > > Sorry, for noticing this point, I Cc'd to systemtap. Is systemtap taking > > care of spinlock too? > > On PRREMPT_RT configurations, systemtap uses the raw_spin

Re: [PATCH v2 08/11] kprobes: switch to kernel_clone()

2020-09-06 Thread Masami Hiramatsu
Hi, On Wed, 19 Aug 2020 12:46:52 +0200 Christian Brauner wrote: > The old _do_fork() helper is removed in favor of the new kernel_clone() > helper. > The latter adheres to naming conventions for kernel internal syscall helpers. This looks good to me. Acked-by: Masami Hiramatsu

Re: [PATCH v2 10/11] tracing: switch to kernel_clone()

2020-09-04 Thread Masami Hiramatsu
On Wed, 19 Aug 2020 12:46:54 +0200 Christian Brauner wrote: > The old _do_fork() helper is removed in favor of the new kernel_clone() > helper. > The latter adheres to naming conventions for kernel internal syscall helpers. > This looks good to me. Acked-by: Masami Hiramatsu

Re: [PATCH] lockdep: Fix "USED" <- "IN-NMI" inversions

2020-09-02 Thread Masami Hiramatsu
ll not > set any of the interrupt bits and will thus never match. > > In order to properly fix the situation and allow rcu_read_lock() to > correctly work, split LOCK_USED into LOCK_USED and LOCK_USED_READ and by > having .read users set USED_READ and test USED, pure read-recursive &

Re: [PATCH v5 00/21] kprobes: Unify kretprobe trampoline handlers and make kretprobe lockless

2020-09-02 Thread Masami Hiramatsu
On Thu, 3 Sep 2020 10:39:54 +0900 Masami Hiramatsu wrote: > OK, I've confirmed that the lockdep warns on kretprobe from INT3 > with your fix. Of course make it lockless then warning is gone. > But even without the lockless patch, this warning can be false-positive > because we pro

Re: [PATCH v5 00/21] kprobes: Unify kretprobe trampoline handlers and make kretprobe lockless

2020-09-02 Thread Masami Hiramatsu
On Wed, 2 Sep 2020 15:42:52 +0200 pet...@infradead.org wrote: > On Wed, Sep 02, 2020 at 10:19:26PM +0900, Masami Hiramatsu wrote: > > On Wed, 2 Sep 2020 11:36:13 +0200 > > pet...@infradead.org wrote: > > > > > On Wed, Sep 02, 2020 at 05:17:55PM +0900, Masami Hirama

Re: [PATCH v5 00/21] kprobes: Unify kretprobe trampoline handlers and make kretprobe lockless

2020-09-02 Thread Masami Hiramatsu
On Wed, 2 Sep 2020 11:36:13 +0200 pet...@infradead.org wrote: > On Wed, Sep 02, 2020 at 05:17:55PM +0900, Masami Hiramatsu wrote: > > > > Ok, but then lockdep will yell at you if you have that enabled and run > > > the unoptimized things. > > > > Oh,

Re: [PATCH v7 08/18] static_call: Avoid kprobes on inline static_call()s

2020-09-02 Thread Masami Hiramatsu
On Wed, 2 Sep 2020 11:48:20 +0200 pet...@infradead.org wrote: > On Wed, Sep 02, 2020 at 10:35:08AM +0900, Masami Hiramatsu wrote: > > On Tue, 18 Aug 2020 15:57:43 +0200 > > Peter Zijlstra wrote: > > > > > Similar to how we disallow kprobes on any other dynamic

Re: [PATCH v5 00/21] kprobes: Unify kretprobe trampoline handlers and make kretprobe lockless

2020-09-02 Thread Masami Hiramatsu
On Wed, 2 Sep 2020 09:02:26 +0200 pet...@infradead.org wrote: > On Wed, Sep 02, 2020 at 09:37:39AM +0900, Masami Hiramatsu wrote: > > On Tue, 1 Sep 2020 21:08:08 +0200 > > Peter Zijlstra wrote: > > > > > On Sat, Aug 29, 2020 at 09:59:49PM +0900, Masami Hiramatsu w

Re: [PATCH v2] kprobes: Fix kill kprobe which has been marked as gone

2020-09-01 Thread Masami Hiramatsu
ned-off-by: Muchun Song > > Co-developed-by: Chengming Zhou > > Signed-off-by: Chengming Zhou > > Acked-by: Masami Hiramatsu > > --- > > changelogs in v2: > > 1. Add a WARN_ON_ONCE in the kill_kprobe() to catch incorrect use of it. > > 2. Update 'F

Re: [PATCH v7 08/18] static_call: Avoid kprobes on inline static_call()s

2020-09-01 Thread Masami Hiramatsu
On Tue, 18 Aug 2020 15:57:43 +0200 Peter Zijlstra wrote: > Similar to how we disallow kprobes on any other dynamic text > (ftrace/jump_label) also disallow kprobes on inline static_call()s. Looks good to me. Acked-by: Masami Hiramatsu BTW, here we already have 5 subsystems which re

Re: [PATCH v5 00/21] kprobes: Unify kretprobe trampoline handlers and make kretprobe lockless

2020-09-01 Thread Masami Hiramatsu
On Tue, 1 Sep 2020 21:08:08 +0200 Peter Zijlstra wrote: > On Sat, Aug 29, 2020 at 09:59:49PM +0900, Masami Hiramatsu wrote: > > Masami Hiramatsu (16): > > kprobes: Add generic kretprobe trampoline handler > > x86/kprobes: Use generic kretprobe trampoline

[PATCH v2 4/6] tracing/kprobes: Support perf-style return probe

2020-09-01 Thread Masami Hiramatsu
Support perf-style return probe ("SYMBOL%return") in kprobe events. This will allow boot-time tracing user to define a return probe event. Signed-off-by: Masami Hiramatsu --- kernel/trace/trace_kprobe.c | 21 - 1 file changed, 20 insertions(+), 1 deletion(-)

[PATCH v2 6/6] Documentation: tracing: boot: Add an example of tracing function-calls

2020-09-01 Thread Masami Hiramatsu
Add an example of tracing function calls on a specific function. Signed-off-by: Masami Hiramatsu --- Documentation/trace/boottime-trace.rst | 20 1 file changed, 20 insertions(+) diff --git a/Documentation/trace/boottime-trace.rst b/Documentation/trace/boottime

[PATCH v2 2/6] tracing/boot: Add per-instance tracing_on option support

2020-09-01 Thread Masami Hiramatsu
Add per-instance tracing_on option, which will be useful with traceon/traceoff event trigger actions. For example, if we disable tracing_on by default and set traceon and traceoff on a pair of events, we can trace functions between the pair of events. Signed-off-by: Masami Hiramatsu --- kernel

[PATCH v2 5/6] Documentation: tracing: Add %return suffix description

2020-09-01 Thread Masami Hiramatsu
Add a description of the %return suffix option for kprobe tracer. Signed-off-by: Masami Hiramatsu --- Changes in v2 - Use a tab for indentation as other lines do. --- Documentation/trace/kprobetrace.rst |2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/trace

[PATCH v2 3/6] Documentation: tracing: Add tracing_on option to boot-time tracer

2020-09-01 Thread Masami Hiramatsu
Add tracing_on option description to the boot-time tracer. Signed-off-by: Masami Hiramatsu --- Documentation/trace/boottime-trace.rst |4 1 file changed, 4 insertions(+) diff --git a/Documentation/trace/boottime-trace.rst b/Documentation/trace/boottime-trace.rst index dcb390075ca1

[PATCH v2 1/6] kprobes: tracing/kprobes: Fix to kill kprobes on initmem after boot

2020-09-01 Thread Masami Hiramatsu
access non-exist text area to disable or remove it. Fixes: 970988e19eb0 ("tracing/kprobe: Add kprobe_event= boot parameter") Cc: sta...@vger.kernel.org Signed-off-by: Masami Hiramatsu --- Changes in v2: - Fix kprobe_free_init_mem() not depending on CONFIG_DEBUG_FS. --- include/linux

[PATCH v2 0/6] tracing/boot: Add new options for tracing specific period

2020-09-01 Thread Masami Hiramatsu
|proc_register() { 0) | _raw_spin_lock_irqsave() { 0) 0.187 us|preempt_count_add(); ... Thank you, --- Masami Hiramatsu (6): kprobes: tracing/kprobes: Fix to kill kprobes on initmem after boot tracing/boot: Add per-instance tracing_on option s

Re: [PATCH 1/6] kprobes: tracing/kprobes: Fix to kill kprobes on initmem after boot

2020-09-01 Thread Masami Hiramatsu
If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch] > > url: > https://github.com/0day-ci/linux/commits/Masami-Hiramatsu/tracing-boot-Add-new-optio

Re: [PATCH 5/6] Documentation: tracing: Add %return suffix description

2020-08-31 Thread Masami Hiramatsu
On Tue, 1 Sep 2020 07:27:45 +0900 Masami Hiramatsu wrote: > On Mon, 31 Aug 2020 11:50:20 -0700 > Randy Dunlap wrote: > > > On 8/31/20 5:46 AM, Masami Hiramatsu wrote: > > > Add a description of the %return suffix option for kprobe tracer. > > > >

Re: [PATCH 5/6] Documentation: tracing: Add %return suffix description

2020-08-31 Thread Masami Hiramatsu
On Mon, 31 Aug 2020 11:50:20 -0700 Randy Dunlap wrote: > On 8/31/20 5:46 AM, Masami Hiramatsu wrote: > > Add a description of the %return suffix option for kprobe tracer. > > > > Signed-off-by: Masami Hiramatsu > > --- > > Documentation/trace/kprobetrace.rst

Re: [External] [BUGFIX PATCH] kprobes: Fix to check probe enabled before disarm_kprobe_ftrace()

2020-08-31 Thread Masami Hiramatsu
Hi Muchun, On Mon, 31 Aug 2020 23:47:14 +0800 Muchun Song wrote: > On Mon, Aug 31, 2020 at 11:12 PM Masami Hiramatsu wrote: > > > > Commit 0cb2f1372baa ("kprobes: Fix NULL pointer dereference at > > kprobe_ftrace_handler") fixed one bug but not comp

[BUGFIX PATCH] kprobes: Fix to check probe enabled before disarm_kprobe_ftrace()

2020-08-31 Thread Masami Hiramatsu
the given probe point is not registered to ftrace. Fix to check the given (going) probe is enabled before invoking disarm_kprobe_ftrace(). Fixes: 0cb2f1372baa ("kprobes: Fix NULL pointer dereference at kprobe_ftrace_handler") Cc: sta...@vger.kernel.org Signed-off-by: Masami Hiramat

[PATCH 1/6] kprobes: tracing/kprobes: Fix to kill kprobes on initmem after boot

2020-08-31 Thread Masami Hiramatsu
access non-exist text area to disable or remove it. Fixes: 970988e19eb0 ("tracing/kprobe: Add kprobe_event= boot parameter") Cc: sta...@vger.kernel.org Signed-off-by: Masami Hiramatsu --- include/linux/kprobes.h |5 + init/main.c |2 ++ kernel/kprobes.c

[PATCH 5/6] Documentation: tracing: Add %return suffix description

2020-08-31 Thread Masami Hiramatsu
Add a description of the %return suffix option for kprobe tracer. Signed-off-by: Masami Hiramatsu --- Documentation/trace/kprobetrace.rst |2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/trace/kprobetrace.rst b/Documentation/trace/kprobetrace.rst index c1709165c553

[PATCH 3/6] Documentation: tracing: Add tracing_on option to boot-time tracer

2020-08-31 Thread Masami Hiramatsu
Add tracing_on option description to the boot-time tracer. Signed-off-by: Masami Hiramatsu --- Documentation/trace/boottime-trace.rst |4 1 file changed, 4 insertions(+) diff --git a/Documentation/trace/boottime-trace.rst b/Documentation/trace/boottime-trace.rst index dcb390075ca1

[PATCH 6/6] Documentation: tracing: boot: Add an example of tracing function-calls

2020-08-31 Thread Masami Hiramatsu
Add an example of tracing function calls on a specific function. Signed-off-by: Masami Hiramatsu --- Documentation/trace/boottime-trace.rst | 20 1 file changed, 20 insertions(+) diff --git a/Documentation/trace/boottime-trace.rst b/Documentation/trace/boottime

[PATCH 2/6] tracing/boot: Add per-instance tracing_on option support

2020-08-31 Thread Masami Hiramatsu
Add per-instance tracing_on option, which will be useful with traceon/traceoff event trigger actions. For example, if we disable tracing_on by default and set traceon and traceoff on a pair of events, we can trace functions between the pair of events. Signed-off-by: Masami Hiramatsu --- kernel

[PATCH 4/6] tracing/kprobes: Support perf-style return probe

2020-08-31 Thread Masami Hiramatsu
Support perf-style return probe ("SYMBOL%return") in kprobe events. This will allow boot-time tracing user to define a return probe event. Signed-off-by: Masami Hiramatsu --- kernel/trace/trace_kprobe.c | 21 - 1 file changed, 20 insertions(+), 1 deletion(-)

[PATCH 0/6] tracing/boot: Add new options for tracing specific period

2020-08-31 Thread Masami Hiramatsu
.054 us|} 0) 3.407 us| } 0) 0.168 us| __raw_spin_lock_init(); 0) 7.575 us|} 0) |proc_register() { 0) | _raw_spin_lock_irqsave() { 0) 0.187 us|preempt_count_add(); ... Thank you,

[PATCH v5 06/21] csky: kprobes: Use generic kretprobe trampoline handler

2020-08-29 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu Acked-by: Guo Ren --- arch/csky/kernel/probes/kprobes.c | 77 + 1 file changed, 2 insertions(+), 75 deletions(-) diff --git a/arch/csky/kernel/probes/kprobes.c b/arch/csky/kernel/probes/kprobes.c index f0f733b7ac5a

[PATCH v5 07/21] ia64: kprobes: Use generic kretprobe trampoline handler

2020-08-29 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- arch/ia64/kernel/kprobes.c | 77 +--- 1 file changed, 2 insertions(+), 75 deletions(-) diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c index 7a7df944d798..fc1ff8a4d7de 100644 --- a/arch/ia64

[PATCH v5 08/21] mips: kprobes: Use generic kretprobe trampoline handler

2020-08-29 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- arch/mips/kernel/kprobes.c | 54 ++-- 1 file changed, 3 insertions(+), 51 deletions(-) diff --git a/arch/mips/kernel/kprobes.c b/arch/mips/kernel/kprobes.c index d043c2f897fc..54dfba8fa77c 100644 --- a/arch/mips

[PATCH v5 09/21] parisc: kprobes: Use generic kretprobe trampoline handler

2020-08-29 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- arch/parisc/kernel/kprobes.c | 76 ++ 1 file changed, 4 insertions(+), 72 deletions(-) diff --git a/arch/parisc/kernel/kprobes.c b/arch/parisc/kernel/kprobes.c index 77ec51818916..6d21a515eea5 100644 --- a/arch/parisc

[PATCH v5 10/21] powerpc: kprobes: Use generic kretprobe trampoline handler

2020-08-29 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- Changes in v2: Fix to use correct trampoline_address. --- arch/powerpc/kernel/kprobes.c | 53 ++--- 1 file changed, 3 insertions(+), 50 deletions(-) diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel

[PATCH v5 16/21] kprobes: Make local used functions static

2020-08-29 Thread Masami Hiramatsu
Since we unified the kretprobe trampoline handler from arch/* code, some functions and objects no need to be exported anymore. Signed-off-by: Masami Hiramatsu --- Changes in v4: - Convert kretprobe_assert() into a BUG_ON(). --- include/linux/kprobes.h | 15 --- kernel

[PATCH v5 18/21] kprobes: Remove kretprobe hash

2020-08-29 Thread Masami Hiramatsu
use get_kretprobe(ri) instead. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Masami Hiramatsu --- Changes in v5: - Fix not to flush current task's kretprobe_instance - Remove task scan by merging kretprobe_holder patch - Use READ_ONCE() and rcu_locked check instead of smp_r/

[PATCH v5 19/21] asm-generic/atomic: Add try_cmpxchg() fallbacks

2020-08-29 Thread Masami Hiramatsu
From: Peter Zijlstra Only x86 provides try_cmpxchg() outside of the atomic_t interfaces, provide generic fallbacks to create this interface from the widely available cmpxchg() function. Signed-off-by: Peter Zijlstra (Intel) Acked-by: Will Deacon --- arch/x86/include/asm/atomic.h

[PATCH v5 20/21] freelist: Lock less freelist

2020-08-29 Thread Masami Hiramatsu
From: Peter Zijlstra Cc: came...@moodycamel.com Cc: o...@redhat.com Cc: w...@kernel.org Signed-off-by: Peter Zijlstra (Intel) --- include/linux/freelist.h | 129 ++ 1 file changed, 129 insertions(+) create mode 100644 include/linux/freelist.h diff

[PATCH v5 21/21] kprobes: Replace rp->free_instance with freelist

2020-08-29 Thread Masami Hiramatsu
From: Peter Zijlstra Gets rid of rp->lock, and as a result kretprobes are now fully lockless. Signed-off-by: Peter Zijlstra (Intel) --- Changes - [MH] expel the llist from anon union in kretprobe_instance --- include/linux/kprobes.h |8 +++ kernel/kprobes.c| 56

[PATCH v5 17/21] llist: Add nonatomic __llist_add() and __llist_dell_all()

2020-08-29 Thread Masami Hiramatsu
From: Peter Zijlstra Signed-off-by: Peter Zijlstra (Intel) --- drivers/gpu/drm/i915/i915_request.c |6 -- include/linux/llist.h | 23 +++ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_request.c

[PATCH v5 15/21] kprobes: Free kretprobe_instance with rcu callback

2020-08-29 Thread Masami Hiramatsu
Free kretprobe_instance with rcu callback instead of directly freeing the object in the kretprobe handler context. This will make kretprobe run safer in NMI context. Signed-off-by: Masami Hiramatsu --- Changes in v3: - Stick the rcu_head with hlist_node in kretprobe_instance - Make

[PATCH v5 12/21] sh: kprobes: Use generic kretprobe trampoline handler

2020-08-29 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- arch/sh/kernel/kprobes.c | 58 ++ 1 file changed, 3 insertions(+), 55 deletions(-) diff --git a/arch/sh/kernel/kprobes.c b/arch/sh/kernel/kprobes.c index 318296f48f1a..756100b01e84 100644 --- a/arch/sh/kernel

[PATCH v5 04/21] arm64: kprobes: Use generic kretprobe trampoline handler

2020-08-29 Thread Masami Hiramatsu
Use the generic kretprobe trampoline handler, and use the kernel_stack_pointer(regs) for framepointer verification. Signed-off-by: Masami Hiramatsu --- arch/arm64/kernel/probes/kprobes.c | 78 +--- 1 file changed, 3 insertions(+), 75 deletions(-) diff --git

[PATCH v5 13/21] sparc: kprobes: Use generic kretprobe trampoline handler

2020-08-29 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- arch/sparc/kernel/kprobes.c | 51 +++ 1 file changed, 3 insertions(+), 48 deletions(-) diff --git a/arch/sparc/kernel/kprobes.c b/arch/sparc/kernel/kprobes.c index dfbca2470536..217c21a6986a 100644 --- a/arch/sparc

[PATCH v5 14/21] kprobes: Remove NMI context check

2020-08-29 Thread Masami Hiramatsu
ndent code. Signed-off-by: Masami Hiramatsu --- kernel/kprobes.c | 16 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/kernel/kprobes.c b/kernel/kprobes.c index a0afaa79024e..211138225fa5 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -1359,7 +1359,8 @@ s

[PATCH v5 11/21] s390: kprobes: Use generic kretprobe trampoline handler

2020-08-29 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- arch/s390/kernel/kprobes.c | 79 +--- 1 file changed, 2 insertions(+), 77 deletions(-) diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c index d2a71d872638..fc30e799bd84 100644 --- a/arch/s390

[PATCH v5 05/21] arc: kprobes: Use generic kretprobe trampoline handler

2020-08-29 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- arch/arc/kernel/kprobes.c | 54 ++--- 1 file changed, 2 insertions(+), 52 deletions(-) diff --git a/arch/arc/kernel/kprobes.c b/arch/arc/kernel/kprobes.c index 7d3efe83cba7..cabef45f11df 100644 --- a/arch/arc/kernel

[PATCH v5 03/21] arm: kprobes: Use generic kretprobe trampoline handler

2020-08-29 Thread Masami Hiramatsu
Use the generic kretprobe trampoline handler. Use regs->ARM_fp for framepointer verification. Signed-off-by: Masami Hiramatsu --- Changes in v2: - Fix to cast frame_pointer type to void *. --- arch/arm/probes/kprobes/core.c | 78 ++-- 1 file changed

[PATCH v5 02/21] x86/kprobes: Use generic kretprobe trampoline handler

2020-08-29 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- arch/x86/kernel/kprobes/core.c | 108 +--- 1 file changed, 3 insertions(+), 105 deletions(-) diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c index fdadc37d72af..882b95313ad6 100644 --- a/arch

[PATCH v5 01/21] kprobes: Add generic kretprobe trampoline handler

2020-08-29 Thread Masami Hiramatsu
address fixup for user handlers. Signed-off-by: Masami Hiramatsu --- Changes in v5: - Restore actual current_kprobe instead of kprobe_busy. Changes in v4: - Remove orig_ret_address - Change the type of trampoline_address to void * --- include/linux/kprobes.h | 32 +-- kernel

[PATCH v5 00/21] kprobes: Unify kretprobe trampoline handlers and make kretprobe lockless

2020-08-29 Thread Masami Hiramatsu
for x86-64, i386, arm, arm64, and mips. Thank you, --- Masami Hiramatsu (16): kprobes: Add generic kretprobe trampoline handler x86/kprobes: Use generic kretprobe trampoline handler arm: kprobes: Use generic kretprobe trampoline handler arm64: kprobes: Use generic kretprobe

Re: [PATCH v3 06/16] csky: kprobes: Use generic kretprobe trampoline handler

2020-08-29 Thread Masami Hiramatsu
On Fri, 28 Aug 2020 20:34:22 +0800 Guo Ren wrote: > Looks more clear. > > Acked-by: Guo Ren Thanks Guo! I'll add it to the next version. > > On Fri, Aug 28, 2020 at 12:39 AM Masami Hiramatsu wrote: > > > > Signed-off-by: Masami Hiramatsu > > --- >

Re: [RFC][PATCH 7/7] kprobes: Replace rp->free_instance with freelist

2020-08-29 Thread Masami Hiramatsu
ter the node is taken off the freelist. Thanks for the check, but I personally would like to keep it separated because the memory layouts of those in-kernel list-like data structures can be changed by debug config option... Thank you, -- Masami Hiramatsu

Re: [PATCH v4 18/23] sched: Fix try_invoke_on_locked_down_task() semantics

2020-08-28 Thread Masami Hiramatsu
On Fri, 28 Aug 2020 21:29:55 +0900 Masami Hiramatsu wrote: > From: Peter Zijlstra In the next version I will drop this since I will merge the kretprobe_holder things into removing kretporbe hash patch. However, this patch itself seems fixing a bug of commit 2beaf3280e57 ("sched/c

Re: [PATCH v4 19/23] kprobes: Remove kretprobe hash

2020-08-28 Thread Masami Hiramatsu
On Fri, 28 Aug 2020 22:29:12 +0200 Peter Zijlstra wrote: > On Fri, Aug 28, 2020 at 07:32:11PM +, eddy...@trendmicro.com wrote: > > > > > -Original Message- > > > From: Masami Hiramatsu > > > > > > @@ -1311,24 +1257,23 @@ void kprobe

Re: [PATCH v4 19/23] kprobes: Remove kretprobe hash

2020-08-28 Thread Masami Hiramatsu
On Fri, 28 Aug 2020 21:30:06 +0900 Masami Hiramatsu wrote: > From: Peter Zijlstra > > The kretprobe hash is mostly superfluous, replace it with a per-task > variable. > > This gets rid of the task hash and it's related locking. > > The whole invalidate_rp_inst() is t

Re: [PATCH v4 20/23] [RFC] kprobes: Remove task scan for updating kretprobe_instance

2020-08-28 Thread Masami Hiramatsu
On Fri, 28 Aug 2020 17:18:06 +0200 pet...@infradead.org wrote: > On Sat, Aug 29, 2020 at 12:10:10AM +0900, Masami Hiramatsu wrote: > > On Fri, 28 Aug 2020 14:52:36 +0200 > > pet...@infradead.org wrote: > > > > > synchronize_rcu(); > > > > >

Re: [PATCH v4 20/23] [RFC] kprobes: Remove task scan for updating kretprobe_instance

2020-08-28 Thread Masami Hiramatsu
8, 2020 at 09:30:17PM +0900, Masami Hiramatsu wrote: > > > > +static nokprobe_inline struct kretprobe *get_kretprobe(struct > > kretprobe_instance *ri) > > +{ > > + /* rph->rp can be updated by unregister_kretprobe() on other cpu */ > > + smp_rmb(); &

Re: [RFC][PATCH 3/7] kprobes: Remove kretprobe hash

2020-08-28 Thread Masami Hiramatsu
c91cbd58 R15: 88807c4e4000 [ 335.337956] FS: () GS:88807d7c() knlGS: [ 335.338917] CS: 0010 DS: ES: CR0: 80050033 [ 335.339618] CR2: 005c0a56 CR3: 0222 CR4: 06a0 [ 335.340373] Kernel panic - not syncing: Fatal exception [ 335.341086] Kernel Offset: disabled [ 335.341587] ---[ end Kernel panic - not syncing: Fatal exception ]--- -- Masami Hiramatsu

Re: [RFC][PATCH 3/7] kprobes: Remove kretprobe hash

2020-08-28 Thread Masami Hiramatsu
On Fri, 28 Aug 2020 16:19:17 +0200 pet...@infradead.org wrote: > On Fri, Aug 28, 2020 at 02:11:18PM +, eddy...@trendmicro.com wrote: > > > From: Masami Hiramatsu > > > > > > OK, schedule function will be the key. I guess the senario is.. > > > > &

Re: [RFC][PATCH 3/7] kprobes: Remove kretprobe hash

2020-08-28 Thread Masami Hiramatsu
On Fri, 28 Aug 2020 15:58:24 +0200 pet...@infradead.org wrote: > On Fri, Aug 28, 2020 at 10:51:13PM +0900, Masami Hiramatsu wrote: > > > OK, schedule function will be the key. I guess the senario is.. > > > > 1) kretporbe replace the return address with kretprobe_tr

Re: [PATCH v4 04/23] arm64: kprobes: Use generic kretprobe trampoline handler

2020-08-28 Thread Masami Hiramatsu
On Fri, 28 Aug 2020 15:37:18 +0200 pet...@infradead.org wrote: > On Fri, Aug 28, 2020 at 02:31:31PM +0100, Mark Rutland wrote: > > Hi, > > > > On Fri, Aug 28, 2020 at 09:27:22PM +0900, Masami Hiramatsu wrote: > > > Use the generic kretpro

Re: [RFC][PATCH 3/7] kprobes: Remove kretprobe hash

2020-08-28 Thread Masami Hiramatsu
confidential > and may be subject to copyright or other intellectual property protection. If > you are not the intended recipient, you are not authorized to use or disclose > this information, and we request that you notify us by reply mail or > telephone and delete the original message from your mail system. > > For details about what personal information we collect and why, please see > our Privacy Notice on our website at: Read privacy > policy<http://www.trendmicro.com/privacy> -- Masami Hiramatsu

Re: [PATCH v4 00/23] kprobes: Unify kretprobe trampoline handlers and make kretprobe lockless

2020-08-28 Thread Masami Hiramatsu
On Fri, 28 Aug 2020 21:26:38 +0900 Masami Hiramatsu wrote: > Hi, > > Here is the 4th version of the series to unify the kretprobe trampoline > handler > and make kretprobe lockless. > > Previous version is here; > > > https://lkml.kernel.org/r/159854631442.73

[PATCH v4 20/23] [RFC] kprobes: Remove task scan for updating kretprobe_instance

2020-08-28 Thread Masami Hiramatsu
ave to update the kretprobe handler to use get_kretprobe(ri) for accessing kretprobe data structure instead of ri->rp. Also, now we remove ri->task. Signed-off-by: Masami Hiramatsu --- include/linux/kprobes.h | 17 ++ kernel/kprobes.c

[PATCH v4 11/23] s390: kprobes: Use generic kretprobe trampoline handler

2020-08-28 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- arch/s390/kernel/kprobes.c | 79 +--- 1 file changed, 2 insertions(+), 77 deletions(-) diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c index d2a71d872638..fc30e799bd84 100644 --- a/arch/s390

[PATCH v4 19/23] kprobes: Remove kretprobe hash

2020-08-28 Thread Masami Hiramatsu
From: Peter Zijlstra The kretprobe hash is mostly superfluous, replace it with a per-task variable. This gets rid of the task hash and it's related locking. The whole invalidate_rp_inst() is tedious and could go away once we drop rp specific ri size. Signed-off-by: Peter Zijlstra (Intel) ---

[PATCH v4 18/23] sched: Fix try_invoke_on_locked_down_task() semantics

2020-08-28 Thread Masami Hiramatsu
From: Peter Zijlstra Signed-off-by: Peter Zijlstra (Intel) --- kernel/sched/core.c |9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 2d95dc3f4644..13b0db2d0be2 100644 --- a/kernel/sched/core.c +++

[PATCH v4 21/23] asm-generic/atomic: Add try_cmpxchg() fallbacks

2020-08-28 Thread Masami Hiramatsu
From: Peter Zijlstra Only x86 provides try_cmpxchg() outside of the atomic_t interfaces, provide generic fallbacks to create this interface from the widely available cmpxchg() function. Signed-off-by: Peter Zijlstra (Intel) Acked-by: Will Deacon --- arch/x86/include/asm/atomic.h

[PATCH v4 22/23] freelist: Lock less freelist

2020-08-28 Thread Masami Hiramatsu
From: Peter Zijlstra Cc: came...@moodycamel.com Cc: o...@redhat.com Cc: w...@kernel.org Signed-off-by: Peter Zijlstra (Intel) --- include/linux/freelist.h | 129 ++ 1 file changed, 129 insertions(+) create mode 100644 include/linux/freelist.h diff

[PATCH v4 23/23] kprobes: Replace rp->free_instance with freelist

2020-08-28 Thread Masami Hiramatsu
From: Peter Zijlstra Gets rid of rp->lock, and as a result kretprobes are now fully lockless. Signed-off-by: Peter Zijlstra (Intel) --- Changes - [MH] expel the llist from anon union in kretprobe_instance --- include/linux/kprobes.h |8 +++ kernel/kprobes.c| 56

[PATCH v4 13/23] sparc: kprobes: Use generic kretprobe trampoline handler

2020-08-28 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- arch/sparc/kernel/kprobes.c | 51 +++ 1 file changed, 3 insertions(+), 48 deletions(-) diff --git a/arch/sparc/kernel/kprobes.c b/arch/sparc/kernel/kprobes.c index dfbca2470536..217c21a6986a 100644 --- a/arch/sparc

[PATCH v4 14/23] kprobes: Remove NMI context check

2020-08-28 Thread Masami Hiramatsu
ndent code. Signed-off-by: Masami Hiramatsu --- kernel/kprobes.c | 16 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 46510e5000ff..c8de76d230e3 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -1359,7 +1359,8 @@ s

[PATCH v4 15/23] kprobes: Free kretprobe_instance with rcu callback

2020-08-28 Thread Masami Hiramatsu
Free kretprobe_instance with rcu callback instead of directly freeing the object in the kretprobe handler context. This will make kretprobe run safer in NMI context. Signed-off-by: Masami Hiramatsu --- Changes in v3: - Stick the rcu_head with hlist_node in kretprobe_instance - Make

[PATCH v4 17/23] llist: Add nonatomic __llist_add()

2020-08-28 Thread Masami Hiramatsu
From: Peter Zijlstra Signed-off-by: Peter Zijlstra (Intel) --- drivers/gpu/drm/i915/i915_request.c |6 -- include/linux/llist.h | 15 +++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_request.c

[PATCH v4 16/23] kprobes: Make local used functions static

2020-08-28 Thread Masami Hiramatsu
Since we unified the kretprobe trampoline handler from arch/* code, some functions and objects no need to be exported anymore. Signed-off-by: Masami Hiramatsu --- Changes in v4: - Convert kretprobe_assert() into a BUG_ON(). --- include/linux/kprobes.h | 15 --- kernel

[PATCH v4 12/23] sh: kprobes: Use generic kretprobe trampoline handler

2020-08-28 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- arch/sh/kernel/kprobes.c | 58 ++ 1 file changed, 3 insertions(+), 55 deletions(-) diff --git a/arch/sh/kernel/kprobes.c b/arch/sh/kernel/kprobes.c index 318296f48f1a..756100b01e84 100644 --- a/arch/sh/kernel

[PATCH v4 10/23] powerpc: kprobes: Use generic kretprobe trampoline handler

2020-08-28 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- Changes in v2: Fix to use correct trampoline_address. --- arch/powerpc/kernel/kprobes.c | 53 ++--- 1 file changed, 3 insertions(+), 50 deletions(-) diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel

[PATCH v4 08/23] mips: kprobes: Use generic kretprobe trampoline handler

2020-08-28 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- arch/mips/kernel/kprobes.c | 54 ++-- 1 file changed, 3 insertions(+), 51 deletions(-) diff --git a/arch/mips/kernel/kprobes.c b/arch/mips/kernel/kprobes.c index d043c2f897fc..54dfba8fa77c 100644 --- a/arch/mips

[PATCH v4 09/23] parisc: kprobes: Use generic kretprobe trampoline handler

2020-08-28 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- arch/parisc/kernel/kprobes.c | 76 ++ 1 file changed, 4 insertions(+), 72 deletions(-) diff --git a/arch/parisc/kernel/kprobes.c b/arch/parisc/kernel/kprobes.c index 77ec51818916..6d21a515eea5 100644 --- a/arch/parisc

[PATCH v4 07/23] ia64: kprobes: Use generic kretprobe trampoline handler

2020-08-28 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- arch/ia64/kernel/kprobes.c | 77 +--- 1 file changed, 2 insertions(+), 75 deletions(-) diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c index 7a7df944d798..fc1ff8a4d7de 100644 --- a/arch/ia64

[PATCH v4 06/23] csky: kprobes: Use generic kretprobe trampoline handler

2020-08-28 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- arch/csky/kernel/probes/kprobes.c | 77 + 1 file changed, 2 insertions(+), 75 deletions(-) diff --git a/arch/csky/kernel/probes/kprobes.c b/arch/csky/kernel/probes/kprobes.c index f0f733b7ac5a..589f090f48b9 100644

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