summaryrefslogtreecommitdiff
path: root/lib/dfsan
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dfsan')
-rw-r--r--lib/dfsan/dfsan.cc17
-rw-r--r--lib/dfsan/dfsan.h7
-rw-r--r--lib/dfsan/dfsan_custom.cc7
-rw-r--r--lib/dfsan/dfsan_flags.inc11
-rw-r--r--lib/dfsan/dfsan_interceptors.cc7
-rw-r--r--lib/dfsan/dfsan_platform.h7
-rw-r--r--lib/dfsan/done_abilist.txt2
7 files changed, 33 insertions, 25 deletions
diff --git a/lib/dfsan/dfsan.cc b/lib/dfsan/dfsan.cc
index 585bdceac764..f4ba1148f782 100644
--- a/lib/dfsan/dfsan.cc
+++ b/lib/dfsan/dfsan.cc
@@ -1,9 +1,8 @@
//===-- dfsan.cc ----------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -163,6 +162,8 @@ static void dfsan_check_label(dfsan_label label) {
// this function (the instrumentation pass inlines the equality test).
extern "C" SANITIZER_INTERFACE_ATTRIBUTE
dfsan_label __dfsan_union(dfsan_label l1, dfsan_label l2) {
+ if (flags().fast16labels)
+ return l1 | l2;
DCHECK_NE(l1, l2);
if (l1 == 0)
@@ -382,7 +383,7 @@ static void InitializeFlags() {
FlagParser parser;
RegisterCommonFlags(&parser);
RegisterDfsanFlags(&parser, &flags());
- parser.ParseString(GetEnv("DFSAN_OPTIONS"));
+ parser.ParseStringFromEnv("DFSAN_OPTIONS");
InitializeCommonFlags();
if (Verbosity()) ReportUnrecognizedFlags();
if (common_flags()->help) parser.PrintFlagDescriptions();
@@ -420,6 +421,12 @@ static void dfsan_fini() {
}
}
+extern "C" void dfsan_flush() {
+ UnmapOrDie((void*)ShadowAddr(), UnusedAddr() - ShadowAddr());
+ if (!MmapFixedNoReserve(ShadowAddr(), UnusedAddr() - ShadowAddr()))
+ Die();
+}
+
static void dfsan_init(int argc, char **argv, char **envp) {
InitializeFlags();
diff --git a/lib/dfsan/dfsan.h b/lib/dfsan/dfsan.h
index 33145deef12e..d662391216e4 100644
--- a/lib/dfsan/dfsan.h
+++ b/lib/dfsan/dfsan.h
@@ -1,9 +1,8 @@
//===-- dfsan.h -------------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/lib/dfsan/dfsan_custom.cc b/lib/dfsan/dfsan_custom.cc
index 022aa9a9ab8e..dc7b81da4566 100644
--- a/lib/dfsan/dfsan_custom.cc
+++ b/lib/dfsan/dfsan_custom.cc
@@ -1,9 +1,8 @@
//===-- dfsan.cc ----------------------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/lib/dfsan/dfsan_flags.inc b/lib/dfsan/dfsan_flags.inc
index 24fbfcb9e46f..29db73b98278 100644
--- a/lib/dfsan/dfsan_flags.inc
+++ b/lib/dfsan/dfsan_flags.inc
@@ -1,9 +1,8 @@
//===-- dfsan_flags.inc -----------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -30,3 +29,7 @@ DFSAN_FLAG(
DFSAN_FLAG(const char *, dump_labels_at_exit, "", "The path of the file where "
"to dump the labels when the "
"program terminates.")
+DFSAN_FLAG(bool, fast16labels, false,
+ "Enables experimental mode where DFSan supports only 16 power-of-2 labels "
+ "(1, 2, 4, 8, ... 32768) and the label union is computed as a bit-wise OR."
+)
diff --git a/lib/dfsan/dfsan_interceptors.cc b/lib/dfsan/dfsan_interceptors.cc
index 5ecbb43e7c46..f4b4babc65c2 100644
--- a/lib/dfsan/dfsan_interceptors.cc
+++ b/lib/dfsan/dfsan_interceptors.cc
@@ -1,9 +1,8 @@
//===-- dfsan_interceptors.cc ---------------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/lib/dfsan/dfsan_platform.h b/lib/dfsan/dfsan_platform.h
index 98284bafd4ff..4ff68b9d40b6 100644
--- a/lib/dfsan/dfsan_platform.h
+++ b/lib/dfsan/dfsan_platform.h
@@ -1,9 +1,8 @@
//===-- dfsan_platform.h ----------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
diff --git a/lib/dfsan/done_abilist.txt b/lib/dfsan/done_abilist.txt
index 9765626ad3ff..f8c88dd3201b 100644
--- a/lib/dfsan/done_abilist.txt
+++ b/lib/dfsan/done_abilist.txt
@@ -26,6 +26,8 @@ fun:dfsan_has_label_with_desc=uninstrumented
fun:dfsan_has_label_with_desc=discard
fun:dfsan_set_write_callback=uninstrumented
fun:dfsan_set_write_callback=custom
+fun:dfsan_flush=uninstrumented
+fun:dfsan_flush=discard
###############################################################################
# glibc