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: <20240216174101.57c4e61a0d6b4ed21c2a22bd@kernel.org>
Date: Fri, 16 Feb 2024 17:41:01 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Alexei Starovoitov <alexei.starovoitov@...il.com>, Florent Revest
 <revest@...omium.org>, linux-trace-kernel@...r.kernel.org, LKML
 <linux-kernel@...r.kernel.org>, Martin KaFai Lau <martin.lau@...ux.dev>,
 bpf <bpf@...r.kernel.org>, Sven Schnelle <svens@...ux.ibm.com>, Alexei
 Starovoitov <ast@...nel.org>, Jiri Olsa <jolsa@...nel.org>, Arnaldo
 Carvalho de Melo <acme@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
 Alan Maguire <alan.maguire@...cle.com>, Mark Rutland
 <mark.rutland@....com>, Peter Zijlstra <peterz@...radead.org>, Thomas
 Gleixner <tglx@...utronix.de>, Guo Ren <guoren@...nel.org>
Subject: Re: [PATCH v7 21/36] function_graph: Add selftest for passing local
 variables

On Thu, 15 Feb 2024 10:02:54 -0500
Steven Rostedt <rostedt@...dmis.org> wrote:

> On Wed,  7 Feb 2024 00:11:22 +0900
> "Masami Hiramatsu (Google)" <mhiramat@...nel.org> wrote:
> 
> > From: Steven Rostedt (VMware) <rostedt@...dmis.org>
> > 
> > Add boot up selftest that passes variables from a function entry to a
> > function exit, and make sure that they do get passed around.
> > 
> > Signed-off-by: Steven Rostedt (VMware) <rostedt@...dmis.org>
> > Signed-off-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>
> > ---
> >  Changes in v2:
> >   - Add reserved size test.
> >   - Use pr_*() instead of printk(KERN_*).
> > ---
> >  kernel/trace/trace_selftest.c |  169 +++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 169 insertions(+)
> > 
> > diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
> > index f0758afa2f7d..4d86cd4c8c8c 100644
> > --- a/kernel/trace/trace_selftest.c
> > +++ b/kernel/trace/trace_selftest.c
> > @@ -756,6 +756,173 @@ trace_selftest_startup_function(struct tracer *trace, struct trace_array *tr)
> >  
> >  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> >  
> > +#ifdef CONFIG_DYNAMIC_FTRACE
> > +
> > +#define BYTE_NUMBER 123
> > +#define SHORT_NUMBER 12345
> > +#define WORD_NUMBER 1234567890
> > +#define LONG_NUMBER 1234567890123456789LL
> > +
> > +static int fgraph_store_size __initdata;
> > +static const char *fgraph_store_type_name __initdata;
> > +static char *fgraph_error_str __initdata;
> > +static char fgraph_error_str_buf[128] __initdata;
> > +
> > +static __init int store_entry(struct ftrace_graph_ent *trace,
> > +			      struct fgraph_ops *gops)
> > +{
> > +	const char *type = fgraph_store_type_name;
> > +	int size = fgraph_store_size;
> > +	void *p;
> > +
> > +	p = fgraph_reserve_data(gops->idx, size);
> > +	if (!p) {
> > +		snprintf(fgraph_error_str_buf, sizeof(fgraph_error_str_buf),
> > +			 "Failed to reserve %s\n", type);
> > +		fgraph_error_str = fgraph_error_str_buf;
> > +		return 0;
> > +	}
> > +
> > +	switch (fgraph_store_size) {
> > +	case 1:
> > +		*(char *)p = BYTE_NUMBER;
> > +		break;
> > +	case 2:
> > +		*(short *)p = SHORT_NUMBER;
> > +		break;
> > +	case 4:
> > +		*(int *)p = WORD_NUMBER;
> > +		break;
> > +	case 8:
> > +		*(long long *)p = LONG_NUMBER;
> > +		break;
> > +	}
> > +
> 
> What would be an interesting test is to run all versions together. That is,
> to attach a callback that stores a byte, a callback that stores a short, a
> callback that stores a word and a callback that stores a long, and attach
> them all to the same function.
> 
> I guess we can add that as a separate patch.

Would you mean we should have different callbacks which stores the different
size of data instead of using switch()?

Thank you,

> 
> -- Steve
> 
> 
> > +	return 1;
> > +}
> > +


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ