summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kazmin <a.kazmin@partner.samsung.com>2021-08-31 16:03:08 +0300
committerSlava Barinov <v.barinov@samsung.com>2021-09-10 15:07:17 +0300
commit0ef98268a9a216acad2f778ae3cdae64c382d098 (patch)
treeb80bc48acb1c67ca21b1fa4cb313c86482cb2a73
parent72b9c5c7eb7795ee7bbd55540b1b96730314aaf8 (diff)
downloadgcc-sandbox/vbarinov/newmerge.tar.gz
gcc-sandbox/vbarinov/newmerge.tar.bz2
gcc-sandbox/vbarinov/newmerge.zip
Move MaybeDisableUlimit from asan_rtl.cpp to common code * libsanitizer/asan/asan_rtl.cpp: removed MaybeDisableUlimit definition * libsanitizer/hwasan/hwasan.cpp: added calls in __hwasan_init to MaybeDisableUlimit and MaybeMountProcFS * libsanitizer/sanitizer_common/sanitizer_libc.cpp: added MaybeDisableUlimit declaration * libsanitizer/sanitizer_common/sanitizer_libc.h: added MaybeDisableUlimit definition Change-Id: Ic1cdcfaf48412d005a6de09c578fd8668a3514e9 Signed-off-by: Andrey Kazmin <a.kazmin@partner.samsung.com>
-rw-r--r--libsanitizer/asan/asan_rtl.cpp5
-rw-r--r--libsanitizer/hwasan/hwasan.cpp3
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_libc.cpp5
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_libc.h1
4 files changed, 9 insertions, 5 deletions
diff --git a/libsanitizer/asan/asan_rtl.cpp b/libsanitizer/asan/asan_rtl.cpp
index d2334d5f2e9..1144e41e0b9 100644
--- a/libsanitizer/asan/asan_rtl.cpp
+++ b/libsanitizer/asan/asan_rtl.cpp
@@ -398,11 +398,6 @@ static bool UNUSED __local_asan_dyninit = [] {
}();
#endif
-static void MaybeDisableUlimit() {
- if (!AddressSpaceIsUnlimited())
- SetAddressSpaceUnlimited();
-}
-
static void AsanInitInternal() {
if (LIKELY(asan_inited)) return;
SanitizerToolName = "AddressSanitizer";
diff --git a/libsanitizer/hwasan/hwasan.cpp b/libsanitizer/hwasan/hwasan.cpp
index e8e81fd2da2..53cc947a219 100644
--- a/libsanitizer/hwasan/hwasan.cpp
+++ b/libsanitizer/hwasan/hwasan.cpp
@@ -274,6 +274,9 @@ void __hwasan_init() {
InitTlsSize();
+ MaybeMountProcFS();
+ MaybeDisableUlimit();
+
CacheBinaryName();
InitializeFlags();
diff --git a/libsanitizer/sanitizer_common/sanitizer_libc.cpp b/libsanitizer/sanitizer_common/sanitizer_libc.cpp
index 2d78f1eb93c..0d27965b483 100644
--- a/libsanitizer/sanitizer_common/sanitizer_libc.cpp
+++ b/libsanitizer/sanitizer_common/sanitizer_libc.cpp
@@ -289,4 +289,9 @@ bool MaybeMountProcFS() {
return true;
}
+void MaybeDisableUlimit() {
+ if (!AddressSpaceIsUnlimited())
+ SetAddressSpaceUnlimited();
+}
+
} // namespace __sanitizer
diff --git a/libsanitizer/sanitizer_common/sanitizer_libc.h b/libsanitizer/sanitizer_common/sanitizer_libc.h
index d436d62023b..3445ba84f2f 100644
--- a/libsanitizer/sanitizer_common/sanitizer_libc.h
+++ b/libsanitizer/sanitizer_common/sanitizer_libc.h
@@ -85,6 +85,7 @@ extern "C" int mount(const char *source, const char *target,
const void *data);
bool MaybeMountProcFS();
+void MaybeDisableUlimit();
} // namespace __sanitizer