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]
Date:   Fri, 16 Jun 2017 14:12:53 +0200
From:   Jiri Olsa <jolsa@...nel.org>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     He Kuang <hekuang@...wei.com>, lkml <linux-kernel@...r.kernel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Namhyung Kim <namhyung@...nel.org>,
        David Ahern <dsahern@...il.com>
Subject: [PATCH] perf unwind: Limit warnings when asked for not supported unwind

Ingo reported following warning flooding the report out:

  unwind: target platform=x86 is not supported

We trigger this warning when the dwarf unwinder is asked to
process architecture which wasn't compiled in, like when you
get 32bit application samples on your 64bit server and you
don't have the 32bit remote unwind support compiled in.

This patch limits the warning to single message for arch,
and adds bits info. Above message is changed to:

  unwind: target platform=x86 32bit is not supported

Cc: He Kuang <hekuang@...wei.com>
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
---
 tools/perf/util/unwind-libunwind.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
index 6d542a4e0648..1439a6bcfa07 100644
--- a/tools/perf/util/unwind-libunwind.c
+++ b/tools/perf/util/unwind-libunwind.c
@@ -1,12 +1,24 @@
+#include <linux/err.h>
 #include "unwind.h"
 #include "thread.h"
 #include "session.h"
 #include "debug.h"
 #include "arch/common.h"
 
-struct unwind_libunwind_ops __weak *local_unwind_libunwind_ops;
-struct unwind_libunwind_ops __weak *x86_32_unwind_libunwind_ops;
-struct unwind_libunwind_ops __weak *arm64_unwind_libunwind_ops;
+enum {
+	ERR_LOCAL  = 0,
+	ERR_X86_32 = 1,
+	ERR_ARM64  = 2,
+};
+
+/*
+ * Set default error values, so we can warn appropriately when
+ * the support is not compiled in. Using negative values so we
+ * can use ERR macros.
+ */
+struct unwind_libunwind_ops __weak *local_unwind_libunwind_ops  = (void *) -ERR_LOCAL;
+struct unwind_libunwind_ops __weak *x86_32_unwind_libunwind_ops = (void *) -ERR_X86_32;
+struct unwind_libunwind_ops __weak *arm64_unwind_libunwind_ops  = (void *) -ERR_ARM64;
 
 static void unwind__register_ops(struct thread *thread,
 			  struct unwind_libunwind_ops *ops)
@@ -48,8 +60,15 @@ int unwind__prepare_access(struct thread *thread, struct map *map,
 			ops = arm64_unwind_libunwind_ops;
 	}
 
-	if (!ops) {
-		pr_err("unwind: target platform=%s is not supported\n", arch);
+	if (IS_ERR(ops)) {
+		static unsigned long warned;
+		long bit = -PTR_ERR(ops);
+
+		if (!test_and_set_bit(bit, &warned)) {
+			pr_err("unwind: target platform=%s %dbit is not supported\n",
+				arch, dso_type == DSO__TYPE_64BIT ? 64 : 32);
+		}
+
 		return -1;
 	}
 out_register:
-- 
2.9.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ