lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170622182953.e1959ce03145b8bb45ec55de@kernel.org>
Date:   Thu, 22 Jun 2017 18:29:53 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     "Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>
Cc:     Steven Rostedt <rostedt@...dmis.org>,
        Ananth N Mavinakayanahalli <ananth@...ux.vnet.ibm.com>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Michael Ellerman <mpe@...erman.id.au>,
        linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH 1/2] trace/kprobes: Sanitize derived event names

On Thu, 22 Jun 2017 00:20:27 +0530
"Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com> wrote:

> When we derive event names, convert some expected symbols (such as ':'
> used to specify module:name and '.' present in some symbols) into
> underscores so that the event name is not rejected.

Oops, ok, this is my mistake.

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

This must be marked as bugfix for stable trees.

Could you also add a testcase for this (module name) bug?

MODNAME=`lsmod | head -n 2 | tail -n 1 | cut -f 1 -d " "`
FUNCNAME=`grep -m 1 "\\[$MODNAME\\]" /proc/kallsyms | xargs | cut -f 3 -d " "`

May gives you a target name :)

Thank you,

> 
> Before this patch:
>     # echo 'p kobject_example:foo_store' > kprobe_events
>     trace_kprobe: Failed to allocate trace_probe.(-22)
>     -sh: write error: Invalid argument
> 
> After this patch:
>     # echo 'p kobject_example:foo_store' > kprobe_events
>     # cat kprobe_events
>     p:kprobes/p_kobject_example_foo_store_0 kobject_example:foo_store
> 
> Signed-off-by: Naveen N. Rao <naveen.n.rao@...ux.vnet.ibm.com>
> ---
>  kernel/trace/trace_kprobe.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
> index c129fca6ec99..44fd819aa33d 100644
> --- a/kernel/trace/trace_kprobe.c
> +++ b/kernel/trace/trace_kprobe.c
> @@ -598,6 +598,14 @@ static struct notifier_block trace_kprobe_module_nb = {
>  	.priority = 1	/* Invoked after kprobe module callback */
>  };
>  
> +/* Convert certain expected symbols into '_' when generating event names */
> +static inline void sanitize_event_name(char *name)
> +{
> +	while (*name++ != '\0')
> +		if (*name == ':' || *name == '.')
> +			*name = '_';
> +}
> +
>  static int create_trace_kprobe(int argc, char **argv)
>  {
>  	/*
> @@ -740,6 +748,7 @@ static int create_trace_kprobe(int argc, char **argv)
>  		else
>  			snprintf(buf, MAX_EVENT_NAME_LEN, "%c_0x%p",
>  				 is_return ? 'r' : 'p', addr);
> +		sanitize_event_name(buf);
>  		event = buf;
>  	}
>  	tk = alloc_trace_kprobe(group, event, addr, symbol, offset, maxactive,
> -- 
> 2.13.1
> 


-- 
Masami Hiramatsu <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ