Skip to contentSkip to conversation

kprobes: a couple of trivial changes

PATCH In review Naveen N. Rao 3 participants 7 messages Mar 8, 2017 – Mar 15, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover kprobes: a couple of trivial changes

Two trivial fixes for kprobes:
- one, to document NOKPROBE_SYMBOL() in kprobe tracer doc
- two, change __kprobes to NOKPROBE_SYMBOL() for kprobe_exceptions_notify()

I noticed the latter while making this change for arch/powerpc.

- Naveen

Naveen N. Rao (2):
doc: trace/kprobes: add information about NOKPROBE_SYMBOL
kprobes: Convert kprobe_exceptions_notify to use NOKPROBE_SYMBOL

 Documentation/trace/kprobetrace.txt | 5 +++--
 kernel/kprobes.c                    | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)
Signature · 1 line
2.11.1
#1 lore raw

PATCH 1/2 doc: trace/kprobes: add information about NOKPROBE_SYMBOL

Update kprobe tracer documentation to also mention that NOKPROBE_SYMBOL() and nokprobe_inline add symbols to the kprobes blacklist.

---
 Documentation/trace/kprobetrace.txt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Documentation/trace/kprobetrace.txt +3 -2
index 41ef9d8efe95..5ea85059db3b 100644
@@ -8,8 +8,9 @@ Overview
 --------
 These events are similar to tracepoint based events. Instead of Tracepoint,
 this is based on kprobes (kprobe and kretprobe). So it can probe wherever
-kprobes can probe (this means, all functions body except for __kprobes
-functions). Unlike the Tracepoint based event, this can be added and removed
+kprobes can probe (this means, all functions except those with
+__kprobes/nokprobe_inline annotation and those marked NOKPROBE_SYMBOL).
+Unlike the Tracepoint based event, this can be added and removed
 dynamically, on the fly.
 
 To enable this feature, build your kernel with CONFIG_KPROBE_EVENTS=y.
Signature · 1 line
2.11.1
maintainer Acked-by on v1 1/2
#2 lore raw

Re: [TRIVIAL PATCH 1/2] doc: trace/kprobes: add information about NOKPROBE_SYMBOL

Quoted 3 lines · On Wed, 8 Mar 2017 22:34:14 +0530 "Naveen N. Rao"…

Update kprobe tracer documentation to also mention that NOKPROBE_SYMBOL() and nokprobe_inline add symbols to the kprobes blacklist.

Thanks for update!

Quoted 25 lines
---
 Documentation/trace/kprobetrace.txt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Documentation/trace/kprobetrace.txt +3 -2
index 41ef9d8efe95..5ea85059db3b 100644
@@ -8,8 +8,9 @@ Overview
 --------
 These events are similar to tracepoint based events. Instead of Tracepoint,
 this is based on kprobes (kprobe and kretprobe). So it can probe wherever
-kprobes can probe (this means, all functions body except for __kprobes
-functions). Unlike the Tracepoint based event, this can be added and removed
+kprobes can probe (this means, all functions except those with
+__kprobes/nokprobe_inline annotation and those marked NOKPROBE_SYMBOL).
+Unlike the Tracepoint based event, this can be added and removed
 dynamically, on the fly.
 
 To enable this feature, build your kernel with CONFIG_KPROBE_EVENTS=y.
Signature · 1 line
2.11.1
Signature · 1 line
Masami Hiramatsu <[email protected]>
#3 lore raw

[tip:perf/core] doc: trace/kprobes: add information about NOKPROBE_SYMBOL

In reply to Naveen N. Rao
doc: trace/kprobes: add information about NOKPROBE_SYMBOL
Commit-ID:  c1ac094d5061e757624a47217d2195ba24a75450
Gitweb:     http://git.kernel.org/tip/c1ac094d5061e757624a47217d2195ba24a75450
Author:     Naveen N. Rao <[email protected]>
AuthorDate: Wed, 8 Mar 2017 22:34:14 +0530
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 14 Mar 2017 15:17:40 -0300

doc: trace/kprobes: add information about NOKPROBE_SYMBOL

Update kprobe tracer documentation to also mention that NOKPROBE_SYMBOL() and nokprobe_inline add symbols to the kprobes blacklist.

---
 Documentation/trace/kprobetrace.txt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Documentation/trace/kprobetrace.txt +3 -2
index 41ef9d8..5ea8505 100644
@@ -8,8 +8,9 @@ Overview
 --------
 These events are similar to tracepoint based events. Instead of Tracepoint,
 this is based on kprobes (kprobe and kretprobe). So it can probe wherever
-kprobes can probe (this means, all functions body except for __kprobes
-functions). Unlike the Tracepoint based event, this can be added and removed
+kprobes can probe (this means, all functions except those with
+__kprobes/nokprobe_inline annotation and those marked NOKPROBE_SYMBOL).
+Unlike the Tracepoint based event, this can be added and removed
 dynamically, on the fly.
 
 To enable this feature, build your kernel with CONFIG_KPROBE_EVENTS=y.
#4 lore raw

PATCH 2/2 kprobes: Convert kprobe_exceptions_notify to use NOKPROBE_SYMBOL

In reply to Naveen N. Rao

commit fc62d0207ae0 ("kprobes: Introduce weak variant of kprobe_exceptions_notify()") used the __kprobes annotation to exclude kprobe_exceptions_notify from being probed. Since NOKPROBE_SYMBOL() is a better way to do this enabling the symbol to be discovered as being blacklisted, change over to using NOKPROBE_SYMBOL().

---
 kernel/kprobes.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/kprobes.c +3 -2
index 699c5bc51a92..b52d952d6d41 100644
@@ -1740,11 +1740,12 @@ void unregister_kprobes(struct kprobe **kps, int num)
 }
 EXPORT_SYMBOL_GPL(unregister_kprobes);
 
-int __weak __kprobes kprobe_exceptions_notify(struct notifier_block *self,
-					      unsigned long val, void *data)
+int __weak kprobe_exceptions_notify(struct notifier_block *self,
+					unsigned long val, void *data)
 {
 	return NOTIFY_DONE;
 }
+NOKPROBE_SYMBOL(kprobe_exceptions_notify);
 
 static struct notifier_block kprobe_exceptions_nb = {
 	.notifier_call = kprobe_exceptions_notify,
Signature · 1 line
2.11.1
maintainer Acked-by on v1 2/2
#5 lore raw

Re: [TRIVIAL PATCH 2/2] kprobes: Convert kprobe_exceptions_notify to use NOKPROBE_SYMBOL

Quoted 6 lines · On Wed, 8 Mar 2017 22:34:15 +0530 "Naveen N. Rao"…

commit fc62d0207ae0 ("kprobes: Introduce weak variant of kprobe_exceptions_notify()") used the __kprobes annotation to exclude kprobe_exceptions_notify from being probed. Since NOKPROBE_SYMBOL() is a better way to do this enabling the symbol to be discovered as being blacklisted, change over to using NOKPROBE_SYMBOL().

Oops, yes it should be.

Thanks,

Quoted 27 lines
---
 kernel/kprobes.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/kprobes.c +3 -2
index 699c5bc51a92..b52d952d6d41 100644
@@ -1740,11 +1740,12 @@ void unregister_kprobes(struct kprobe **kps, int num)
 }
 EXPORT_SYMBOL_GPL(unregister_kprobes);
 
-int __weak __kprobes kprobe_exceptions_notify(struct notifier_block *self,
-					      unsigned long val, void *data)
+int __weak kprobe_exceptions_notify(struct notifier_block *self,
+					unsigned long val, void *data)
 {
 	return NOTIFY_DONE;
 }
+NOKPROBE_SYMBOL(kprobe_exceptions_notify);
 
 static struct notifier_block kprobe_exceptions_nb = {
 	.notifier_call = kprobe_exceptions_notify,
Signature · 1 line
2.11.1
Signature · 1 line
Masami Hiramatsu <[email protected]>
#6 lore raw

[tip:perf/core] kprobes: Convert kprobe_exceptions_notify to use NOKPROBE_SYMBOL

In reply to Naveen N. Rao
kprobes: Convert kprobe_exceptions_notify to use NOKPROBE_SYMBOL
Commit-ID:  5f6bee34707973ea7879a7857fd63ddccc92fff3
Gitweb:     http://git.kernel.org/tip/5f6bee34707973ea7879a7857fd63ddccc92fff3
Author:     Naveen N. Rao <[email protected]>
AuthorDate: Wed, 8 Mar 2017 22:34:15 +0530
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 14 Mar 2017 15:17:40 -0300

kprobes: Convert kprobe_exceptions_notify to use NOKPROBE_SYMBOL

commit fc62d0207ae0 ("kprobes: Introduce weak variant of kprobe_exceptions_notify()") used the __kprobes annotation to exclude kprobe_exceptions_notify from being probed. Since NOKPROBE_SYMBOL() is a better way to do this enabling the symbol to be discovered as being blacklisted, change over to using NOKPROBE_SYMBOL().

---
 kernel/kprobes.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/kprobes.c +3 -2
index 448759d..4780ec23 100644
@@ -1740,11 +1740,12 @@ void unregister_kprobes(struct kprobe **kps, int num)
 }
 EXPORT_SYMBOL_GPL(unregister_kprobes);
 
-int __weak __kprobes kprobe_exceptions_notify(struct notifier_block *self,
-					      unsigned long val, void *data)
+int __weak kprobe_exceptions_notify(struct notifier_block *self,
+					unsigned long val, void *data)
 {
 	return NOTIFY_DONE;
 }
+NOKPROBE_SYMBOL(kprobe_exceptions_notify);
 
 static struct notifier_block kprobe_exceptions_nb = {
 	.notifier_call = kprobe_exceptions_notify,