Re: [RFC PATCH 03/14] arm: kprobes: Use generic kretprobe trampoline handler

2020-08-26 Thread Masami Hiramatsu
On Wed, 26 Aug 2020 16:10:25 +0200 pet...@infradead.org wrote: > On Wed, Aug 26, 2020 at 04:08:52PM +0200, pet...@infradead.org wrote: > > On Wed, Aug 26, 2020 at 10:46:43PM +0900, Masami Hiramatsu wrote: > > > static __used __kprobes void *trampoline_handler(st

Re: x86/kprobes: kretprobe fails to triggered if kprobe at function entry is not optimized (trigger by int3 breakpoint)

2020-08-26 Thread Masami Hiramatsu
On Wed, 26 Aug 2020 13:36:15 + "eddy...@trendmicro.com" wrote: > > > > -Original Message- > > From: pet...@infradead.org > > Sent: Wednesday, August 26, 2020 6:26 PM > > To: Masami Hiramatsu > > Cc: Eddy Wu (RD-TW) ; linux-kernel@vge

[RFC PATCH 12/14] sh: kprobes: Use generic kretprobe trampoline handler

2020-08-26 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- arch/sh/kernel/kprobes.c | 59 +++--- 1 file changed, 4 insertions(+), 55 deletions(-) diff --git a/arch/sh/kernel/kprobes.c b/arch/sh/kernel/kprobes.c index 318296f48f1a..118927ab63af 100644 --- a/arch/sh/kernel

[RFC PATCH 11/14] s390: kprobes: Use generic kretprobe trampoline handler

2020-08-26 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- arch/s390/kernel/kprobes.c | 81 ++-- 1 file changed, 4 insertions(+), 77 deletions(-) diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c index d2a71d872638..6009f08836f4 100644 --- a/arch/s390

[RFC PATCH 08/14] mips: kprobes: Use generic kretprobe trampoline handler

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

[RFC PATCH 09/14] parisc: kprobes: Use generic kretprobe trampoline handler

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

[RFC PATCH 10/14] powerpc: kprobes: Use generic kretprobe trampoline handler

2020-08-26 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- arch/powerpc/kernel/kprobes.c | 55 - 1 file changed, 5 insertions(+), 50 deletions(-) diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index 6ab9b4d037c3..ad4208e6e95b 100644 --- a/arch

[RFC PATCH 13/14] sparc: kprobes: Use generic kretprobe trampoline handler

2020-08-26 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- arch/sparc/kernel/kprobes.c | 52 +++ 1 file changed, 4 insertions(+), 48 deletions(-) diff --git a/arch/sparc/kernel/kprobes.c b/arch/sparc/kernel/kprobes.c index dfbca2470536..cd34aeaa3ebb 100644 --- a/arch/sparc

[RFC PATCH 14/14] kprobes: Remove NMI context check

2020-08-26 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 cbd2ad1af7b7..311033e4b8e4 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -1359,7 +1359,8 @@ s

[RFC PATCH 06/14] csky: kprobes: Use generic kretprobe trampoline handler

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

[RFC PATCH 07/14] ia64: kprobes: Use generic kretprobe trampoline handler

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

[RFC PATCH 04/14] arm64: kprobes: Use generic kretprobe trampoline handler

2020-08-26 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- arch/arm64/kernel/probes/kprobes.c | 79 ++-- 1 file changed, 4 insertions(+), 75 deletions(-) diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c index 5290f17a4d80..1e4768001039 100644

[RFC PATCH 05/14] arc: kprobes: Use generic kretprobe trampoline handler

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

[RFC PATCH 01/14] kprobes: Add generic kretprobe trampoline handler

2020-08-26 Thread Masami Hiramatsu
address fixup for user handlers. Signed-off-by: Masami Hiramatsu --- include/linux/kprobes.h | 32 +-- kernel/kprobes.c| 101 +++ 2 files changed, 129 insertions(+), 4 deletions(-) diff --git a/include/linux/kprobes.h b/include/linux

[RFC PATCH 02/14] x86/kprobes: Use generic kretprobe trampoline handler

2020-08-26 Thread Masami Hiramatsu
Signed-off-by: Masami Hiramatsu --- arch/x86/kernel/kprobes/core.c | 109 +--- 1 file changed, 4 insertions(+), 105 deletions(-) diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c index 2ca10b770cff..45cfaa097110 100644 --- a/arch

[RFC PATCH 03/14] arm: kprobes: Use generic kretprobe trampoline handler

2020-08-26 Thread Masami Hiramatsu
Use the generic kretprobe trampoline handler. Use regs->ARM_fp for framepointer verification. Signed-off-by: Masami Hiramatsu --- arch/arm/probes/kprobes/core.c | 79 ++-- 1 file changed, 4 insertions(+), 75 deletions(-) diff --git a/arch/arm/pro

[RFC PATCH 00/14] kprobes: Unify kretprobe trampoline handlers

2020-08-26 Thread Masami Hiramatsu
f this pazzle. Thank you, --- Masami Hiramatsu (14): 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 trampoline handler arc:

Re: x86/kprobes: kretprobe fails to triggered if kprobe at function entry is not optimized (trigger by int3 breakpoint)

2020-08-26 Thread Masami Hiramatsu
On Wed, 26 Aug 2020 18:06:45 +0900 Masami Hiramatsu wrote: > On Wed, 26 Aug 2020 17:22:39 +0900 > Masami Hiramatsu wrote: > > > On Wed, 26 Aug 2020 07:07:09 + > > "eddy...@trendmicro.com" wrote: > > > > > > > > > ---

Re: x86/kprobes: kretprobe fails to triggered if kprobe at function entry is not optimized (trigger by int3 breakpoint)

2020-08-26 Thread Masami Hiramatsu
On Wed, 26 Aug 2020 17:22:39 +0900 Masami Hiramatsu wrote: > On Wed, 26 Aug 2020 07:07:09 + > "eddy...@trendmicro.com" wrote: > > > > > > -Original Message- > > > From: pet...@infradead.org > > > Sent: Tuesday, August 25, 2020 8

Re: x86/kprobes: kretprobe fails to triggered if kprobe at function entry is not optimized (trigger by int3 breakpoint)

2020-08-26 Thread Masami Hiramatsu
ng is needed: * If we have multiple consumers with llist_del_first used in one consumer, and ^^^ * llist_del_first or llist_del_all used in other consumers, then a lock is * needed. pre_handler_kretprobe() can be invoked simultaneously on the different CPUs if those are calling the same probed function. Thank you, -- Masami Hiramatsu

Re: x86/kprobes: kretprobe fails to triggered if kprobe at function entry is not optimized (trigger by int3 breakpoint)

2020-08-26 Thread Masami Hiramatsu
On Wed, 26 Aug 2020 07:07:09 + "eddy...@trendmicro.com" wrote: > > > -Original Message- > > From: pet...@infradead.org > > Sent: Tuesday, August 25, 2020 8:09 PM > > To: Masami Hiramatsu > > Cc: Eddy Wu (RD-TW) ; linux-kernel@vger.kernel

Re: x86/kprobes: kretprobe fails to triggered if kprobe at function entry is not optimized (trigger by int3 breakpoint)

2020-08-25 Thread Masami Hiramatsu
On Tue, 25 Aug 2020 16:10:58 +0200 pet...@infradead.org wrote: > On Tue, Aug 25, 2020 at 03:30:05PM +0200, pet...@infradead.org wrote: > > On Tue, Aug 25, 2020 at 10:15:55PM +0900, Masami Hiramatsu wrote: > > > > OK, this looks good to me too. > > > I'll make

Re: x86/kprobes: kretprobe fails to triggered if kprobe at function entry is not optimized (trigger by int3 breakpoint)

2020-08-25 Thread Masami Hiramatsu
On Tue, 25 Aug 2020 15:30:05 +0200 pet...@infradead.org wrote: > On Tue, Aug 25, 2020 at 10:15:55PM +0900, Masami Hiramatsu wrote: > > > > damn... one last problem is dangling instances.. so close. > > > We can apparently unregister a kretprobe wh

Re: x86/kprobes: kretprobe fails to triggered if kprobe at function entry is not optimized (trigger by int3 breakpoint)

2020-08-25 Thread Masami Hiramatsu
On Tue, 25 Aug 2020 14:09:11 +0200 pet...@infradead.org wrote: > On Tue, Aug 25, 2020 at 03:15:38PM +0900, Masami Hiramatsu wrote: > > > From 24390dffe6eb9a3e95f7d46a528a1dcfd716dc81 Mon Sep 17 00:00:00 2001 > > From: Masami Hiramatsu > > Date: Tue, 25 Aug 2020 01

Re: x86/kprobes: kretprobe fails to triggered if kprobe at function entry is not optimized (trigger by int3 breakpoint)

2020-08-24 Thread Masami Hiramatsu
Hi Eddy, On Mon, 24 Aug 2020 16:41:58 + "eddy...@trendmicro.com" wrote: > > -Original Message- > > From: Masami Hiramatsu > > Sent: Monday, August 24, 2020 11:54 PM > > To: Eddy Wu (RD-TW) > > Cc: Peter Zijlstra ; linux-kernel@vger.kernel.or

Re: x86/kprobes: kretprobe fails to triggered if kprobe at function entry is not optimized (trigger by int3 breakpoint)

2020-08-24 Thread Masami Hiramatsu
raw_spin_unlock_irqrestore(&rp->lock, flags); > - return 0; > + goto out; > } > > arch_prepare_kretprobe(ri, regs); > @@ -1978,6 +1973,8 @@ static int pre_handler_kretprobe(struct kprobe *p, > struct pt_regs *regs) > rp->nmissed++; > raw_spin_unlock_irqrestore(&rp->lock, flags); > } > +out: > + atomic_dec(&rp->recursion); > return 0; > } > NOKPROBE_SYMBOL(pre_handler_kretprobe); > -- Masami Hiramatsu

Re: x86/kprobes: kretprobe fails to triggered if kprobe at function entry is not optimized (trigger by int3 breakpoint)

2020-08-24 Thread Masami Hiramatsu
return in_nmi() } @arch/x86/kernel/kprobes/core.c bool arch_kprobe_in_nmi(void) { /* * Since the int3 is one of NMI, we have to check in_nmi() is * bigger than 1 << NMI_SHIFT instead of !0. */ return in_nmi() > (1 << NMI_SHIFT); } And use arch_kprobe_in_nmi() instead of in_nmi() in kprobes.c. Thanks, -- Masami Hiramatsu

Re: [RFC][PATCH 3/7] x86/debug: Move kprobe_debug_handler() into exc_debug_kernel()

2020-08-21 Thread Masami Hiramatsu
On Thu, 20 Aug 2020 12:38:35 +0200 Peter Zijlstra wrote: Looks good to me. Acked-by: Masami Hiramatsu Thanks, > > Signed-off-by: Peter Zijlstra (Intel) > --- > arch/x86/include/asm/kprobes.h |4 > arch/x86/kernel/traps.c| 10 -- > 2 files cha

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

2020-08-21 Thread Masami Hiramatsu
On Fri, 21 Aug 2020 21:28:43 +0900 Masami Hiramatsu wrote: > Hi Muchun, > > On Thu, 20 Aug 2020 11:19:33 +0800 > Muchun Song wrote: > > > If a kprobe is marked as gone, we should not kill it again. Otherwise, > > we can disarm the kprobe more than once. In that

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

2020-08-21 Thread Masami Hiramatsu
do not work. > Good catch! Hmm, I think we also need an assertion in kill_kprobe() so that p is already gone. Anyway, this looks good to me. Acked-by: Masami Hiramatsu Thanks! > Fixes: 0cb2f1372baa ("kprobes: Fix NULL pointer dereference at > kprobe_ftrace_handler") >

Re: [PATCH] kprobes: Use module_name() macro

2020-08-18 Thread Masami Hiramatsu
g > Cc: Andi Kleen > Cc: Ard Biesheuvel > Cc: Jessica Yu > Cc: Mark Rutland , > Cc: Masami Hiramatsu > Cc: Mike Rapoport > Cc: Peter Zijlstra > Cc: Russell King > Cc: Will Deacon > Signed-off-by: Jarkko Sakkinen OK, this looks good to me. Acked-by: Masami Hiram

Re: [PATCH 4/6] tools/bootconfig: Add a script to generate ftrace shell-command from bootconfig

2020-08-15 Thread Masami Hiramatsu
On Thu, 13 Aug 2020 21:01:00 -0400 Steven Rostedt wrote: > On Mon, 10 Aug 2020 17:35:11 +0900 > Masami Hiramatsu wrote: > > > > --- /dev/null > > +++ b/tools/bootconfig/scripts/xbc.sh > > @@ -0,0 +1,56 @@ > > +#!/bin/sh > > +# SPDX-License-Identi

[PATCH v2 6/6] tools/bootconfig: Add --init option for bconf2ftrace.sh

2020-08-15 Thread Masami Hiramatsu
Since the ftrace current setting may conflict with the new setting from bootconfig, add the --init option to initialize ftrace before setting for bconf2ftrace.sh. E.g. $ bconf2ftrace.sh --init boottrace.bconf This initialization method copied from selftests/ftrace. Signed-off-by: Masami

[PATCH v2 5/6] tools/bootconfig: Add a script to generates bootconfig from ftrace

2020-08-15 Thread Masami Hiramatsu
usually you'll run it as # ftrace2bconf.sh > ftrace.bconf Note that some ftrace configurations are not supported. For example, function-call/callgraph trace/notrace settings are not supported because the wildcard has been expanded and lost in the ftrace anymore. Signed-off-by: Masami H

[PATCH v2 3/6] tools/bootconfig: Make all functions static

2020-08-15 Thread Masami Hiramatsu
Make all functions static except for main(). This is just a cleanup. Signed-off-by: Masami Hiramatsu --- tools/bootconfig/main.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c index 78025267df20

[PATCH v2 0/6] tools/bootconfig: Add boot-time tracing script

2020-08-15 Thread Masami Hiramatsu
ripts/bconf2ftrace.sh create mode 100644 tools/bootconfig/scripts/ftrace.sh create mode 100755 tools/bootconfig/scripts/ftrace2bconf.sh create mode 100644 tools/bootconfig/scripts/xbc.sh -- Masami Hiramatsu (Linaro)

[PATCH v2 2/6] tools/bootconfig: Add list option

2020-08-15 Thread Masami Hiramatsu
Add list option (-l) to show the bootconfig in the list style. This is same output of /proc/bootconfig. So users can check how their bootconfig will be shown in procfs. This will help them to write a user-space script to parse the /proc/bootconfig. Signed-off-by: Masami Hiramatsu --- tools

Re: [PATCH] bootconfig: Fix off-by-one in xbc_node_compose_key_after()

2020-08-15 Thread Masami Hiramatsu
s it may act the same. > > That is, ret == size will make size = 0 with the size -= ret, and we > get the same result. > > OK, you can drop the patch. Thanks for the review! Thanks Andrew, you're right. If size == ret, then size -= ret makes size = 0 and after that, the

[PATCH v2 4/6] tools/bootconfig: Add a script to generate ftrace shell-command from bootconfig

2020-08-15 Thread Masami Hiramatsu
can apply it directly. # bconf2ftrace.sh --apply ftrace.bconf Note that some boot-time tracing parameters under kernel.* are not able to set via tracefs nor procfs (e.g. tp_printk, traceoff_on_warning.), so those are ignored. Signed-off-by: Masami Hiramatsu --- Changes in v2 - Check

[PATCH v2 1/6] tools/bootconfig: Show bootconfig compact tree from bootconfig file

2020-08-15 Thread Masami Hiramatsu
Show the bootconfig compact tree from the bootconfig file instead of an initrd if the given file has no magic number and is smaller than 32KB. User can use this for checking the syntax error or output checking before applying the bootconfig to initrd. Signed-off-by: Masami Hiramatsu --- tools

[PATCH 5/6] tools/bootconfig: Add a script to generates bootconfig from ftrace

2020-08-10 Thread Masami Hiramatsu
usually you'll run it as # ftrace2bconf.sh > ftrace.bconf Note that some ftrace configurations are not supported. For example, function-call/callgraph trace/notrace settings are not supported because the wildcard has been expanded and lost in the ftrace anymore. Signed-off-by: Masami H

[PATCH 6/6] tools/bootconfig: Add --init option for bconf2ftrace.sh

2020-08-10 Thread Masami Hiramatsu
Since the ftrace current setting may conflict with the new setting from bootconfig, add the --init option to initialize ftrace before setting for bconf2ftrace.sh. E.g. $ bconf2ftrace.sh --init boottrace.bconf This initialization method copied from selftests/ftrace. Signed-off-by: Masami

[PATCH 3/6] tools/bootconfig: Make all functions static

2020-08-10 Thread Masami Hiramatsu
Make all functions static except for main(). This is just a cleanup. Signed-off-by: Masami Hiramatsu --- tools/bootconfig/main.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c index 78025267df20

[PATCH 2/6] tools/bootconfig: Add list option

2020-08-10 Thread Masami Hiramatsu
Add list option (-l) to show the bootconfig in the list style. This is same output of /proc/bootconfig. So users can check how their bootconfig will be shown in procfs. This will help them to write a user-space script to parse the /proc/bootconfig. Signed-off-by: Masami Hiramatsu --- tools

[PATCH 4/6] tools/bootconfig: Add a script to generate ftrace shell-command from bootconfig

2020-08-10 Thread Masami Hiramatsu
can apply it directly. # bconf2ftrace.sh --apply ftrace.bconf Note that some boot-time tracing parameters under kernel.* are not able to set via tracefs nor procfs (e.g. tp_printk, traceoff_on_warning.), so those are ignored. Signed-off-by: Masami Hiramatsu --- tools/bootconfig/scri

[PATCH 0/6] tools/bootconfig: Add boot-time tracing script

2020-08-10 Thread Masami Hiramatsu
s the bootconfig as a key-value list, as same as /proc/bootconfig. Thank you, --- Masami Hiramatsu (6): tools/bootconfig: Show bootconfig compact tree from bootconfig file tools/bootconfig: Add list option tools/bootconfig: Make all functions static tools/bootconfig: Add a scri

[PATCH 1/6] tools/bootconfig: Show bootconfig compact tree from bootconfig file

2020-08-10 Thread Masami Hiramatsu
Show the bootconfig compact tree from the bootconfig file instead of an initrd if the given file has no magic number and is smaller than 32KB. User can use this for checking the syntax error or output checking before applying the bootconfig to initrd. Signed-off-by: Masami Hiramatsu --- tools

[tip: perf/urgent] kprobes: Remove show_registers() function prototype

2020-08-06 Thread tip-bot2 for Masami Hiramatsu
The following commit has been merged into the perf/urgent branch of tip: Commit-ID: 09fc67b500c7f0bb1b5ed774197ac7f2c5285655 Gitweb: https://git.kernel.org/tip/09fc67b500c7f0bb1b5ed774197ac7f2c5285655 Author:Masami Hiramatsu AuthorDate:Fri, 17 Jul 2020 17:42:55 +09:00

Re: [PATCH] kprobes: fix compiler warning for !CONFIG_KPROBES_ON_FTRACE

2020-08-05 Thread Masami Hiramatsu
.auug.org.au > > Reported-by: Stephen Rothwell > Fixes: 0cb2f1372baa ("kprobes: Fix NULL pointer dereference at > kprobe_ftrace_handler") > Signed-off-by: Muchun Song Looks good to me. Acked-by: Masami Hiramatsu Thank you! > --- > kernel/kprobes.c | 17 +++

Re: [External] linux-next: build warning after merge of the ftrace tree

2020-08-05 Thread Masami Hiramatsu
uct kprobe *p) > > +{ > > + return -ENODEV > > +} > > #endif > > Looks like that would work. Care to send a formal patch. Could you also > change arm_kprobe_ftrace() as well? Looks good to me too as far as updating it to static inline function. Thank you, -- Masami Hiramatsu

Re: [PATCH v2] bootconfig: Fix to find the initargs correctly

2020-08-05 Thread Masami Hiramatsu
Hi Steve, On Tue, 4 Aug 2020 16:59:29 -0400 Steven Rostedt wrote: > On Tue, 4 Aug 2020 11:52:13 +0900 > Masami Hiramatsu wrote: > > > Since the parse_args() stops parsing at '--', bootconfig_params() > > will never get the '--' as param and initargs_f

[PATCH v2] bootconfig: Fix to find the initargs correctly

2020-08-03 Thread Masami Hiramatsu
quot;) Cc: sta...@vger.kernel.org Reported-by: Arvind Sankar Suggested-by: Arvind Sankar Signed-off-by: Masami Hiramatsu --- Changes in v2: - Remvoe unneede !IS_ERR(). --- init/main.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/init/main.c b/init/main

[PATCH v2] bootconfig: Fix to find the initargs correctly

2020-08-03 Thread Masami Hiramatsu
quot;) Cc: sta...@vger.kernel.org Reported-by: Arvind Sankar Suggested-by: Arvind Sankar Signed-off-by: Masami Hiramatsu --- Changes in v2: - Remvoe unneede !IS_ERR(). --- init/main.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/init/main.c b/init/main

Re: [PATCH v6 08/22] bootconfig: init: Allow admin to use bootconfig for init command line

2020-08-03 Thread Masami Hiramatsu
OK, I'll update it. > > Thanks! > > (/me is currently going through all his patchwork patches to pull in > for the merge window.) Thank you! > > -- Steve -- Masami Hiramatsu

Re: [PATCH v6 08/22] bootconfig: init: Allow admin to use bootconfig for init command line

2020-08-03 Thread Masami Hiramatsu
e > parsing. AFAICT, initargs_found will never be set to true here, because > parse_args handles "--" itself by immediately returning: it doesn't > invoke the callback for it. So you'd instead have to check the return of > parse_args("bootconfig"...) to d

Re: [PATCH] kprobes: fix NULL pointer dereference at kprobe_ftrace_handler

2020-08-03 Thread Masami Hiramatsu
NE but not disarm the kprobe in the step 4). > > The step 5) also do not disarm the kprobe when unregister kprobe. So > > we do not remove the ip from the filter. In this case, when the module > > loads again in the step 6), we will replace the code to ftrace_caller > > vi

Re: [PATCH v5 5/6] kprobes: Use text_alloc() and text_free()

2020-07-29 Thread Masami Hiramatsu
On Wed, 29 Jul 2020 09:13:21 +0300 Ard Biesheuvel wrote: > On Wed, 29 Jul 2020 at 04:51, Masami Hiramatsu wrote: > > > > On Tue, 28 Jul 2020 20:51:08 +0300 > > Ard Biesheuvel wrote: > > > > > On Tue, 28 Jul 2020 at 16:35, Masami Hiramatsu > > >

Re: [PATCH 0/3] bootconfig: Add value override operator

2020-07-29 Thread Masami Hiramatsu
Hi Steve, On Thu, 16 Jul 2020 10:27:03 +0900 Masami Hiramatsu wrote: > Hi Steve, > > On Wed, 15 Jul 2020 20:02:12 -0400 > Steven Rostedt wrote: > > > On Thu, 16 Jul 2020 07:38:43 +0900 > > Masami Hiramatsu wrote: > > > > > > > > So the en

Re: [PATCH v5 5/6] kprobes: Use text_alloc() and text_free()

2020-07-28 Thread Masami Hiramatsu
On Tue, 28 Jul 2020 20:51:08 +0300 Ard Biesheuvel wrote: > On Tue, 28 Jul 2020 at 16:35, Masami Hiramatsu wrote: > > > > On Tue, 28 Jul 2020 13:56:43 +0300 > > Ard Biesheuvel wrote: > > > > > On Tue, 28 Jul 2020 at 11:17, Masami Hiramatsu > > > wr

Re: [PATCH v5 5/6] kprobes: Use text_alloc() and text_free()

2020-07-28 Thread Masami Hiramatsu
On Tue, 28 Jul 2020 13:56:43 +0300 Ard Biesheuvel wrote: > On Tue, 28 Jul 2020 at 11:17, Masami Hiramatsu wrote: > > > Masami or Peter should correct me if I am wrong, but it seems to me > > > that the way kprobes uses these pages does not require them to be in > > &g

[tip: perf/core] kprobes: Remove unnecessary module_mutex locking from kprobe_optimizer()

2020-07-28 Thread tip-bot2 for Masami Hiramatsu
The following commit has been merged into the perf/core branch of tip: Commit-ID: 112a0e4171e111e963aada3fe790c71accf4d705 Gitweb: https://git.kernel.org/tip/112a0e4171e111e963aada3fe790c71accf4d705 Author:Masami Hiramatsu AuthorDate:Tue, 28 Jul 2020 16:34:00 +09:00

Re: [PATCH v5 5/6] kprobes: Use text_alloc() and text_free()

2020-07-28 Thread Masami Hiramatsu
gt; > > > > * Jarkko Sakkinen wrote: > > > > > > > > > Use text_alloc() and text_free() instead of module_alloc() and > > > > > module_memfree() when an arch provides them. > > > > > > > > > > Cc: linux...@kvack.org

Re: [PATCH v5 1/6] kprobes: Remove dependency to the module_mutex

2020-07-28 Thread Masami Hiramatsu
nted better. Good catch! This is not needed anymore. It has been introduced to avoid conflict with text modification, at that point we didn't get text_mutex. But after commit f1c6ece23729 ("kprobes: Fix potential deadlock in kprobe_optimizer()") moved the text_mutex in the current

Re: [PATCH] MAINTAINERS: adjust kprobes.rst entry to new location

2020-07-27 Thread Masami Hiramatsu
gt; > warning: no file matchesF:Documentation/staging/kprobes.rst > > Adjust the entry to the new file location. > Good catch! Acked-by: Masami Hiramatsu Thanks! > Signed-off-by: Lukas Bulwahn > --- > Naveen, Masami-san, please ack. > Jonathan, please pick this mi

Re: [PATCH v7 3/3] arm64: implement KPROBES_ON_FTRACE

2020-07-24 Thread Masami Hiramatsu
On Fri, 24 Jul 2020 15:06:11 +0800 Jisheng Zhang wrote: > > On Tue, 21 Jul 2020 22:24:55 +0900 Masami Hiramatsu wrote: > > > > > > > Hi Jisheng, > > Hi, > > > > > Would you be still working on this series? > > I will rebase the

Re: [PATCH v5 5/6] kprobes: Use text_alloc() and text_free()

2020-07-24 Thread Masami Hiramatsu
vack.org > > Cc: Andi Kleen > > Cc: Masami Hiramatsu > > Cc: Peter Zijlstra > > Signed-off-by: Jarkko Sakkinen > > --- > > kernel/kprobes.c | 9 + > > 1 file changed, 9 insertions(+) > > > > diff --git a/kernel/kprobes.c b/kernel/kprobes.c

Re: [PATCH v5 1/6] kprobes: Remove dependency to the module_mutex

2020-07-24 Thread Masami Hiramatsu
ompile time dependency, e.g. module_state, right? Thank you, > > Cc: linux...@kvack.org > Cc: Andi Kleen > Cc: Peter Zijlstra > Suggested-by: Masami Hiramatsu > Signed-off-by: Jarkko Sakkinen > --- > include/linux/module.h | 18 ++ >

Re: [PATCH v3 6/7] riscv: Add KPROBES_ON_FTRACE supported

2020-07-23 Thread Masami Hiramatsu
king a placeholder with nop at the entry of the functions for direct patching. Thank you, > > On Tue, Jul 21, 2020 at 9:27 PM Masami Hiramatsu wrote: > > > > On Wed, 15 Jul 2020 00:24:54 +0800 > > Guo Ren wrote: > > > > > Thx Masami, > > > >

Re: [PATCH v3 6/7] riscv: Add KPROBES_ON_FTRACE supported

2020-07-23 Thread Masami Hiramatsu
On Wed, 22 Jul 2020 16:39:53 +0800 Guo Ren wrote: > Hi Masami, > > On Tue, Jul 21, 2020 at 9:27 PM Masami Hiramatsu wrote: > > > > On Wed, 15 Jul 2020 00:24:54 +0800 > > Guo Ren wrote: > > > > > Thx Masami, > > > > > > On

Re: [PATCH] kprobes: Replace HTTP links with HTTPS ones

2020-07-21 Thread Masami Hiramatsu
For each line: > If doesn't contain `\bxmlns\b`: > For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`: > If both the HTTP and HTTPS versions > return 200 OK and serve the same content: > Replace HTTP with HTTPS. > Acked-by: Masami

Re: [PATCH 0/3] docs: kprobes: Update URLs and move under trace/

2020-07-21 Thread Masami Hiramatsu
Hi Naveen, On Tue, 21 Jul 2020 17:18:19 +0530 "Naveen N. Rao" wrote: > This series updates some of the URLs in the kprobes document and moves > the same under trace/ directory. Thank you very much for fixing and updating it! Acked-by: Masami Hiramatsu for this

Re: [PATCH v3 6/7] riscv: Add KPROBES_ON_FTRACE supported

2020-07-21 Thread Masami Hiramatsu
On Wed, 15 Jul 2020 00:24:54 +0800 Guo Ren wrote: > Thx Masami, > > On Tue, Jul 14, 2020 at 7:38 PM Masami Hiramatsu wrote: > > > > On Mon, 13 Jul 2020 23:39:21 + > > guo...@kernel.org wrote: > > > > > From: Guo Ren > > > > > >

Re: [PATCH v7 3/3] arm64: implement KPROBES_ON_FTRACE

2020-07-21 Thread Masami Hiramatsu
Hi Jisheng, Would you be still working on this series? If you are still want to put a probe on func+4, it is OK if you can completely emulate the 1st instruction. (lr save on the stack and change the regs->sp) Thank you, On Thu, 26 Dec 2019 18:26:07 +0900 Masami Hiramatsu wrote: > On T

Re: [PATCH] Replace HTTP links with HTTPS ones: kprobes

2020-07-20 Thread Masami Hiramatsu
On Tue, 14 Jul 2020 00:02:49 +0200 "Alexander A. Klimov" wrote: > > > Am 13.07.20 um 16:20 schrieb Masami Hiramatsu: > > Hi Naveen and Alexander, > > > > On Fri, 10 Jul 2020 19:14:47 +0530 > > "Naveen N. Rao" wrote: > > > >&

Re: [PATCH v4 3/7] vmalloc: Add text_alloc() and text_free()

2020-07-20 Thread Masami Hiramatsu
functions with > > CONFIG_ARCH_HAS_TEXT_ALLOC. Provide default/fallback implementation > > wrapping module_alloc() and module_memfree(). > > > > Cc: Andi Kleen > > Cc: Masami Hiramatsu > > Suggested-by: Peter Zijlstra > > Signed-off-by: Jarkko Sakkinen > > --- > &

Re: [PATCH v2 1/4] perf-probe: Avoid setting probes on same address on same event

2020-07-20 Thread Masami Hiramatsu
On Thu, 16 Jul 2020 18:47:14 -0300 Arnaldo Carvalho de Melo wrote: > Em Fri, Jul 10, 2020 at 10:11:04PM +0900, Masami Hiramatsu escreveu: > > There is a case that the several same-name symbols points > > same address. In that case, perf probe returns an error. > > > >

Re: [PATCH v4 10/75] x86/insn: Add insn_has_rep_prefix() helper

2020-07-17 Thread Masami Hiramatsu
On Tue, 14 Jul 2020 14:08:12 +0200 Joerg Roedel wrote: > From: Joerg Roedel > > Add a function to check whether an instruction has a REP prefix. This looks good to me. Reviewed-by: Masami Hiramatsu Thank you, > > Signed-off-by: Joerg Roedel > --- > arch/x86/in

Re: [PATCH v4 06/75] x86/insn: Make inat-tables.c suitable for pre-decompression code

2020-07-17 Thread Masami Hiramatsu
re-decompression boot-code has no support for applying ELF > relocations, so initialize these arrays at runtime in the > pre-decompression code to make sure all pointers are correctly > initialized. OK, This looks good to me. Acked-by: Masami Hiramatsu Thank you, > > Signed-off

Re: [PATCH v2 0/3] kgdb: Honour the kprobe blacklist when setting breakpoints

2020-07-17 Thread Masami Hiramatsu
_within_kprobe_blacklist(). This series looks good to me. Acked-by: Masami Hiramatsu To fix the build error with ipw2x00 driver, please feel free to include my fix patch. Thank you, > > > Daniel Thompson (3): > kgdb: Honour the kprobe blocklist when setting breakpoints > kgdb:

Re: [PATCH v4 3/7] vmalloc: Add text_alloc() and text_free()

2020-07-17 Thread Masami Hiramatsu
gt; wrapping module_alloc() and module_memfree(). Doesn't it depend on CONFIG_MODULE? Thank you, > > Cc: Andi Kleen > Cc: Masami Hiramatsu > Suggested-by: Peter Zijlstra > Signed-off-by: Jarkko Sakkinen > --- > include/linux/vmalloc.h | 23 +++ > 1

Re: [PATCH 0/3] bootconfig: Add value override operator

2020-07-15 Thread Masami Hiramatsu
Hi Steve, On Wed, 15 Jul 2020 20:02:12 -0400 Steven Rostedt wrote: > On Thu, 16 Jul 2020 07:38:43 +0900 > Masami Hiramatsu wrote: > > > > > So the end of the initrd would have: > > > > > > [data][size/checksum/magic][more-data][size/checksum/magic] &

Re: [PATCH 0/3] bootconfig: Add value override operator

2020-07-15 Thread Masami Hiramatsu
On Wed, 15 Jul 2020 16:45:04 -0400 Steven Rostedt wrote: > On Thu, 16 Jul 2020 01:00:21 +0900 > Masami Hiramatsu wrote: > > > With this change, if the bootloader wants to change some value > > in the default bootconfig, it doesn't need to parse the existing >

[PATCH 3/3] Documentation: bootconfig: Add bootconfig override operator

2020-07-15 Thread Masami Hiramatsu
Add a sentence about bootconfig override operator (":=") to bootconfig.rst. Signed-off-by: Masami Hiramatsu --- Documentation/admin-guide/bootconfig.rst | 11 +++ 1 file changed, 11 insertions(+) diff --git a/Documentation/admin-guide/bootconfig.rst b/Documentation/a

[PATCH 1/3] lib/bootconfig: Add override operator support

2020-07-15 Thread Masami Hiramatsu
e existing bootconfig and update it. However, with this assignment, it can just append the updated (partial) bootconfig text at the tail of existing one without parsing it. (Of course, it must update the size, checksum and magic, but that will be done easily) Signed-off-by: Masami Hiramatsu

[PATCH 2/3] tools/bootconfig: Add testcases for value override operator

2020-07-15 Thread Masami Hiramatsu
Add some testcases and examples for value override operator. Signed-off-by: Masami Hiramatsu --- tools/bootconfig/samples/bad-override.bconf |3 +++ tools/bootconfig/samples/bad-override2.bconf |3 +++ tools/bootconfig/samples/good-override.bconf |6 ++ tools/bootconfig/test

[PATCH 0/3] bootconfig: Add value override operator

2020-07-15 Thread Masami Hiramatsu
an just append the new configs at the tail of the bootconfig and update the footer (size, checksum and magic word). Thank you, --- Masami Hiramatsu (3): lib/bootconfig: Add override operator support tools/bootconfig: Add testcases for value override operator Documentation:

Re: [PATCH v3 2/3] module: Add lock_modules() and unlock_modules()

2020-07-15 Thread Masami Hiramatsu
On Wed, 15 Jul 2020 01:32:28 +0300 Jarkko Sakkinen wrote: > Add wrappers to take the modules "big lock" in order to encapsulate > conditional compilation (CONFIG_MODULES) inside the wrapper. > > Cc: Andi Kleen > Suggested-by: Masami Hiramatsu > Signed-off-by: Jarkk

Re: [PATCH v3 3/3] kprobes: Flag out CONFIG_MODULES dependent code

2020-07-15 Thread Masami Hiramatsu
/* Don't need to check busy - this should have gone. */ > __unregister_trace_kprobe(tk); > ret = __register_trace_kprobe(tk); > +#ifdef CONFIG_MODULES > if (ret) > pr_warn("Failed to re-register probe %s on %s: > %d\n", > trace_probe_name(&tk->tp), > mod->name, ret); > +#endif I guess this CONFIG_MODULES is for avoiding build error according to mod->name, if so, please use module_name(mod) macro instead of this #ifdef. > } > } > mutex_unlock(&event_mutex); > -- > 2.25.1 > -- Masami Hiramatsu

Re: [PATCH v3 1/3] kprobes: Add text_alloc() and text_free()

2020-07-15 Thread Masami Hiramatsu
preempt_enable(); > diff --git a/kernel/module.c b/kernel/module.c > index aa183c9ac0a2..8adeb126b02c 100644 > --- a/kernel/module.c > +++ b/kernel/module.c > @@ -56,6 +56,7 @@ > #include > #include > #include > +#include > #include > #include "module-internal.h" > > @@ -2151,7 +2152,12 @@ void __weak module_memfree(void *module_region) >* supported by vmalloc. >*/ > WARN_ON(in_interrupt()); > + > +#ifdef CONFIG_ARCH_HAS_TEXT_ALLOC > + text_free(module_region); > +#else > vfree(module_region); > +#endif > } > > void __weak module_arch_cleanup(struct module *mod) > @@ -2786,9 +2792,13 @@ static void dynamic_debug_remove(struct module *mod, > struct _ddebug *debug) > > void * __weak module_alloc(unsigned long size) > { > +#ifdef CONFIG_ARCH_HAS_TEXT_ALLOC > + return text_alloc(size); > +#else > return __vmalloc_node_range(size, 1, VMALLOC_START, VMALLOC_END, > GFP_KERNEL, PAGE_KERNEL_EXEC, VM_FLUSH_RESET_PERMS, > NUMA_NO_NODE, __builtin_return_address(0)); > +#endif > } Please don't touch kernel/module.c too. This seems to make things complicated. Thank you, -- Masami Hiramatsu

Re: [PATCH -next] bootconfig: Make symbol 'xbc_namebuf' static

2020-07-14 Thread Masami Hiramatsu
On Tue, 14 Jul 2020 22:25:04 +0800 Wei Yongjun wrote: > Fix sparse build warning: > > init/main.c:305:6: warning: > symbol 'xbc_namebuf' was not declared. Should it be static? Good catch! Acked-by: Masami Hiramatsu Thank you, > > Signed-off-by: Wei Yongj

Re: [PATCH RFC] kprobes: Remove MODULES dependency

2020-07-14 Thread Masami Hiramatsu
> > > > module_alloc() ensures the memory provided is within that range. > > Right, a relative jump is placed instead of 0xcc to the breakpoint? Yes, a relative (far) jump is used. So the target address (copied buffer) must be in +-2GB range from the jump. Thank you, -- Masami Hiramatsu

Re: [PATCH RFC] kprobes: Remove MODULES dependency

2020-07-14 Thread Masami Hiramatsu
On Mon, 13 Jul 2020 08:49:55 +0300 Jarkko Sakkinen wrote: > On Fri, Jul 10, 2020 at 01:32:38PM +0200, Peter Zijlstra wrote: > > On Fri, Jul 10, 2020 at 07:32:57PM +0900, Masami Hiramatsu wrote: > > > > - page = module_alloc(PAGE_SIZE); > > > >

Re: [PATCH v3 7/7] riscv: Add support for function error injection

2020-07-14 Thread Masami Hiramatsu
] fei_kprobe_handler+0x2c/0x5a > [ 313.197687] [] kprobe_breakpoint_handler+0xb4/0x18a > [ 313.200054] [] do_trap_break+0x36/0xca > [ 313.202147] [] ret_from_exception+0x0/0xc > [ 313.204556] [] ret_from_syscall+0x0/0x2 > -sh: can't fork: Invalid argument OK, this looks good to me. Review

Re: [PATCH v3 6/7] riscv: Add KPROBES_ON_FTRACE supported

2020-07-14 Thread Masami Hiramatsu
| | > sh-87[000] 551.557031: myprobe: > (_do_fork+0x1a/0x2e6) dfd=0xffe00020af7e filename=0xffe00020b34e > flags=0xffe00101e7c0 mode=0x20af86ffe0 > > cat /sys/kernel/debug/kprobes/list > ffe00020af7e k _do_fork+0x1a

Re: [PATCH v3 3/7] riscv: Fixup kprobes handler couldn't change pc

2020-07-14 Thread Masami Hiramatsu
ruction pointer. > Looks Good to me:) Reviewed-by: Masami Hiramatsu Thank you! > Signed-off-by: Guo Ren > Cc: Masami Hiramatsu > Cc: Palmer Dabbelt > --- > arch/riscv/kernel/mcount-dyn.S | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a

Re: [PATCH v2 6/6] riscv: Add KPROBES_ON_FTRACE supported

2020-07-14 Thread Masami Hiramatsu
Hi Guo, On Tue, 14 Jul 2020 07:47:20 +0800 Guo Ren wrote: > Hi Masami, > > On Sun, Jul 12, 2020 at 9:37 PM Masami Hiramatsu wrote: > > > > On Sat, 11 Jul 2020 09:32:01 +0800 > > Guo Ren wrote: > > > > > Thx Masami, > > > > > > On

Re: [PATCH v3 1/7] RISC-V: Implement ptrace regs and stack API

2020-07-14 Thread Masami Hiramatsu
On Mon, 13 Jul 2020 23:39:16 + guo...@kernel.org wrote: > From: Patrick Stählin > > Needed for kprobes support. Copied and adapted from arm64 code. > > Guo Ren fixup pt_regs type for linux-5.8-rc1. > Looks good to me. Reviewed-by: Masami Hiramatsu Thank you! > S

Re: [PATCH v3 0/7] riscv: Add k/uprobe supported

2020-07-14 Thread Masami Hiramatsu
eletions(-) > create mode 100644 arch/riscv/include/asm/probes.h > create mode 100644 arch/riscv/include/asm/uprobes.h > create mode 100644 arch/riscv/kernel/probes/Makefile > create mode 100644 arch/riscv/kernel/probes/decode-insn.c > create mode 100644 arch/riscv/kernel/probes/decode-insn.h > create mode 100644 arch/riscv/kernel/probes/ftrace.c > create mode 100644 arch/riscv/kernel/probes/kprobes.c > create mode 100644 arch/riscv/kernel/probes/kprobes_trampoline.S > create mode 100644 arch/riscv/kernel/probes/simulate-insn.c > create mode 100644 arch/riscv/kernel/probes/simulate-insn.h > create mode 100644 arch/riscv/kernel/probes/uprobes.c > create mode 100644 arch/riscv/lib/error-inject.c > > -- > 2.7.4 > -- Masami Hiramatsu

Re: [PATCH] Replace HTTP links with HTTPS ones: kprobes

2020-07-13 Thread Masami Hiramatsu
Hi Naveen and Alexander, On Fri, 10 Jul 2020 19:14:47 +0530 "Naveen N. Rao" wrote: > Masami Hiramatsu wrote: > > On Tue, 7 Jul 2020 21:49:59 +0200 > > "Alexander A. Klimov" wrote: > > > >> Rationale: > >> Reduces attack surface on k

Re: [PATCH v2 6/6] riscv: Add KPROBES_ON_FTRACE supported

2020-07-12 Thread Masami Hiramatsu
On Sat, 11 Jul 2020 09:32:01 +0800 Guo Ren wrote: > Thx Masami, > > On Fri, Jul 10, 2020 at 9:50 PM Masami Hiramatsu wrote: > > > > Hi Guo, > > > > On Thu, 9 Jul 2020 02:19:14 + > > guo...@kernel.org wrote: > > > > > +/* Ftrace callba

<    7   8   9   10   11   12   13   14   15   16   >