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-next>] [day] [month] [year] [list]
Message-ID: <1426859534-27511-1-git-send-email-yunlong.song@huawei.com>
Date:	Fri, 20 Mar 2015 21:52:14 +0800
From:	Yunlong Song <yunlong.song@...wei.com>
To:	<a.p.zijlstra@...llo.nl>, <paulus@...ba.org>, <mingo@...hat.com>,
	<acme@...nel.org>
CC:	<linux-kernel@...r.kernel.org>, <wangnan0@...wei.com>
Subject: [PATCH] perf annotate: Fix the segmentation fault bug of perf annotate

There is a segmentation fault bug in 'perf annotate' using the perf.data
created by 'perf record -g', so fix it.

Example:

 $ perf record -g ls

Before this patch:

 $ perf annotate
 Segmentation fault

After this patch:

 $ perf annotate
  Percent |      Source code & Disassembly of kcore for cycles
 -------------------------------------------------------------
          :
          :
          :
          :      Disassembly of section load0:
          :
          :      ffffffff8103efc0 <load0>:
     0.00 :        ffffffff8103efc0:       mov    %esi,%eax
     0.00 :        ffffffff8103efc2:       mov    %edi,%ecx
     0.00 :        ffffffff8103efc4:       wrmsr
   100.00 :        ffffffff8103efc6:       xor    %eax,%eax
     0.00 :        ffffffff8103efc8:       retq
  Percent |      Source code & Disassembly of kcore for cycles
 -------------------------------------------------------------
 ...

Signed-off-by: Yunlong Song <yunlong.song@...wei.com>
---
 tools/perf/util/annotate.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 61bf912..0f9ebad 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -30,6 +30,9 @@ static int disasm_line__parse(char *line, char **namep, char **rawp);
 
 static void ins__delete(struct ins_operands *ops)
 {
+	if (ops == NULL)
+		return;
+
 	zfree(&ops->source.raw);
 	zfree(&ops->source.name);
 	zfree(&ops->target.raw);
@@ -211,7 +214,11 @@ static int lock__scnprintf(struct ins *ins, char *bf, size_t size,
 
 static void lock__delete(struct ins_operands *ops)
 {
-	struct ins *ins = ops->locked.ins;
+	struct ins *ins;
+
+	if (ops == NULL)
+		return;
+	ins = ops->locked.ins;
 
 	if (ins && ins->ops->free)
 		ins->ops->free(ops->locked.ops);
-- 
1.8.5.2

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