lkml.org 
[lkml]   [2010]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[tip:tracing/urgent] tracing/filters: Fix MATCH_FULL filter matching for PTR_STRING
    Commit-ID:  16da27a8bc7a0d050686d1b2e9efb53fab9ed226
    Gitweb: http://git.kernel.org/tip/16da27a8bc7a0d050686d1b2e9efb53fab9ed226
    Author: Li Zefan <lizf@cn.fujitsu.com>
    AuthorDate: Thu, 14 Jan 2010 10:54:27 +0800
    Committer: Steven Rostedt <rostedt@goodmis.org>
    CommitDate: Thu, 14 Jan 2010 22:38:12 -0500

    tracing/filters: Fix MATCH_FULL filter matching for PTR_STRING

    MATCH_FULL matching for PTR_STRING is not working correctly:

    # echo 'func == vt' > events/bkl/lock_kernel/filter
    # echo 1 > events/bkl/lock_kernel/enable
    ...
    # cat trace
    Xorg-1484 [000] 1973.392586: lock_kernel: ... func=vt_ioctl()
    gpm-1402 [001] 1974.027740: lock_kernel: ... func=vt_ioctl()

    We should pass to regex.match(..., len) the length (including '\0')
    of the source string instead of the length of the pattern string.

    Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
    LKML-Reference: <4B4E8763.5070707@cn.fujitsu.com>
    Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    ---
    kernel/trace/trace_events_filter.c | 7 +++----
    1 files changed, 3 insertions(+), 4 deletions(-)

    diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
    index f364b08..60c2a4e 100644
    --- a/kernel/trace/trace_events_filter.c
    +++ b/kernel/trace/trace_events_filter.c
    @@ -211,8 +211,9 @@ static int filter_pred_pchar(struct filter_pred *pred, void *event,
    {
    char **addr = (char **)(event + pred->offset);
    int cmp, match;
    + int len = strlen(*addr) + 1; /* including tailing '\0' */

    - cmp = pred->regex.match(*addr, &pred->regex, pred->regex.field_len);
    + cmp = pred->regex.match(*addr, &pred->regex, len);

    match = cmp ^ pred->not;

    @@ -782,10 +783,8 @@ static int filter_add_pred(struct filter_parse_state *ps,
    pred->regex.field_len = field->size;
    } else if (field->filter_type == FILTER_DYN_STRING)
    fn = filter_pred_strloc;
    - else {
    + else
    fn = filter_pred_pchar;
    - pred->regex.field_len = strlen(pred->regex.pattern);
    - }
    } else {
    if (field->is_signed)
    ret = strict_strtoll(pred->regex.pattern, 0, &val);

    \
     
     \ /
      Last update: 2010-01-16 10:47    [W:0.027 / U:30.356 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site