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] [day] [month] [year] [list]
Date:   Thu, 27 Oct 2022 00:42:34 +0900
From:   Masami Hiramatsu (Google) <mhiramat@...nel.org>
To:     "Masami Hiramatsu (Google)" <mhiramat@...nel.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Linux Trace Kernel <linux-trace-kernel@...r.kernel.org>,
        Primiano Tucci <primiano@...gle.com>
Subject: Re: [PATCH 1/2] tracing/probes: Add symstr type for dynamic events

On Sat, 22 Oct 2022 15:38:50 +0900
"Masami Hiramatsu (Google)" <mhiramat@...nel.org> wrote:

> From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
> 
> Add 'symstr' type for storing the kernel symbol as a string data
> instead of the symbol address. This allows us to filter the
> events by wildcard symbol name.
> 
> e.g.
>   # echo 'e:wqfunc workqueue.workqueue_execute_start symname=$function:symstr' >> dynamic_events
>   # cat events/eprobes/wqfunc/format
>   name: wqfunc
>   ID: 2110
>   format:
>   	field:unsigned short common_type;	offset:0;	size:2;	signed:0;
>   	field:unsigned char common_flags;	offset:2;	size:1;	signed:0;
>   	field:unsigned char common_preempt_count;	offset:3;	size:1;	signed:0;
>   	field:int common_pid;	offset:4;	size:4;	signed:1;
> 
>   	field:__data_loc char[] symname;	offset:8;	size:4;	signed:1;
> 
>   print fmt: " symname=\"%s\"", __get_str(symname)
> 
> Note that there is already 'symbol' type which just change the
> print format (so it still stores the symbol address in the tracing
> ring buffer.) On the other hand, 'symstr' type stores the actual
> "symbol+offset/size" data as a string.
> 
> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>
> ---
[...]
> diff --git a/kernel/trace/trace_probe_tmpl.h b/kernel/trace/trace_probe_tmpl.h
> index b3bdb8ddb862..d57a3143929a 100644
> --- a/kernel/trace/trace_probe_tmpl.h
> +++ b/kernel/trace/trace_probe_tmpl.h
> @@ -67,6 +67,37 @@ probe_mem_read(void *dest, void *src, size_t size);
>  static nokprobe_inline int
>  probe_mem_read_user(void *dest, void *src, size_t size);
>  
> +static nokprobe_inline int
> +fetch_store_symstrlen(unsigned long addr)
> +{
> +	char namebuf[KSYM_SYMBOL_LEN];
> +	int ret;
> +
> +	ret = sprint_symbol(namebuf, addr);
> +	if (ret < 0)
> +		return 0;
> +
> +	return strlen(namebuf) + 1;

Ah, sprint_symbol() returns the length. This strlen() is redundant.
Let me update the patch.

Thank you,


-- 
Masami Hiramatsu (Google) <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ