[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190316080556.3075-2-changbin.du@gmail.com>
Date: Sat, 16 Mar 2019 16:05:41 +0800
From: Changbin Du <changbin.du@...il.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>,
Jiri Olsa <jolsa@...nel.org>
Cc: namhyung@...nel.org, Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Alexei Starovoitov <ast@...nel.org>, rostedt@...dmis.org,
Daniel Borkmann <daniel@...earbox.net>, bpf@...r.kernel.org,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
Changbin Du <changbin.du@...il.com>
Subject: [PATCH 01/16] perf: add doc for how to build perf with Asan and UBSan
AddressSanitizer (or ASan) and UndefinedBehaviorSanitizer (or UBSan) are
very useful tools to detect program bugs.
o AddressSanitizer (or ASan) is a GCC feature that detects memory
corruption bugs such as buffer overflows or memory leaks.
o UndefinedBehaviorSanitizer (or UBSan) is a fast undefined behavior
detector supprted by GCC. UBSan detect undefined behavior of programs
at runtime.
This patch adds doc for how to use them on perf. Later patches will fix
some of the issues disclosed by them.
Signed-off-by: Changbin Du <changbin.du@...il.com>
---
tools/perf/Documentation/Build.txt | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/tools/perf/Documentation/Build.txt b/tools/perf/Documentation/Build.txt
index f6fc6507ba55..cae6e1d9b901 100644
--- a/tools/perf/Documentation/Build.txt
+++ b/tools/perf/Documentation/Build.txt
@@ -47,3 +47,23 @@ Those objects are then used in final linking:
NOTE this description is omitting other libraries involved, only
focusing on build framework outcomes
+
+3) buld and install perf
+ $ cd tools/perf
+ $ make DESTDIR=/usr
+ $ make DESTDIR=/usr install
+
+4) build with ASan or UBSan
+AddressSanitizer (or ASan) is a GCC feature that detects memory corruption bugs
+such as buffer overflows or memory leaks.
+ $ cd tools/perf
+ $ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=address'
+ $ ASAN_OPTIONS=log_path=asan.log ./perf record -a
+ASan outputs all detected issues into log file 'asan.log.<pid>'.
+
+UndefinedBehaviorSanitizer (or UBSan) is a fast undefined behavior detector
+supprted by GCC. UBSan detect undefined behavior of programs at runtime.
+ $ cd tools/perf
+ $ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=undefined'
+ $ UBSAN_OPTIONS=print_stacktrace=1 ./perf record -a
+If UBSan detects any problem at runtime, it outputs a “runtime error:” message.
\ No newline at end of file
--
2.19.1
Powered by blists - more mailing lists