[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081002094144.GA20569@elte.hu>
Date: Thu, 2 Oct 2008 11:41:44 +0200
From: Ingo Molnar <mingo@...e.hu>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Steven Rostedt <rostedt@...dmis.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
Jonathan Corbet <corbet@....net>,
Mathieu Desnoyers <compudj@...stal.dyndns.org>,
LKML <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
prasad@...ux.vnet.ibm.com, "Frank Ch. Eigler" <fche@...hat.com>,
David Wilder <dwilder@...ibm.com>, hch@....de,
Martin Bligh <mbligh@...gle.com>,
Christoph Hellwig <hch@...radead.org>,
Masami Hiramatsu <mhiramat@...hat.com>,
Steven Rostedt <srostedt@...hat.com>,
Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Subject: Re: [PATCH] ring_buffer: allocate buffer page pointer
* Andrew Morton <akpm@...ux-foundation.org> wrote:
> On Thu, 2 Oct 2008 10:50:30 +0200 Ingo Molnar <mingo@...e.hu> wrote:
>
> >
> > * Steven Rostedt <rostedt@...dmis.org> wrote:
> >
> > >
> > > The current method of overlaying the page frame as the buffer page pointer
> > > can be very dangerous and limits our ability to do other things with
> > > a page from the buffer, like send it off to disk.
> > >
> > > This patch allocates the buffer_page instead of overlaying the page's
> > > page frame. The use of the buffer_page has hardly changed due to this.
> > >
> > > Signed-off-by: Steven Rostedt <srostedt@...hat.com>
> > > ---
> > > kernel/trace/ring_buffer.c | 54 ++++++++++++++++++++++++++-------------------
> > > 1 file changed, 32 insertions(+), 22 deletions(-)
> >
> > applied to tip/tracing/ftrace, with the extended changlog below - i
> > think this commit warrants that extra mention.
> >
> > Ingo
> >
> > --------------->
> > >From da78331b4ced2763322d732ac5ba275965853bde Mon Sep 17 00:00:00 2001
> > From: Steven Rostedt <rostedt@...dmis.org>
> > Date: Wed, 1 Oct 2008 10:52:51 -0400
> > Subject: [PATCH] ftrace: type cast filter+verifier
> >
> > The mmiotrace map had a bug that would typecast the entry from
> > the trace to the wrong type. That is a known danger of C typecasts,
> > there's absolutely zero checking done on them.
> >
> > Help that problem a bit by using a GCC extension to implement a
> > type filter that restricts the types that a trace record can be
> > cast into, and by adding a dynamic check (in debug mode) to verify
> > the type of the entry.
> >
> > This patch adds a macro to assign all entries of ftrace using the type
> > of the variable and checking the entry id. The typecasts are now done
> > in the macro for only those types that it knows about, which should
> > be all the types that are allowed to be read from the tracer.
> >
>
> I'm somewhat at a loss here because I'm unable to find any version of
> kernel/trace/trace.c which looks anything like the one which is being
> patched, but...
it's in tip/tracing/ring-buffer (also tip/master), but we are still
working on it (i just triggered a crash with it) so i havent pushed it
out into the auto-ftrace-next branch yet.
> > --- a/kernel/trace/trace.c
> > +++ b/kernel/trace/trace.c
> > @@ -1350,7 +1350,9 @@ print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu)
> > }
> > switch (entry->type) {
> > case TRACE_FN: {
> > - struct ftrace_entry *field = (struct ftrace_entry *)entry;
>
> Why was this code using a cast in the first place? It should be using
> entry->some_field_i_dont_have_here? That was the whole point in using
> the anonymous union in struct trace_entry?
this whole mega-thread was about removing that union and turning the
tracer into a type-opaque entity. I warned about the inevitable
fragility - but with this type filter approach the risks should be
substantially lower.
Ingo
--
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