linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] Do some changes about kprobe and trace
@ 2021-10-26  1:51 Tiezhu Yang
  2021-10-26  1:51 ` [PATCH v2 1/4] samples/kretprobes: Fix return value if register_kretprobe() failed Tiezhu Yang
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Tiezhu Yang @ 2021-10-26  1:51 UTC (permalink / raw)
  To: naveen.n.rao, anil.s.keshavamurthy, davem, mhiramat, rostedt,
	mingo, corbet
  Cc: akpm, linux-doc, linux-kernel

This patchset is based on linux-trace.git:
https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git/ for-next

v2:
  -- Update patch #4 to use linux-trace.git for KPROBES and TRACING entries

Tiezhu Yang (4):
  samples/kretprobes: Fix return value if register_kretprobe() failed
  docs, kprobes: Remove invalid URL and add new reference
  test_kprobes: Move it from kernel/ to lib/
  MAINTAINERS: Update KPROBES and TRACING entries

 Documentation/trace/kprobes.rst     | 2 +-
 MAINTAINERS                         | 5 ++++-
 kernel/Makefile                     | 1 -
 lib/Makefile                        | 1 +
 {kernel => lib}/test_kprobes.c      | 0
 samples/kprobes/kretprobe_example.c | 2 +-
 6 files changed, 7 insertions(+), 4 deletions(-)
 rename {kernel => lib}/test_kprobes.c (100%)

-- 
2.1.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/4] samples/kretprobes: Fix return value if register_kretprobe() failed
  2021-10-26  1:51 [PATCH v2 0/4] Do some changes about kprobe and trace Tiezhu Yang
@ 2021-10-26  1:51 ` Tiezhu Yang
  2021-10-26  1:51 ` [PATCH v2 2/4] docs, kprobes: Remove invalid URL and add new reference Tiezhu Yang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Tiezhu Yang @ 2021-10-26  1:51 UTC (permalink / raw)
  To: naveen.n.rao, anil.s.keshavamurthy, davem, mhiramat, rostedt,
	mingo, corbet
  Cc: akpm, linux-doc, linux-kernel

Use the actual return value instead of always -1 if register_kretprobe()
failed.

E.g. without this patch:

 # insmod samples/kprobes/kretprobe_example.ko func=no_such_func
 insmod: ERROR: could not insert module samples/kprobes/kretprobe_example.ko: Operation not permitted

With this patch:

 # insmod samples/kprobes/kretprobe_example.ko func=no_such_func
 insmod: ERROR: could not insert module samples/kprobes/kretprobe_example.ko: Unknown symbol in module

Fixes: 804defea1c02 ("Kprobes: move kprobe examples to samples/")
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 samples/kprobes/kretprobe_example.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/samples/kprobes/kretprobe_example.c b/samples/kprobes/kretprobe_example.c
index 5dc1bf3..228321e 100644
--- a/samples/kprobes/kretprobe_example.c
+++ b/samples/kprobes/kretprobe_example.c
@@ -86,7 +86,7 @@ static int __init kretprobe_init(void)
 	ret = register_kretprobe(&my_kretprobe);
 	if (ret < 0) {
 		pr_err("register_kretprobe failed, returned %d\n", ret);
-		return -1;
+		return ret;
 	}
 	pr_info("Planted return probe at %s: %p\n",
 			my_kretprobe.kp.symbol_name, my_kretprobe.kp.addr);
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/4] docs, kprobes: Remove invalid URL and add new reference
  2021-10-26  1:51 [PATCH v2 0/4] Do some changes about kprobe and trace Tiezhu Yang
  2021-10-26  1:51 ` [PATCH v2 1/4] samples/kretprobes: Fix return value if register_kretprobe() failed Tiezhu Yang
@ 2021-10-26  1:51 ` Tiezhu Yang
  2021-10-26  1:51 ` [PATCH v2 3/4] test_kprobes: Move it from kernel/ to lib/ Tiezhu Yang
  2021-10-26  1:51 ` [PATCH v2 4/4] MAINTAINERS: Update KPROBES and TRACING entries Tiezhu Yang
  3 siblings, 0 replies; 7+ messages in thread
From: Tiezhu Yang @ 2021-10-26  1:51 UTC (permalink / raw)
  To: naveen.n.rao, anil.s.keshavamurthy, davem, mhiramat, rostedt,
	mingo, corbet
  Cc: akpm, linux-doc, linux-kernel

The following reference is invalid, remove it.
https://www.ibm.com/developerworks/library/l-kprobes/index.html

Add the following new reference "An introduction to KProbes":
https://lwn.net/Articles/132196/

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 Documentation/trace/kprobes.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/trace/kprobes.rst b/Documentation/trace/kprobes.rst
index 998149c..f318bce 100644
--- a/Documentation/trace/kprobes.rst
+++ b/Documentation/trace/kprobes.rst
@@ -784,6 +784,6 @@ References
 
 For additional information on Kprobes, refer to the following URLs:
 
-- https://www.ibm.com/developerworks/library/l-kprobes/index.html
+- https://lwn.net/Articles/132196/
 - https://www.kernel.org/doc/ols/2006/ols2006v2-pages-109-124.pdf
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 3/4] test_kprobes: Move it from kernel/ to lib/
  2021-10-26  1:51 [PATCH v2 0/4] Do some changes about kprobe and trace Tiezhu Yang
  2021-10-26  1:51 ` [PATCH v2 1/4] samples/kretprobes: Fix return value if register_kretprobe() failed Tiezhu Yang
  2021-10-26  1:51 ` [PATCH v2 2/4] docs, kprobes: Remove invalid URL and add new reference Tiezhu Yang
@ 2021-10-26  1:51 ` Tiezhu Yang
  2021-10-26  1:51 ` [PATCH v2 4/4] MAINTAINERS: Update KPROBES and TRACING entries Tiezhu Yang
  3 siblings, 0 replies; 7+ messages in thread
From: Tiezhu Yang @ 2021-10-26  1:51 UTC (permalink / raw)
  To: naveen.n.rao, anil.s.keshavamurthy, davem, mhiramat, rostedt,
	mingo, corbet
  Cc: akpm, linux-doc, linux-kernel

Since config KPROBES_SANITY_TEST is in lib/Kconfig.debug, it is better to
let test_kprobes.c in lib/, just like other similar tests found in lib/.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 kernel/Makefile                | 1 -
 lib/Makefile                   | 1 +
 {kernel => lib}/test_kprobes.c | 0
 3 files changed, 1 insertion(+), 1 deletion(-)
 rename {kernel => lib}/test_kprobes.c (100%)

diff --git a/kernel/Makefile b/kernel/Makefile
index 4df609b..9e4d33d 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -85,7 +85,6 @@ obj-$(CONFIG_PID_NS) += pid_namespace.o
 obj-$(CONFIG_IKCONFIG) += configs.o
 obj-$(CONFIG_IKHEADERS) += kheaders.o
 obj-$(CONFIG_SMP) += stop_machine.o
-obj-$(CONFIG_KPROBES_SANITY_TEST) += test_kprobes.o
 obj-$(CONFIG_AUDIT) += audit.o auditfilter.o
 obj-$(CONFIG_AUDITSYSCALL) += auditsc.o audit_watch.o audit_fsnotify.o audit_tree.o
 obj-$(CONFIG_GCOV_KERNEL) += gcov/
diff --git a/lib/Makefile b/lib/Makefile
index 5efd1b4..864ff51 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -100,6 +100,7 @@ obj-$(CONFIG_TEST_MEMINIT) += test_meminit.o
 obj-$(CONFIG_TEST_LOCKUP) += test_lockup.o
 obj-$(CONFIG_TEST_HMM) += test_hmm.o
 obj-$(CONFIG_TEST_FREE_PAGES) += test_free_pages.o
+obj-$(CONFIG_KPROBES_SANITY_TEST) += test_kprobes.o
 
 #
 # CFLAGS for compiling floating point code inside the kernel. x86/Makefile turns
diff --git a/kernel/test_kprobes.c b/lib/test_kprobes.c
similarity index 100%
rename from kernel/test_kprobes.c
rename to lib/test_kprobes.c
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 4/4] MAINTAINERS: Update KPROBES and TRACING entries
  2021-10-26  1:51 [PATCH v2 0/4] Do some changes about kprobe and trace Tiezhu Yang
                   ` (2 preceding siblings ...)
  2021-10-26  1:51 ` [PATCH v2 3/4] test_kprobes: Move it from kernel/ to lib/ Tiezhu Yang
@ 2021-10-26  1:51 ` Tiezhu Yang
  2021-10-26  8:28   ` Masami Hiramatsu
  3 siblings, 1 reply; 7+ messages in thread
From: Tiezhu Yang @ 2021-10-26  1:51 UTC (permalink / raw)
  To: naveen.n.rao, anil.s.keshavamurthy, davem, mhiramat, rostedt,
	mingo, corbet
  Cc: akpm, linux-doc, linux-kernel

There is no git tree for KPROBES in MAINTAINERS, it is not convinent to
rebase, lib/test_kprobes.c and samples/kprobes belong to kprobe, so add
git tree and missing files for KPROBES, and also use linux-trace.git for
TRACING to avoid confusing.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 MAINTAINERS | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 5b33791..8d26693 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10437,10 +10437,13 @@ M:	Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
 M:	"David S. Miller" <davem@davemloft.net>
 M:	Masami Hiramatsu <mhiramat@kernel.org>
 S:	Maintained
+T:	git git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
 F:	Documentation/trace/kprobes.rst
 F:	include/asm-generic/kprobes.h
 F:	include/linux/kprobes.h
 F:	kernel/kprobes.c
+F:	lib/test_kprobes.c
+F:	samples/kprobes
 
 KS0108 LCD CONTROLLER DRIVER
 M:	Miguel Ojeda <ojeda@kernel.org>
@@ -18967,7 +18970,7 @@ TRACING
 M:	Steven Rostedt <rostedt@goodmis.org>
 M:	Ingo Molnar <mingo@redhat.com>
 S:	Maintained
-T:	git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core
+T:	git git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
 F:	Documentation/trace/ftrace.rst
 F:	arch/*/*/*/ftrace.h
 F:	arch/*/kernel/ftrace.c
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 4/4] MAINTAINERS: Update KPROBES and TRACING entries
  2021-10-26  1:51 ` [PATCH v2 4/4] MAINTAINERS: Update KPROBES and TRACING entries Tiezhu Yang
@ 2021-10-26  8:28   ` Masami Hiramatsu
  2021-10-26 13:04     ` Steven Rostedt
  0 siblings, 1 reply; 7+ messages in thread
From: Masami Hiramatsu @ 2021-10-26  8:28 UTC (permalink / raw)
  To: Tiezhu Yang
  Cc: naveen.n.rao, anil.s.keshavamurthy, davem, rostedt, mingo,
	corbet, akpm, linux-doc, linux-kernel

On Tue, 26 Oct 2021 09:51:31 +0800
Tiezhu Yang <yangtiezhu@loongson.cn> wrote:

> There is no git tree for KPROBES in MAINTAINERS, it is not convinent to
> rebase, lib/test_kprobes.c and samples/kprobes belong to kprobe, so add
> git tree and missing files for KPROBES, and also use linux-trace.git for
> TRACING to avoid confusing.
> 
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>

This looks good to me for kprobe section.

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

Thank you,

> ---
>  MAINTAINERS | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 5b33791..8d26693 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -10437,10 +10437,13 @@ M:	Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
>  M:	"David S. Miller" <davem@davemloft.net>
>  M:	Masami Hiramatsu <mhiramat@kernel.org>
>  S:	Maintained
> +T:	git git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
>  F:	Documentation/trace/kprobes.rst
>  F:	include/asm-generic/kprobes.h
>  F:	include/linux/kprobes.h
>  F:	kernel/kprobes.c
> +F:	lib/test_kprobes.c
> +F:	samples/kprobes
>  
>  KS0108 LCD CONTROLLER DRIVER
>  M:	Miguel Ojeda <ojeda@kernel.org>
> @@ -18967,7 +18970,7 @@ TRACING
>  M:	Steven Rostedt <rostedt@goodmis.org>
>  M:	Ingo Molnar <mingo@redhat.com>
>  S:	Maintained
> -T:	git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core
> +T:	git git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
>  F:	Documentation/trace/ftrace.rst
>  F:	arch/*/*/*/ftrace.h
>  F:	arch/*/kernel/ftrace.c
> -- 
> 2.1.0
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 4/4] MAINTAINERS: Update KPROBES and TRACING entries
  2021-10-26  8:28   ` Masami Hiramatsu
@ 2021-10-26 13:04     ` Steven Rostedt
  0 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2021-10-26 13:04 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: Tiezhu Yang, naveen.n.rao, anil.s.keshavamurthy, davem, mingo,
	corbet, akpm, linux-doc, linux-kernel

On Tue, 26 Oct 2021 17:28:42 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:

> This looks good to me for kprobe section.
> 
> Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

Thanks, I'll pull this into my queue.


-- Steve

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-10-26 13:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26  1:51 [PATCH v2 0/4] Do some changes about kprobe and trace Tiezhu Yang
2021-10-26  1:51 ` [PATCH v2 1/4] samples/kretprobes: Fix return value if register_kretprobe() failed Tiezhu Yang
2021-10-26  1:51 ` [PATCH v2 2/4] docs, kprobes: Remove invalid URL and add new reference Tiezhu Yang
2021-10-26  1:51 ` [PATCH v2 3/4] test_kprobes: Move it from kernel/ to lib/ Tiezhu Yang
2021-10-26  1:51 ` [PATCH v2 4/4] MAINTAINERS: Update KPROBES and TRACING entries Tiezhu Yang
2021-10-26  8:28   ` Masami Hiramatsu
2021-10-26 13:04     ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).