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, 07 Dec 2011 10:37:15 +0900
From:	Hidetoshi Seto <seto.hidetoshi@...fujitsu.com>
To:	linux-kernel@...r.kernel.org
CC:	linux-btrfs@...r.kernel.org,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Paul Mackerras <paulus@...ba.org>, Ingo Molnar <mingo@...e.hu>,
	Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Subject: [PATCH 2/3] perf: allow processing single op args

I got following error from record with btrfs tracepoints:

  $ perf script
  Fatal: unknown op '-'

It seems that perf failed to handle '-' in the following format:

  print fmt: "%s", ((REC->id >= -9) || (REC->id <= 7)) ? "x" : "y"
                                ~
process_arg() have code to parse '-9' as a "single op" arg, which is
PRINT_OP as type, '-' as op and have '9' as right arg but no left arg.
However arg_num_eval() have no code to handle this "single op" arg
even it is parsed successfully.

This patch allow perf to process such "single op" args.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@...fujitsu.com>
---
 tools/perf/util/trace-event-parse.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index c2adc76..b709f78 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -1355,6 +1355,24 @@ static long long arg_num_eval(struct print_arg *arg)
 		val = arg_num_eval(arg->typecast.item);
 		break;
 	case PRINT_OP:
+		if (!arg->op.left || arg->op.left->type == PRINT_NULL) {
+			/* handle single op */
+			right = arg_num_eval(arg->op.right);
+			switch (arg->op.op[0]) {
+			case '!':
+				val = !right;
+				break;
+			case '+':
+				val = right;
+				break;
+			case '-':
+				val = -right;
+				break;
+			default:
+				die("unknown single op %s", arg->op.op);
+			}
+			break;
+		}
 		switch (arg->op.op[0]) {
 		case '|':
 			left = arg_num_eval(arg->op.left);
-- 
1.7.7.3


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