From: Steven Rostedt <rostedt@goodmis.org>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: "Frédéric Weisbecker" <f.weisbecker@gmail.com>,
"Ingo Molnar" <mingo@elte.hu>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/3] tracing/filters: Support filtering for char * strings
Date: Thu, 6 Aug 2009 22:54:06 -0400 (EDT) [thread overview]
Message-ID: <alpine.DEB.2.00.0908062251230.2840@gandalf.stny.rr.com> (raw)
In-Reply-To: <4A7B8149.3070901@cn.fujitsu.com>
On Fri, 7 Aug 2009, Li Zefan wrote:
> >> if (is_string_field(field)) {
> >> + pred->str_len = field->size;
> >> +
> >> if (field->filter_type == FILTER_STATIC_STRING)
> >> fn = filter_pred_string;
> >> - else
> >> + else if (field->filter_type == FILTER_DYN_STRING)
> >> fn = filter_pred_strloc;
> >> - pred->str_len = field->size;
> >> + else {
> >> + fn = filter_pred_pchar;
> >> + pred->str_len = strlen(pred->str_val);
> >> + }
> >
> > I'm a little dense here, where do we protect against someone making a
> > tracepoint that points to unsafe data?
> >
>
> We can't prevent anyone from doing insane things deliberately, but
> we prevent from doing wrong things unconsciously.
>
> Only if a TRACE_EVENT has a field defined as:
>
> __field_ext(char *, name, FILTER_PTR_STR)
>
> Here using FILTER_PTR_STR explicitly, he should know what he's doing.
>
> Anyway, he can make a ptr pointing to unsafe data this way:
>
> TP_STRUCT__entry(
> __field(char *, name)
> )
> TP_printk("%s", name)
I guess the thing I'm missing is what's the difference of the two? Why
would a developer use __field_ext instead of doing it the unsafe way of
just __field?
I guess I don't see the developer doing something wrong unconsciously.
Well maybe I don't see this making the developer do it right
unconsciously.
What protection is this giving us?
-- Steve
next prev parent reply other threads:[~2009-08-07 2:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-06 6:05 [PATCH 0/3] tracing/filters: Support specifying filter hook to a TRACE_EVENT field Li Zefan
2009-08-06 6:06 ` [PATCH 1/3] tracing/filters: Add filter_type to struct ftrace_event_field Li Zefan
2009-08-06 6:06 ` [PATCH 2/3] tracing/filters: Add __field_ext() to TRACE_EVENT Li Zefan
2009-08-06 14:17 ` Steven Rostedt
2009-08-06 6:06 ` [PATCH 3/3] tracing/filters: Support filtering for char * strings Li Zefan
2009-08-06 14:21 ` Steven Rostedt
2009-08-07 1:20 ` Li Zefan
2009-08-07 2:54 ` Steven Rostedt [this message]
2009-08-07 3:12 ` Li Zefan
2009-08-07 3:22 ` Steven Rostedt
2009-08-07 3:24 ` Li Zefan
2009-08-07 3:31 ` Steven Rostedt
2009-08-06 14:23 ` [PATCH 0/3] tracing/filters: Support specifying filter hook to a TRACE_EVENT field Steven Rostedt
2009-08-07 1:08 ` Li Zefan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.00.0908062251230.2840@gandalf.stny.rr.com \
--to=rostedt@goodmis.org \
--cc=f.weisbecker@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=mingo@elte.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®