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:	Wed, 16 Dec 2009 06:49:03 -0500
From:	Neil Horman <nhorman@...driver.com>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	linux-kernel@...r.kernel.org, fweisbec@...il.com, mingo@...hat.com,
	Mathieu Desnoyers <compudj@...stal.dyndns.org>,
	"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH] Fix tracing infrastructure to support multiple
	includes when defining CREATE_TRACE_POINTS

On Tue, Dec 15, 2009 at 11:13:49PM -0500, Steven Rostedt wrote:
> On Tue, 2009-12-15 at 11:08 -0500, Neil Horman wrote:
> 
> Hi Neil,
> 
> I was playing with this, and I got really nasty errors in the trace
> parsing tools. Then I noticed why:
> 
> > -DECLARE_TRACE(napi_poll,
> > +TRACE_EVENT(napi_poll,
> > +
> >  	TP_PROTO(struct napi_struct *napi),
> > -	TP_ARGS(napi));
> > +
> > +	TP_ARGS(napi),
> > +
> > +	TP_STRUCT__entry(
> > +		__field(        struct napi_struct *,	napi)
> > +        ),
> > +
> > +        TP_fast_assign(
> > +                __entry->napi = napi;
> > +        ),
> > +
> > +        TP_printk("napi poll on napi struct %p for device %s",
> > +		__entry->napi, __entry->napi->dev->name)
> 
> You can't trust this! That "__entry" happens to reside on the ring
> buffer. If for some reason the device goes away, this blows up when you
> read the trace.
> 
> If you need to save the name of the device, then store it in the ring
> buffer. You can do it with a dynamic array:
> 
> 	TP_STRUCT__entry(
> 		__field(	struct napi_struct *, napi)
> 		__string(	dev_name, napi->dev->name)
> 	),
> 
> 	TP_fast_assign(
> 		__entry->napi = napi;
> 		__assign_str(dev_name, napi->dev->name);
> 	),
> 
> 	TP_printk("napi poll on napi struct %p for device %s",
> 		__entry->napi, __get_string(dev_name))
> 
> -- Steve
> 
> > +);
> >  
> >  #endif
> 
> 
> 
Ok, thanks, I'll resubmit shortly.
Neil

--
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