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]
Date:	Fri, 7 May 2010 11:30:35 -0400
From:	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	Frederic Weisbecker <fweisbec@...il.com>,
	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Peter Zijlstra <peterz@...radead.org>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Lai Jiangshan <laijs@...fujitsu.com>,
	Li Zefan <lizf@...fujitsu.com>,
	Masami Hiramatsu <mhiramat@...hat.com>,
	Christoph Hellwig <hch@....de>
Subject: Re: [PATCH 2/9 - v2][RFC] tracing: Let tracepoints have
	data?passed to tracepoint callbacks

* Steven Rostedt (rostedt@...dmis.org) wrote:
> On Fri, 2010-05-07 at 11:08 -0400, Mathieu Desnoyers wrote:
> 
> > > > Can you show me where the C standard says it is safe to do so ?
> > > 
> > > No, but it seems safe in the kernel ;-)
> > 
> > The use of "seems" here does not give me a warm feeling of safety. ;)
> 
> Right, which is why I added the below.
> 
> > 
> > > 
> > > But that said. There is another option that will conform to this, and
> > > that is to add flags to registering tracepoints. I already wrote a patch
> > > for this in trying to do some other work (that I threw away).
> > > 
> > > 
> > > So here's the proposal.
> > > 
> > > Change struct tracepoint_func to...
> > > 
> > > struct tracepoint_func {
> > > 	void *func;
> > > 	void *data;
> > > 	unsigned int flags;
> > > };
> > > 
> > > 
> > > The flags is set when registered. If a function is registered with data,
> > > then the flags field will be set. Then the calling of the function can
> > > be:
> > > 
> > > 	if ((it_func_ptr)->flags & TP_FL_DATA)
> > > 		((void(*)(proto, void *))(it_func)(args, __data);
> > > 	else
> > > 		((void(*)(proto))(it_func)(args);
> > > 
> > > This would comply with the C standard.
> > 
> > This would also add a branch on the tracing fast path, which I would like to
> > avoid. Why can't we simply change all prototypes to take an extra void *__data
> > parameter instead ?
> 
> I'm fine with making the data parameter mandatory with all tracers. Thus
> the call back must require it. I would then move the data parameter from
> the end to the beginning.
> 
> So a tracepoint with proto, will have a callback:
> 
> 	void callback(void *data, proto);
> 
> I'm fine with forcing all callbacks to include a data parameter if you
> are. This would also make the changes simpler.

Yes, I am all for it.

As for the extra type checking, it is basically just trying to force you to
generate matching caller-callee prototypes in your CPP macros. The goal is
really to check that the data parameter type match in both the caller and
callee. I see that as a mean to make sure nobody is going to try to take
shortcuts by playing with the callback types in the "undefined behavior" zone of
the C standard in future TRACE_EVENT() modifications.

Thanks,

Mathieu

> 
> -- Steve
> 
> 

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ