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]
Message-ID: <20150407075226.GE23913@sejong>
Date:	Tue, 7 Apr 2015 16:52:26 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Ingo Molnar <mingo@...nel.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Jiri Olsa <jolsa@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>,
	David Ahern <dsahern@...il.com>,
	Minchan Kim <minchan@...nel.org>,
	Joonsoo Kim <js1304@...il.com>, linux-mm@...ck.org
Subject: Re: [PATCH 9/9] tools lib traceevent: Honor operator priority

Hi Steve,

On Mon, Apr 06, 2015 at 10:45:04AM -0400, Steven Rostedt wrote:
> On Mon,  6 Apr 2015 14:36:16 +0900
> Namhyung Kim <namhyung@...nel.org> wrote:
> 
> > Currently it ignores operator priority and just sets processed args as a
> > right operand.  But it could result in priority inversion in case that
> > the right operand is also a operator arg and its priority is lower.
> > 
> > For example, following print format is from new kmem events.
> > 
> >   "page=%p", REC->pfn != -1UL ? (((struct page *)(0xffffea0000000000UL)) + (REC->pfn)) : ((void *)0)
> > 
> > But this was treated as below:
> > 
> >   REC->pfn != ((null - 1UL) ? ((struct page *)0xffffea0000000000UL + REC->pfn) : (void *) 0)
> > 
> > In this case, the right arg was '?' operator which has lower priority.
> > But it just sets the whole arg so making the output confusing - page was
> > always 0 or 1 since that's the result of logical operation.
> > 
> > With this patch, it can handle it properly like following:
> > 
> >   ((REC->pfn != (null - 1UL)) ? ((struct page *)0xffffea0000000000UL + REC->pfn) : (void *) 0)
> 
> Nice catch. One nit.
> 
> > 
> > Cc: Steven Rostedt <rostedt@...dmis.org>
> > Signed-off-by: Namhyung Kim <namhyung@...nel.org>
> > ---
> >  tools/lib/traceevent/event-parse.c | 17 ++++++++++++++++-
> >  1 file changed, 16 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
> > index 6d31b6419d37..604bea5c3fb0 100644
> > --- a/tools/lib/traceevent/event-parse.c
> > +++ b/tools/lib/traceevent/event-parse.c
> > @@ -1939,7 +1939,22 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
> >  			goto out_warn_free;
> >  
> >  		type = process_arg_token(event, right, tok, type);
> > -		arg->op.right = right;
> > +
> > +		if (right->type == PRINT_OP &&
> > +		    get_op_prio(arg->op.op) < get_op_prio(right->op.op)) {
> > +			struct print_arg tmp;
> > +
> > +			/* swap ops according to the priority */
> 
> This isn't really a swap. Better term to use is "rotate".

You're right!

> 
> But other than that,
> 
> Acked-by: Steven Rostedt <rostedt@...dmis.org>

Thanks for the review
Namhyung


> 
> > +			arg->op.right = right->op.left;
> > +
> > +			tmp = *arg;
> > +			*arg = *right;
> > +			*right = tmp;
> > +
> > +			arg->op.left = right;
> > +		} else {
> > +			arg->op.right = right;
> > +		}
> >  
> >  	} else if (strcmp(token, "[") == 0) {
> >  
> 
> --
> 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/
--
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