Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1186771 > unrolled thread

Re: [PATCH tip/master 1/3] kprobes: Support blacklist functions in module

Started byIngo Molnar <mingo@kernel.org>
First post2015-07-17 14:20 +0200
Last post2015-07-19 05:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH tip/master 1/3] kprobes: Support blacklist functions in  module Ingo Molnar <mingo@kernel.org> - 2015-07-17 14:20 +0200
    Re: [PATCH tip/master 1/3] kprobes: Support blacklist functions in  module Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-07-19 05:20 +0200

#1186771 — Re: [PATCH tip/master 1/3] kprobes: Support blacklist functions in module

FromIngo Molnar <mingo@kernel.org>
Date2015-07-17 14:20 +0200
SubjectRe: [PATCH tip/master 1/3] kprobes: Support blacklist functions in module
Message-ID<pNcMq-59N-19@gated-at.bofh.it>
* Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> wrote:

> To blacklist the functions in a module (e.g. user-defined
> kprobe handler and the functions invoked from it), expand
> blacklist support for modules.
> With this change, users can use NOKPROBE_SYMBOL() macro in
> their own modules.

Btw., whatever happened with renaming '__kprobes' to '__nokprobe' and using that 
consistently to blacklist certain functions?

Also, shouldn't we convert such instances:

	static int notifier_call_chain(struct notifier_block **nl,
                               unsigned long val, void *v,
                               int nr_to_call, int *nr_calls)

	...

	NOKPROBE_SYMBOL(notifier_call_chain);

to:

	static int __nokprobe notifier_call_chain(struct notifier_block **nl,
                               unsigned long val, void *v,
                               int nr_to_call, int *nr_calls)

?

I.e. instead of extending it to modules we should eliminate NOKPROBE_SYMBOL() in 
favor of marking functions as __nokprobe which is the standard syntax for marking 
functions.

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1187519

FromMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Date2015-07-19 05:20 +0200
Message-ID<pNNiW-79Q-1@gated-at.bofh.it>
In reply to#1186771
On 2015/07/17 21:10, Ingo Molnar wrote:
> 
> * Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> wrote:
> 
>> To blacklist the functions in a module (e.g. user-defined
>> kprobe handler and the functions invoked from it), expand
>> blacklist support for modules.
>> With this change, users can use NOKPROBE_SYMBOL() macro in
>> their own modules.
> 
> Btw., whatever happened with renaming '__kprobes' to '__nokprobe' and using that 
> consistently to blacklist certain functions?

Yes, in this part, __kprobes marked functions placed in .kprobes.text section
are safely added to the blacklist :)

-----
+       if (err >= 0 && __kprobes_text_start != __kprobes_text_end) {
+               /* The __kprobes marked functions must not be probed */
+               err = kprobe_blacklist_add_range(
+                                       (unsigned long)__kprobes_text_start,
+                                       (unsigned long)__kprobes_text_end);
+       }
-----


> 
> Also, shouldn't we convert such instances:
> 
> 	static int notifier_call_chain(struct notifier_block **nl,
>                                unsigned long val, void *v,
>                                int nr_to_call, int *nr_calls)
> 
> 	...
> 
> 	NOKPROBE_SYMBOL(notifier_call_chain);
> 
> to:
> 
> 	static int __nokprobe notifier_call_chain(struct notifier_block **nl,
>                                unsigned long val, void *v,
>                                int nr_to_call, int *nr_calls)
> 
> ?

For some symbols we can do that. But it can conflict with other __section
attributes e.g. __sched, since a function must be placed in only one
section. So, IMHO, using section for expressing its attribute is not
a good idea, but I couldn't find another option in common function attribute.

https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes

Thus I've introduced NOKPROBE_SYMBOL macro which stores the target function
addresses (not the function itself) in the _kprobe_blacklist section.

Thank you,

> 
> I.e. instead of extending it to modules we should eliminate NOKPROBE_SYMBOL() in 
> favor of marking functions as __nokprobe which is the standard syntax for marking 
> functions.
> 
> Thanks,
> 
> 	Ingo
> 


-- 
Masami HIRAMATSU
Linux Technology Research Center, System Productivity Research Dept.
Center for Technology Innovation - Systems Engineering
Hitachi, Ltd., Research & Development Group
E-mail: masami.hiramatsu.pt@hitachi.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web