[Lldb-commits] [clang] [compiler-rt] [libcxx] [lldb] [llvm] Rename Sanitizer Coverage => Coverage Sanitizer (PR #106505)

2024-09-15 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka requested changes to this pull request.

I think it change the meaning completly.
I read "Coverage Sanitizer" as a tool which finds bugs in Coverage.
When "Sanitizer Coverage" as a coverage used by sanitizers.

https://github.com/llvm/llvm-project/pull/106505
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [libcxx] [lldb] [llvm] Rename Sanitizer Coverage => Coverage Sanitizer (PR #106505)

2024-09-15 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka edited 
https://github.com/llvm/llvm-project/pull/106505
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [libcxx] [lldb] [llvm] Rename Sanitizer Coverage => Coverage Sanitizer (PR #106505)

2024-09-15 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka edited 
https://github.com/llvm/llvm-project/pull/106505
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [llvm] [lld] [libcxx] [flang] [clang] [lldb] [libc] [compiler-rt] [hwasan] Use ErrorAction::Recover in interceptors (PR #74000)

2023-12-02 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/74000

>From 672b71cc1003533460a82f06b7d24fbdc02ffd58 Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Thu, 30 Nov 2023 14:44:07 -0800
Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
 =?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 .../lib/hwasan/hwasan_interceptors.cpp|  8 ++---
 .../test/hwasan/TestCases/memset-recover.cpp  | 32 +++
 2 files changed, 36 insertions(+), 4 deletions(-)
 create mode 100644 compiler-rt/test/hwasan/TestCases/memset-recover.cpp

diff --git a/compiler-rt/lib/hwasan/hwasan_interceptors.cpp 
b/compiler-rt/lib/hwasan/hwasan_interceptors.cpp
index d9237cf9b8e3b..ee7166c942bbe 100644
--- a/compiler-rt/lib/hwasan/hwasan_interceptors.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_interceptors.cpp
@@ -36,10 +36,10 @@ struct HWAsanInterceptorContext {
   const char *interceptor_name;
 };
 
-#  define ACCESS_MEMORY_RANGE(ctx, offset, size, access)\
-do {\
-  __hwasan::CheckAddressSized((uptr)offset, \
-  size);\
+#  define ACCESS_MEMORY_RANGE(ctx, offset, size, access)  \
+do {  \
+  __hwasan::CheckAddressSized((uptr)offset, \
+size);\
 } while (0)
 
 #  define HWASAN_READ_RANGE(ctx, offset, size) \
diff --git a/compiler-rt/test/hwasan/TestCases/memset-recover.cpp 
b/compiler-rt/test/hwasan/TestCases/memset-recover.cpp
new file mode 100644
index 0..e29e7c412033e
--- /dev/null
+++ b/compiler-rt/test/hwasan/TestCases/memset-recover.cpp
@@ -0,0 +1,32 @@
+// RUN: %clangxx_hwasan %s -o %t
+// RUN: %env_hwasan_opts=halt_on_error=0 not %run %t 2>&1 | FileCheck %s 
--implicit-check-not=RETURN_FROM_TEST --check-prefixes=CHECK,RECOVER
+// RUN: %env_hwasan_opts=halt_on_error=1 not %run %t 2>&1 | FileCheck %s 
--implicit-check-not=RETURN_FROM_TEST
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+__attribute__((no_sanitize("hwaddress"))) void
+ForceCallInterceptor(void *p, int c, size_t size) {
+  memset(p, c, size) == nullptr;
+}
+
+int main(int argc, char **argv) {
+  __hwasan_enable_allocator_tagging();
+  char a[] = {static_cast(argc), 2, 3, 4};
+  int size = sizeof(a);
+  char *volatile p = (char *)malloc(size);
+  void *volatile p2 = p;
+  for (int i = 0; p2 == p; p2 = __hwasan_tag_pointer(p, ++i)) {
+  }
+  ForceCallInterceptor(p2, 0, size);
+  free(p);
+  fprintf(stderr,  "RETURN_FROM_TEST\n");
+  return 0;
+  // CHECK: HWAddressSanitizer: tag-mismatch on address
+  // CHECK: WRITE of size 4
+  // CHECK: #{{[[:digit:]]+}} 0x{{[[:xdigit:]]+}} in main 
{{.*}}memset-recover.cpp:[[@LINE-28]]
+  // RECOVER: RETURN_FROM_TEST
+}

>From 34550bbb8168aeae0e74b29d85ab92fdea50a9bd Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Thu, 30 Nov 2023 14:45:22 -0800
Subject: [PATCH 2/2] format

Created using spr 1.3.4
---
 compiler-rt/test/hwasan/TestCases/memset-recover.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler-rt/test/hwasan/TestCases/memset-recover.cpp 
b/compiler-rt/test/hwasan/TestCases/memset-recover.cpp
index e29e7c412033e..093a0179347be 100644
--- a/compiler-rt/test/hwasan/TestCases/memset-recover.cpp
+++ b/compiler-rt/test/hwasan/TestCases/memset-recover.cpp
@@ -3,10 +3,10 @@
 // RUN: %env_hwasan_opts=halt_on_error=1 not %run %t 2>&1 | FileCheck %s 
--implicit-check-not=RETURN_FROM_TEST
 
 #include 
+#include 
 #include 
 #include 
 #include 
-#include 
 
 __attribute__((no_sanitize("hwaddress"))) void
 ForceCallInterceptor(void *p, int c, size_t size) {
@@ -23,7 +23,7 @@ int main(int argc, char **argv) {
   }
   ForceCallInterceptor(p2, 0, size);
   free(p);
-  fprintf(stderr,  "RETURN_FROM_TEST\n");
+  fprintf(stderr, "RETURN_FROM_TEST\n");
   return 0;
   // CHECK: HWAddressSanitizer: tag-mismatch on address
   // CHECK: WRITE of size 4

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [llvm] [lld] [libcxx] [flang] [clang] [lldb] [libc] [compiler-rt] [hwasan] Use ErrorAction::Recover in interceptors (PR #74000)

2023-12-02 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka closed 
https://github.com/llvm/llvm-project/pull/74000
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lld] [lldb] [llvm] [flang] [clang] [libc] [compiler-rt] [libcxx] [hwasan] Use ErrorAction::Recover in interceptors (PR #74000)

2023-12-02 Thread Vitaly Buka via lldb-commits

vitalybuka wrote:

> [mmalcomson](/mmalcomson)



https://github.com/llvm/llvm-project/pull/74000
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lld] [lldb] [llvm] [flang] [clang] [libc] [compiler-rt] [libcxx] [hwasan] Use ErrorAction::Recover in interceptors (PR #74000)

2023-12-02 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka reopened 
https://github.com/llvm/llvm-project/pull/74000
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [flang] [libc] [libcxx] [lld] [lldb] [compiler-rt] [clang] [llvm] [hwasan] Use ErrorAction::Recover in interceptors (PR #74000)

2023-12-02 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/74000

>From 672b71cc1003533460a82f06b7d24fbdc02ffd58 Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Thu, 30 Nov 2023 14:44:07 -0800
Subject: [PATCH 1/3] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
 =?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 .../lib/hwasan/hwasan_interceptors.cpp|  8 ++---
 .../test/hwasan/TestCases/memset-recover.cpp  | 32 +++
 2 files changed, 36 insertions(+), 4 deletions(-)
 create mode 100644 compiler-rt/test/hwasan/TestCases/memset-recover.cpp

diff --git a/compiler-rt/lib/hwasan/hwasan_interceptors.cpp 
b/compiler-rt/lib/hwasan/hwasan_interceptors.cpp
index d9237cf9b8e3b..ee7166c942bbe 100644
--- a/compiler-rt/lib/hwasan/hwasan_interceptors.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_interceptors.cpp
@@ -36,10 +36,10 @@ struct HWAsanInterceptorContext {
   const char *interceptor_name;
 };
 
-#  define ACCESS_MEMORY_RANGE(ctx, offset, size, access)\
-do {\
-  __hwasan::CheckAddressSized((uptr)offset, \
-  size);\
+#  define ACCESS_MEMORY_RANGE(ctx, offset, size, access)  \
+do {  \
+  __hwasan::CheckAddressSized((uptr)offset, \
+size);\
 } while (0)
 
 #  define HWASAN_READ_RANGE(ctx, offset, size) \
diff --git a/compiler-rt/test/hwasan/TestCases/memset-recover.cpp 
b/compiler-rt/test/hwasan/TestCases/memset-recover.cpp
new file mode 100644
index 0..e29e7c412033e
--- /dev/null
+++ b/compiler-rt/test/hwasan/TestCases/memset-recover.cpp
@@ -0,0 +1,32 @@
+// RUN: %clangxx_hwasan %s -o %t
+// RUN: %env_hwasan_opts=halt_on_error=0 not %run %t 2>&1 | FileCheck %s 
--implicit-check-not=RETURN_FROM_TEST --check-prefixes=CHECK,RECOVER
+// RUN: %env_hwasan_opts=halt_on_error=1 not %run %t 2>&1 | FileCheck %s 
--implicit-check-not=RETURN_FROM_TEST
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+__attribute__((no_sanitize("hwaddress"))) void
+ForceCallInterceptor(void *p, int c, size_t size) {
+  memset(p, c, size) == nullptr;
+}
+
+int main(int argc, char **argv) {
+  __hwasan_enable_allocator_tagging();
+  char a[] = {static_cast(argc), 2, 3, 4};
+  int size = sizeof(a);
+  char *volatile p = (char *)malloc(size);
+  void *volatile p2 = p;
+  for (int i = 0; p2 == p; p2 = __hwasan_tag_pointer(p, ++i)) {
+  }
+  ForceCallInterceptor(p2, 0, size);
+  free(p);
+  fprintf(stderr,  "RETURN_FROM_TEST\n");
+  return 0;
+  // CHECK: HWAddressSanitizer: tag-mismatch on address
+  // CHECK: WRITE of size 4
+  // CHECK: #{{[[:digit:]]+}} 0x{{[[:xdigit:]]+}} in main 
{{.*}}memset-recover.cpp:[[@LINE-28]]
+  // RECOVER: RETURN_FROM_TEST
+}

>From 34550bbb8168aeae0e74b29d85ab92fdea50a9bd Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Thu, 30 Nov 2023 14:45:22 -0800
Subject: [PATCH 2/3] format

Created using spr 1.3.4
---
 compiler-rt/test/hwasan/TestCases/memset-recover.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler-rt/test/hwasan/TestCases/memset-recover.cpp 
b/compiler-rt/test/hwasan/TestCases/memset-recover.cpp
index e29e7c412033e..093a0179347be 100644
--- a/compiler-rt/test/hwasan/TestCases/memset-recover.cpp
+++ b/compiler-rt/test/hwasan/TestCases/memset-recover.cpp
@@ -3,10 +3,10 @@
 // RUN: %env_hwasan_opts=halt_on_error=1 not %run %t 2>&1 | FileCheck %s 
--implicit-check-not=RETURN_FROM_TEST
 
 #include 
+#include 
 #include 
 #include 
 #include 
-#include 
 
 __attribute__((no_sanitize("hwaddress"))) void
 ForceCallInterceptor(void *p, int c, size_t size) {
@@ -23,7 +23,7 @@ int main(int argc, char **argv) {
   }
   ForceCallInterceptor(p2, 0, size);
   free(p);
-  fprintf(stderr,  "RETURN_FROM_TEST\n");
+  fprintf(stderr, "RETURN_FROM_TEST\n");
   return 0;
   // CHECK: HWAddressSanitizer: tag-mismatch on address
   // CHECK: WRITE of size 4

>From 76e1e45922e6709392fb82aac44bebe3dbc2ea63 Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Sat, 2 Dec 2023 16:56:22 -0800
Subject: [PATCH 3/3] simplify

Created using spr 1.3.4
---
 compiler-rt/lib/hwasan/hwasan_interceptors.cpp | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/compiler-rt/lib/hwasan/hwasan_interceptors.cpp 
b/compiler-rt/lib/hwasan/hwasan_interceptors.cpp
index 023cba9c8be2f..96df4dd0c24d7 100644
--- a/compiler-rt/lib/hwasan/hwasan_interceptors.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_interceptors.cpp
@@ -74,10 +74,8 @@ struct HWAsanInterceptorContext {
 
 #  if HWASAN_WITH_INTERCEPTORS
 
-#define COMMON_SYSCALL_PRE_READ_RANGE(p, s) \
-  ACCESS_MEMORY_RANGE((uptr)p, (uptr)s, AccessType::Load)

[Lldb-commits] [clang-tools-extra] [lldb] [libc] [mlir] [clang] [libcxx] [polly] [compiler-rt] [lld] [llvm] [flang] [NFC][asan] Inline ENSURE_ASAN_INITED macro (PR #74174)

2023-12-04 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/74174

>From 71e54faa238765cb9df656a3f6e347a2d04f989a Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Fri, 1 Dec 2023 19:20:37 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20change?=
 =?UTF-8?q?s=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4

[skip ci]
---
 compiler-rt/lib/asan/asan_interceptors.cpp | 54 ++
 compiler-rt/lib/asan/asan_interceptors.h   |  9 ++--
 compiler-rt/lib/asan/asan_internal.h   |  2 +-
 compiler-rt/lib/asan/asan_malloc_linux.cpp |  5 +-
 compiler-rt/lib/asan/asan_rtl.cpp  | 14 +-
 5 files changed, 41 insertions(+), 43 deletions(-)

diff --git a/compiler-rt/lib/asan/asan_interceptors.cpp 
b/compiler-rt/lib/asan/asan_interceptors.cpp
index e80f66142b7a2..1a1a26a7cd8bf 100644
--- a/compiler-rt/lib/asan/asan_interceptors.cpp
+++ b/compiler-rt/lib/asan/asan_interceptors.cpp
@@ -96,14 +96,16 @@ DECLARE_REAL_AND_INTERCEPTOR(void, free, void *)
   ASAN_WRITE_RANGE(ctx, ptr, size)
 #define COMMON_INTERCEPTOR_READ_RANGE(ctx, ptr, size) \
   ASAN_READ_RANGE(ctx, ptr, size)
-#  define COMMON_INTERCEPTOR_ENTER(ctx, func, ...)\
-ASAN_INTERCEPTOR_ENTER(ctx, func);\
-do {  \
-  if (AsanInitIsRunning())\
-return REAL(func)(__VA_ARGS__);   \
-  if (SANITIZER_APPLE && UNLIKELY(!AsanInited())) \
-return REAL(func)(__VA_ARGS__);   \
-  ENSURE_ASAN_INITED();   \
+#  define COMMON_INTERCEPTOR_ENTER(ctx, func, ...) \
+ASAN_INTERCEPTOR_ENTER(ctx, func); \
+do {   \
+  if constexpr (SANITIZER_APPLE) { \
+if (UNLIKELY(!AsanInited()))   \
+  return REAL(func)(__VA_ARGS__);  \
+  } else { \
+if (!TryAsanInitFromRtl()) \
+  return REAL(func)(__VA_ARGS__);  \
+  }\
 } while (false)
 #define COMMON_INTERCEPTOR_DIR_ACQUIRE(ctx, path) \
   do {\
@@ -534,16 +536,16 @@ INTERCEPTOR(char*, strncat, char *to, const char *from, 
uptr size) {
 INTERCEPTOR(char *, strcpy, char *to, const char *from) {
   void *ctx;
   ASAN_INTERCEPTOR_ENTER(ctx, strcpy);
-#if SANITIZER_APPLE
-  if (UNLIKELY(!AsanInited()))
-return REAL(strcpy)(to, from);
-#endif
-  // strcpy is called from malloc_default_purgeable_zone()
-  // in __asan::ReplaceSystemAlloc() on Mac.
-  if (AsanInitIsRunning()) {
-return REAL(strcpy)(to, from);
+  if constexpr (SANITIZER_APPLE) {
+// strcpy is called from malloc_default_purgeable_zone()
+// in __asan::ReplaceSystemAlloc() on Mac.
+if (UNLIKELY(!AsanInited()))
+  return REAL(strcpy)(to, from);
+  } else {
+if (!TryAsanInitFromRtl())
+  return REAL(strcpy)(to, from);
   }
-  ENSURE_ASAN_INITED();
+
   if (flags()->replace_str) {
 uptr from_size = internal_strlen(from) + 1;
 CHECK_RANGES_OVERLAP("strcpy", to, from_size, from, from_size);
@@ -556,9 +558,8 @@ INTERCEPTOR(char *, strcpy, char *to, const char *from) {
 INTERCEPTOR(char*, strdup, const char *s) {
   void *ctx;
   ASAN_INTERCEPTOR_ENTER(ctx, strdup);
-  if (UNLIKELY(!AsanInited()))
+  if (UNLIKELY(!TryAsanInitFromRtl()))
 return internal_strdup(s);
-  ENSURE_ASAN_INITED();
   uptr length = internal_strlen(s);
   if (flags()->replace_str) {
 ASAN_READ_RANGE(ctx, s, length + 1);
@@ -575,9 +576,8 @@ INTERCEPTOR(char*, strdup, const char *s) {
 INTERCEPTOR(char*, __strdup, const char *s) {
   void *ctx;
   ASAN_INTERCEPTOR_ENTER(ctx, strdup);
-  if (UNLIKELY(!AsanInited()))
+  if (UNLIKELY(!TryAsanInitFromRtl()))
 return internal_strdup(s);
-  ENSURE_ASAN_INITED();
   uptr length = internal_strlen(s);
   if (flags()->replace_str) {
 ASAN_READ_RANGE(ctx, s, length + 1);
@@ -635,10 +635,8 @@ INTERCEPTOR_STRTO_BASE(long long, __isoc23_strtoll)
 INTERCEPTOR(int, atoi, const char *nptr) {
   void *ctx;
   ASAN_INTERCEPTOR_ENTER(ctx, atoi);
-#if SANITIZER_APPLE
-  if (UNLIKELY(!AsanInited()))
+  if (SANITIZER_APPLE && UNLIKELY(!AsanInited()))
 return REAL(atoi)(nptr);
-#  endif
   ENSURE_ASAN_INITED();
   if (!flags()->replace_str) {
 return REAL(atoi)(nptr);
@@ -657,10 +655,8 @@ INTERCEPTOR(int, atoi, const char *nptr) {
 INTERCEPTOR(long, atol, const char *nptr) {
   void *ctx;
   ASAN_INTERCEPTOR_ENTER(ctx, atol);
-#if SANITIZER_APPLE
-  if (UNLIKELY(!AsanInited()))
+  if (SANITIZER_APPLE && UNLIKELY(!AsanInited()))
 return REAL(atol)(nptr);
-#  endif
   ENSURE_ASAN_INITED();
   if (!flags()->replace_str) {
 return REAL(atol)(nptr);
@@ -696,10 +692,8 @@ static void AtCxaAtexit(v

[Lldb-commits] [clang-tools-extra] [lldb] [libc] [mlir] [clang] [libcxx] [polly] [compiler-rt] [lld] [llvm] [flang] [NFC][asan] Inline ENSURE_ASAN_INITED macro (PR #74174)

2023-12-04 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka closed 
https://github.com/llvm/llvm-project/pull/74174
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [llvm] [compiler-rt] [flang] [clang] [libcxx] [lldb] [libc] [lld] [hwasan] Use ErrorAction::Recover in interceptors (PR #74000)

2023-12-04 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka closed 
https://github.com/llvm/llvm-project/pull/74000
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [compiler-rt] [mlir] [llvm] [sanitizer] Pre-commit disabled test for fork (PR #75257)

2023-12-12 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/75257

>From db7b2abf12add7fcbac65c7f7fad5f60be58de2f Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 16:08:56 -0800
Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
 =?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 .../TestCases/Posix/fork_threaded.cpp | 86 +++
 .../sanitizer_common/sanitizer_specific.h | 16 
 2 files changed, 102 insertions(+)
 create mode 100644 
compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp

diff --git 
a/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp 
b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
new file mode 100644
index 00..d5c60bbb7c9430
--- /dev/null
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
@@ -0,0 +1,86 @@
+// RUN: %clangxx -O0 %s -o %t && %env_tool_opts=die_after_fork=0 %run %t
+
+// UNSUPPORTED: *
+
+// Forking in multithread environment is unsupported. However we already have
+// some workarounds, and will add more, so this is the test.
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "sanitizer_common/sanitizer_specific.h"
+
+static const size_t kBufferSize = 1 << 20;
+
+static void *background(void *arg) { return nullptr; }
+
+pthread_barrier_t bar;
+
+void CanDeadLock() {
+  // Don't bother with leaks, we try to trigger allocator or lsan deadlock.
+  __lsan::ScopedDisabler disable;
+  char *volatile p = new char[10];
+  __lsan_do_recoverable_leak_check();
+  delete[] p;
+}
+
+// Prevent stack buffer cleanup by instrumentation.
+#define NOSAN __attribute__((no_sanitize("address", "hwaddress", "memory")))
+
+NOSAN static void *inparent(void *arg) {
+  fprintf(stderr, "inparent %d\n", gettid());
+
+  char t[kBufferSize];
+  make_mem_bad(t, sizeof(t));
+
+  pthread_barrier_wait(&bar);
+
+  for (;;)
+CanDeadLock();
+
+  return 0;
+}
+
+NOSAN static void *inchild(void *arg) {
+  char t[kBufferSize];
+  check_mem_is_good(t, sizeof(t));
+  CanDeadLock();
+  return 0;
+}
+
+int main(void) {
+  pid_t pid;
+
+  pthread_barrier_init(&bar, nullptr, 2);
+  pthread_t thread_id;
+  while (pthread_create(&thread_id, 0, &inparent, 0) != 0) {
+  }
+  pthread_barrier_wait(&bar);
+
+  pid = fork();
+  switch (pid) {
+  case -1:
+perror("fork");
+return -1;
+  case 0:
+while (pthread_create(&thread_id, 0, &inchild, 0) != 0) {
+}
+break;
+  default: {
+fprintf(stderr, "fork %d\n", pid);
+int status;
+while (waitpid(-1, &status, __WALL) != pid) {
+}
+assert(WIFEXITED(status) && WEXITSTATUS(status) == 0);
+break;
+  }
+  }
+
+  return 0;
+}
\ No newline at end of file
diff --git a/compiler-rt/test/sanitizer_common/sanitizer_specific.h 
b/compiler-rt/test/sanitizer_common/sanitizer_specific.h
index 1a802020cfd668..963d91cb305f60 100644
--- a/compiler-rt/test/sanitizer_common/sanitizer_specific.h
+++ b/compiler-rt/test/sanitizer_common/sanitizer_specific.h
@@ -1,6 +1,12 @@
 #ifndef __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
 #define __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
 
+#include 
+
+__attribute__((weak)) int __lsan_do_recoverable_leak_check() { return 0; }
+__attribute__((weak)) void __lsan_disable(void) {}
+__attribute__((weak)) void __lsan_enable(void) {}
+
 #ifndef __has_feature
 #  define __has_feature(x) 0
 #endif
@@ -10,6 +16,8 @@
 static void check_mem_is_good(void *p, size_t s) {
   __msan_check_mem_is_initialized(p, s);
 }
+static void make_mem_good(void *p, size_t s) { __msan_unpoison(p, s); }
+static void make_mem_bad(void *p, size_t s) { __msan_poison(p, s); }
 #elif __has_feature(address_sanitizer)
 #  include 
 #  include 
@@ -17,8 +25,16 @@ static void check_mem_is_good(void *p, size_t s) {
   if (__asan_region_is_poisoned(p, s))
 abort();
 }
+static void make_mem_good(void *p, size_t s) {
+  __asan_unpoison_memory_region(p, s);
+}
+static void make_mem_bad(void *p, size_t s) {
+  __asan_poison_memory_region(p, s);
+}
 #else
 static void check_mem_is_good(void *p, size_t s) {}
+static void make_mem_good(void *p, size_t s) {}
+static void make_mem_bad(void *p, size_t s) {}
 #endif
 
 #endif // __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
\ No newline at end of file

>From 3ceddfbc5d928a8297e41923cfb3ac63d0af2a03 Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 16:11:58 -0800
Subject: [PATCH 2/2] newline

Created using spr 1.3.4
---
 .../test/sanitizer_common/TestCases/Posix/fork_threaded.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp 
b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
index d5c60bbb7c9430..2264c558166388 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Posix

[Lldb-commits] [compiler-rt] [mlir] [llvm] [lldb] [sanitizer] Pre-commit disabled test for fork (PR #75257)

2023-12-12 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/75257

>From db7b2abf12add7fcbac65c7f7fad5f60be58de2f Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 16:08:56 -0800
Subject: [PATCH 1/3] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
 =?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 .../TestCases/Posix/fork_threaded.cpp | 86 +++
 .../sanitizer_common/sanitizer_specific.h | 16 
 2 files changed, 102 insertions(+)
 create mode 100644 
compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp

diff --git 
a/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp 
b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
new file mode 100644
index 00..d5c60bbb7c9430
--- /dev/null
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
@@ -0,0 +1,86 @@
+// RUN: %clangxx -O0 %s -o %t && %env_tool_opts=die_after_fork=0 %run %t
+
+// UNSUPPORTED: *
+
+// Forking in multithread environment is unsupported. However we already have
+// some workarounds, and will add more, so this is the test.
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "sanitizer_common/sanitizer_specific.h"
+
+static const size_t kBufferSize = 1 << 20;
+
+static void *background(void *arg) { return nullptr; }
+
+pthread_barrier_t bar;
+
+void CanDeadLock() {
+  // Don't bother with leaks, we try to trigger allocator or lsan deadlock.
+  __lsan::ScopedDisabler disable;
+  char *volatile p = new char[10];
+  __lsan_do_recoverable_leak_check();
+  delete[] p;
+}
+
+// Prevent stack buffer cleanup by instrumentation.
+#define NOSAN __attribute__((no_sanitize("address", "hwaddress", "memory")))
+
+NOSAN static void *inparent(void *arg) {
+  fprintf(stderr, "inparent %d\n", gettid());
+
+  char t[kBufferSize];
+  make_mem_bad(t, sizeof(t));
+
+  pthread_barrier_wait(&bar);
+
+  for (;;)
+CanDeadLock();
+
+  return 0;
+}
+
+NOSAN static void *inchild(void *arg) {
+  char t[kBufferSize];
+  check_mem_is_good(t, sizeof(t));
+  CanDeadLock();
+  return 0;
+}
+
+int main(void) {
+  pid_t pid;
+
+  pthread_barrier_init(&bar, nullptr, 2);
+  pthread_t thread_id;
+  while (pthread_create(&thread_id, 0, &inparent, 0) != 0) {
+  }
+  pthread_barrier_wait(&bar);
+
+  pid = fork();
+  switch (pid) {
+  case -1:
+perror("fork");
+return -1;
+  case 0:
+while (pthread_create(&thread_id, 0, &inchild, 0) != 0) {
+}
+break;
+  default: {
+fprintf(stderr, "fork %d\n", pid);
+int status;
+while (waitpid(-1, &status, __WALL) != pid) {
+}
+assert(WIFEXITED(status) && WEXITSTATUS(status) == 0);
+break;
+  }
+  }
+
+  return 0;
+}
\ No newline at end of file
diff --git a/compiler-rt/test/sanitizer_common/sanitizer_specific.h 
b/compiler-rt/test/sanitizer_common/sanitizer_specific.h
index 1a802020cfd668..963d91cb305f60 100644
--- a/compiler-rt/test/sanitizer_common/sanitizer_specific.h
+++ b/compiler-rt/test/sanitizer_common/sanitizer_specific.h
@@ -1,6 +1,12 @@
 #ifndef __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
 #define __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
 
+#include 
+
+__attribute__((weak)) int __lsan_do_recoverable_leak_check() { return 0; }
+__attribute__((weak)) void __lsan_disable(void) {}
+__attribute__((weak)) void __lsan_enable(void) {}
+
 #ifndef __has_feature
 #  define __has_feature(x) 0
 #endif
@@ -10,6 +16,8 @@
 static void check_mem_is_good(void *p, size_t s) {
   __msan_check_mem_is_initialized(p, s);
 }
+static void make_mem_good(void *p, size_t s) { __msan_unpoison(p, s); }
+static void make_mem_bad(void *p, size_t s) { __msan_poison(p, s); }
 #elif __has_feature(address_sanitizer)
 #  include 
 #  include 
@@ -17,8 +25,16 @@ static void check_mem_is_good(void *p, size_t s) {
   if (__asan_region_is_poisoned(p, s))
 abort();
 }
+static void make_mem_good(void *p, size_t s) {
+  __asan_unpoison_memory_region(p, s);
+}
+static void make_mem_bad(void *p, size_t s) {
+  __asan_poison_memory_region(p, s);
+}
 #else
 static void check_mem_is_good(void *p, size_t s) {}
+static void make_mem_good(void *p, size_t s) {}
+static void make_mem_bad(void *p, size_t s) {}
 #endif
 
 #endif // __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
\ No newline at end of file

>From 3ceddfbc5d928a8297e41923cfb3ac63d0af2a03 Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 16:11:58 -0800
Subject: [PATCH 2/3] newline

Created using spr 1.3.4
---
 .../test/sanitizer_common/TestCases/Posix/fork_threaded.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp 
b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
index d5c60bbb7c9430..2264c558166388 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Posix

[Lldb-commits] [compiler-rt] [mlir] [llvm] [lldb] [sanitizer] Pre-commit disabled test for fork (PR #75257)

2023-12-12 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/75257

>From db7b2abf12add7fcbac65c7f7fad5f60be58de2f Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 16:08:56 -0800
Subject: [PATCH 1/4] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
 =?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 .../TestCases/Posix/fork_threaded.cpp | 86 +++
 .../sanitizer_common/sanitizer_specific.h | 16 
 2 files changed, 102 insertions(+)
 create mode 100644 
compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp

diff --git 
a/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp 
b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
new file mode 100644
index 00..d5c60bbb7c9430
--- /dev/null
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
@@ -0,0 +1,86 @@
+// RUN: %clangxx -O0 %s -o %t && %env_tool_opts=die_after_fork=0 %run %t
+
+// UNSUPPORTED: *
+
+// Forking in multithread environment is unsupported. However we already have
+// some workarounds, and will add more, so this is the test.
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "sanitizer_common/sanitizer_specific.h"
+
+static const size_t kBufferSize = 1 << 20;
+
+static void *background(void *arg) { return nullptr; }
+
+pthread_barrier_t bar;
+
+void CanDeadLock() {
+  // Don't bother with leaks, we try to trigger allocator or lsan deadlock.
+  __lsan::ScopedDisabler disable;
+  char *volatile p = new char[10];
+  __lsan_do_recoverable_leak_check();
+  delete[] p;
+}
+
+// Prevent stack buffer cleanup by instrumentation.
+#define NOSAN __attribute__((no_sanitize("address", "hwaddress", "memory")))
+
+NOSAN static void *inparent(void *arg) {
+  fprintf(stderr, "inparent %d\n", gettid());
+
+  char t[kBufferSize];
+  make_mem_bad(t, sizeof(t));
+
+  pthread_barrier_wait(&bar);
+
+  for (;;)
+CanDeadLock();
+
+  return 0;
+}
+
+NOSAN static void *inchild(void *arg) {
+  char t[kBufferSize];
+  check_mem_is_good(t, sizeof(t));
+  CanDeadLock();
+  return 0;
+}
+
+int main(void) {
+  pid_t pid;
+
+  pthread_barrier_init(&bar, nullptr, 2);
+  pthread_t thread_id;
+  while (pthread_create(&thread_id, 0, &inparent, 0) != 0) {
+  }
+  pthread_barrier_wait(&bar);
+
+  pid = fork();
+  switch (pid) {
+  case -1:
+perror("fork");
+return -1;
+  case 0:
+while (pthread_create(&thread_id, 0, &inchild, 0) != 0) {
+}
+break;
+  default: {
+fprintf(stderr, "fork %d\n", pid);
+int status;
+while (waitpid(-1, &status, __WALL) != pid) {
+}
+assert(WIFEXITED(status) && WEXITSTATUS(status) == 0);
+break;
+  }
+  }
+
+  return 0;
+}
\ No newline at end of file
diff --git a/compiler-rt/test/sanitizer_common/sanitizer_specific.h 
b/compiler-rt/test/sanitizer_common/sanitizer_specific.h
index 1a802020cfd668..963d91cb305f60 100644
--- a/compiler-rt/test/sanitizer_common/sanitizer_specific.h
+++ b/compiler-rt/test/sanitizer_common/sanitizer_specific.h
@@ -1,6 +1,12 @@
 #ifndef __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
 #define __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
 
+#include 
+
+__attribute__((weak)) int __lsan_do_recoverable_leak_check() { return 0; }
+__attribute__((weak)) void __lsan_disable(void) {}
+__attribute__((weak)) void __lsan_enable(void) {}
+
 #ifndef __has_feature
 #  define __has_feature(x) 0
 #endif
@@ -10,6 +16,8 @@
 static void check_mem_is_good(void *p, size_t s) {
   __msan_check_mem_is_initialized(p, s);
 }
+static void make_mem_good(void *p, size_t s) { __msan_unpoison(p, s); }
+static void make_mem_bad(void *p, size_t s) { __msan_poison(p, s); }
 #elif __has_feature(address_sanitizer)
 #  include 
 #  include 
@@ -17,8 +25,16 @@ static void check_mem_is_good(void *p, size_t s) {
   if (__asan_region_is_poisoned(p, s))
 abort();
 }
+static void make_mem_good(void *p, size_t s) {
+  __asan_unpoison_memory_region(p, s);
+}
+static void make_mem_bad(void *p, size_t s) {
+  __asan_poison_memory_region(p, s);
+}
 #else
 static void check_mem_is_good(void *p, size_t s) {}
+static void make_mem_good(void *p, size_t s) {}
+static void make_mem_bad(void *p, size_t s) {}
 #endif
 
 #endif // __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
\ No newline at end of file

>From 3ceddfbc5d928a8297e41923cfb3ac63d0af2a03 Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 16:11:58 -0800
Subject: [PATCH 2/4] newline

Created using spr 1.3.4
---
 .../test/sanitizer_common/TestCases/Posix/fork_threaded.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp 
b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
index d5c60bbb7c9430..2264c558166388 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Posix

[Lldb-commits] [lldb] [llvm] [mlir] [compiler-rt] [sanitizer] Pre-commit disabled test for fork (PR #75257)

2023-12-12 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/75257

>From db7b2abf12add7fcbac65c7f7fad5f60be58de2f Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 16:08:56 -0800
Subject: [PATCH 1/5] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
 =?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 .../TestCases/Posix/fork_threaded.cpp | 86 +++
 .../sanitizer_common/sanitizer_specific.h | 16 
 2 files changed, 102 insertions(+)
 create mode 100644 
compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp

diff --git 
a/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp 
b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
new file mode 100644
index 00..d5c60bbb7c9430
--- /dev/null
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
@@ -0,0 +1,86 @@
+// RUN: %clangxx -O0 %s -o %t && %env_tool_opts=die_after_fork=0 %run %t
+
+// UNSUPPORTED: *
+
+// Forking in multithread environment is unsupported. However we already have
+// some workarounds, and will add more, so this is the test.
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "sanitizer_common/sanitizer_specific.h"
+
+static const size_t kBufferSize = 1 << 20;
+
+static void *background(void *arg) { return nullptr; }
+
+pthread_barrier_t bar;
+
+void CanDeadLock() {
+  // Don't bother with leaks, we try to trigger allocator or lsan deadlock.
+  __lsan::ScopedDisabler disable;
+  char *volatile p = new char[10];
+  __lsan_do_recoverable_leak_check();
+  delete[] p;
+}
+
+// Prevent stack buffer cleanup by instrumentation.
+#define NOSAN __attribute__((no_sanitize("address", "hwaddress", "memory")))
+
+NOSAN static void *inparent(void *arg) {
+  fprintf(stderr, "inparent %d\n", gettid());
+
+  char t[kBufferSize];
+  make_mem_bad(t, sizeof(t));
+
+  pthread_barrier_wait(&bar);
+
+  for (;;)
+CanDeadLock();
+
+  return 0;
+}
+
+NOSAN static void *inchild(void *arg) {
+  char t[kBufferSize];
+  check_mem_is_good(t, sizeof(t));
+  CanDeadLock();
+  return 0;
+}
+
+int main(void) {
+  pid_t pid;
+
+  pthread_barrier_init(&bar, nullptr, 2);
+  pthread_t thread_id;
+  while (pthread_create(&thread_id, 0, &inparent, 0) != 0) {
+  }
+  pthread_barrier_wait(&bar);
+
+  pid = fork();
+  switch (pid) {
+  case -1:
+perror("fork");
+return -1;
+  case 0:
+while (pthread_create(&thread_id, 0, &inchild, 0) != 0) {
+}
+break;
+  default: {
+fprintf(stderr, "fork %d\n", pid);
+int status;
+while (waitpid(-1, &status, __WALL) != pid) {
+}
+assert(WIFEXITED(status) && WEXITSTATUS(status) == 0);
+break;
+  }
+  }
+
+  return 0;
+}
\ No newline at end of file
diff --git a/compiler-rt/test/sanitizer_common/sanitizer_specific.h 
b/compiler-rt/test/sanitizer_common/sanitizer_specific.h
index 1a802020cfd668..963d91cb305f60 100644
--- a/compiler-rt/test/sanitizer_common/sanitizer_specific.h
+++ b/compiler-rt/test/sanitizer_common/sanitizer_specific.h
@@ -1,6 +1,12 @@
 #ifndef __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
 #define __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
 
+#include 
+
+__attribute__((weak)) int __lsan_do_recoverable_leak_check() { return 0; }
+__attribute__((weak)) void __lsan_disable(void) {}
+__attribute__((weak)) void __lsan_enable(void) {}
+
 #ifndef __has_feature
 #  define __has_feature(x) 0
 #endif
@@ -10,6 +16,8 @@
 static void check_mem_is_good(void *p, size_t s) {
   __msan_check_mem_is_initialized(p, s);
 }
+static void make_mem_good(void *p, size_t s) { __msan_unpoison(p, s); }
+static void make_mem_bad(void *p, size_t s) { __msan_poison(p, s); }
 #elif __has_feature(address_sanitizer)
 #  include 
 #  include 
@@ -17,8 +25,16 @@ static void check_mem_is_good(void *p, size_t s) {
   if (__asan_region_is_poisoned(p, s))
 abort();
 }
+static void make_mem_good(void *p, size_t s) {
+  __asan_unpoison_memory_region(p, s);
+}
+static void make_mem_bad(void *p, size_t s) {
+  __asan_poison_memory_region(p, s);
+}
 #else
 static void check_mem_is_good(void *p, size_t s) {}
+static void make_mem_good(void *p, size_t s) {}
+static void make_mem_bad(void *p, size_t s) {}
 #endif
 
 #endif // __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
\ No newline at end of file

>From 3ceddfbc5d928a8297e41923cfb3ac63d0af2a03 Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 16:11:58 -0800
Subject: [PATCH 2/5] newline

Created using spr 1.3.4
---
 .../test/sanitizer_common/TestCases/Posix/fork_threaded.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp 
b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
index d5c60bbb7c9430..2264c558166388 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Posix

[Lldb-commits] [mlir] [clang] [lldb] [compiler-rt] [llvm] [sanitizer] Pre-commit disabled test for fork (PR #75257)

2023-12-12 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/75257

>From db7b2abf12add7fcbac65c7f7fad5f60be58de2f Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 16:08:56 -0800
Subject: [PATCH 1/5] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
 =?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 .../TestCases/Posix/fork_threaded.cpp | 86 +++
 .../sanitizer_common/sanitizer_specific.h | 16 
 2 files changed, 102 insertions(+)
 create mode 100644 
compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp

diff --git 
a/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp 
b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
new file mode 100644
index 0..d5c60bbb7c943
--- /dev/null
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
@@ -0,0 +1,86 @@
+// RUN: %clangxx -O0 %s -o %t && %env_tool_opts=die_after_fork=0 %run %t
+
+// UNSUPPORTED: *
+
+// Forking in multithread environment is unsupported. However we already have
+// some workarounds, and will add more, so this is the test.
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "sanitizer_common/sanitizer_specific.h"
+
+static const size_t kBufferSize = 1 << 20;
+
+static void *background(void *arg) { return nullptr; }
+
+pthread_barrier_t bar;
+
+void CanDeadLock() {
+  // Don't bother with leaks, we try to trigger allocator or lsan deadlock.
+  __lsan::ScopedDisabler disable;
+  char *volatile p = new char[10];
+  __lsan_do_recoverable_leak_check();
+  delete[] p;
+}
+
+// Prevent stack buffer cleanup by instrumentation.
+#define NOSAN __attribute__((no_sanitize("address", "hwaddress", "memory")))
+
+NOSAN static void *inparent(void *arg) {
+  fprintf(stderr, "inparent %d\n", gettid());
+
+  char t[kBufferSize];
+  make_mem_bad(t, sizeof(t));
+
+  pthread_barrier_wait(&bar);
+
+  for (;;)
+CanDeadLock();
+
+  return 0;
+}
+
+NOSAN static void *inchild(void *arg) {
+  char t[kBufferSize];
+  check_mem_is_good(t, sizeof(t));
+  CanDeadLock();
+  return 0;
+}
+
+int main(void) {
+  pid_t pid;
+
+  pthread_barrier_init(&bar, nullptr, 2);
+  pthread_t thread_id;
+  while (pthread_create(&thread_id, 0, &inparent, 0) != 0) {
+  }
+  pthread_barrier_wait(&bar);
+
+  pid = fork();
+  switch (pid) {
+  case -1:
+perror("fork");
+return -1;
+  case 0:
+while (pthread_create(&thread_id, 0, &inchild, 0) != 0) {
+}
+break;
+  default: {
+fprintf(stderr, "fork %d\n", pid);
+int status;
+while (waitpid(-1, &status, __WALL) != pid) {
+}
+assert(WIFEXITED(status) && WEXITSTATUS(status) == 0);
+break;
+  }
+  }
+
+  return 0;
+}
\ No newline at end of file
diff --git a/compiler-rt/test/sanitizer_common/sanitizer_specific.h 
b/compiler-rt/test/sanitizer_common/sanitizer_specific.h
index 1a802020cfd66..963d91cb305f6 100644
--- a/compiler-rt/test/sanitizer_common/sanitizer_specific.h
+++ b/compiler-rt/test/sanitizer_common/sanitizer_specific.h
@@ -1,6 +1,12 @@
 #ifndef __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
 #define __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
 
+#include 
+
+__attribute__((weak)) int __lsan_do_recoverable_leak_check() { return 0; }
+__attribute__((weak)) void __lsan_disable(void) {}
+__attribute__((weak)) void __lsan_enable(void) {}
+
 #ifndef __has_feature
 #  define __has_feature(x) 0
 #endif
@@ -10,6 +16,8 @@
 static void check_mem_is_good(void *p, size_t s) {
   __msan_check_mem_is_initialized(p, s);
 }
+static void make_mem_good(void *p, size_t s) { __msan_unpoison(p, s); }
+static void make_mem_bad(void *p, size_t s) { __msan_poison(p, s); }
 #elif __has_feature(address_sanitizer)
 #  include 
 #  include 
@@ -17,8 +25,16 @@ static void check_mem_is_good(void *p, size_t s) {
   if (__asan_region_is_poisoned(p, s))
 abort();
 }
+static void make_mem_good(void *p, size_t s) {
+  __asan_unpoison_memory_region(p, s);
+}
+static void make_mem_bad(void *p, size_t s) {
+  __asan_poison_memory_region(p, s);
+}
 #else
 static void check_mem_is_good(void *p, size_t s) {}
+static void make_mem_good(void *p, size_t s) {}
+static void make_mem_bad(void *p, size_t s) {}
 #endif
 
 #endif // __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
\ No newline at end of file

>From 3ceddfbc5d928a8297e41923cfb3ac63d0af2a03 Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 16:11:58 -0800
Subject: [PATCH 2/5] newline

Created using spr 1.3.4
---
 .../test/sanitizer_common/TestCases/Posix/fork_threaded.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp 
b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
index d5c60bbb7c943..2264c55816638 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_

[Lldb-commits] [mlir] [clang] [lldb] [compiler-rt] [llvm] [sanitizer] Pre-commit disabled test for fork (PR #75257)

2023-12-12 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka closed 
https://github.com/llvm/llvm-project/pull/75257
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [mlir] [clang] [lldb] [compiler-rt] [llvm] [test][sanitizer] Allow fork_threaded test on Msan, Tsan (PR #75260)

2023-12-12 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka edited 
https://github.com/llvm/llvm-project/pull/75260
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [mlir] [clang] [lldb] [compiler-rt] [llvm] [test][sanitizer] Allow fork_threaded test on Msan, Tsan, Ubsan (PR #75260)

2023-12-12 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka edited 
https://github.com/llvm/llvm-project/pull/75260
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [mlir] [compiler-rt] [clang] [llvm] [test][sanitizer] Allow fork_threaded test on Msan, Tsan, Ubsan (PR #75260)

2023-12-12 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/75260

>From 2dad66c39ce65a06df39cd761362624b355951e3 Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 16:20:07 -0800
Subject: [PATCH 1/4] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4

[skip ci]
---
 .../TestCases/Posix/fork_threaded.cpp | 86 +++
 .../sanitizer_common/sanitizer_specific.h | 16 
 2 files changed, 102 insertions(+)
 create mode 100644 
compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp

diff --git 
a/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp 
b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
new file mode 100644
index 00..2264c558166388
--- /dev/null
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
@@ -0,0 +1,86 @@
+// RUN: %clangxx -O0 %s -o %t && %env_tool_opts=die_after_fork=0 %run %t
+
+// UNSUPPORTED: *
+
+// Forking in multithread environment is unsupported. However we already have
+// some workarounds, and will add more, so this is the test.
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "sanitizer_common/sanitizer_specific.h"
+
+static const size_t kBufferSize = 1 << 20;
+
+static void *background(void *arg) { return nullptr; }
+
+pthread_barrier_t bar;
+
+void CanDeadLock() {
+  // Don't bother with leaks, we try to trigger allocator or lsan deadlock.
+  __lsan::ScopedDisabler disable;
+  char *volatile p = new char[10];
+  __lsan_do_recoverable_leak_check();
+  delete[] p;
+}
+
+// Prevent stack buffer cleanup by instrumentation.
+#define NOSAN __attribute__((no_sanitize("address", "hwaddress", "memory")))
+
+NOSAN static void *inparent(void *arg) {
+  fprintf(stderr, "inparent %d\n", gettid());
+
+  char t[kBufferSize];
+  make_mem_bad(t, sizeof(t));
+
+  pthread_barrier_wait(&bar);
+
+  for (;;)
+CanDeadLock();
+
+  return 0;
+}
+
+NOSAN static void *inchild(void *arg) {
+  char t[kBufferSize];
+  check_mem_is_good(t, sizeof(t));
+  CanDeadLock();
+  return 0;
+}
+
+int main(void) {
+  pid_t pid;
+
+  pthread_barrier_init(&bar, nullptr, 2);
+  pthread_t thread_id;
+  while (pthread_create(&thread_id, 0, &inparent, 0) != 0) {
+  }
+  pthread_barrier_wait(&bar);
+
+  pid = fork();
+  switch (pid) {
+  case -1:
+perror("fork");
+return -1;
+  case 0:
+while (pthread_create(&thread_id, 0, &inchild, 0) != 0) {
+}
+break;
+  default: {
+fprintf(stderr, "fork %d\n", pid);
+int status;
+while (waitpid(-1, &status, __WALL) != pid) {
+}
+assert(WIFEXITED(status) && WEXITSTATUS(status) == 0);
+break;
+  }
+  }
+
+  return 0;
+}
diff --git a/compiler-rt/test/sanitizer_common/sanitizer_specific.h 
b/compiler-rt/test/sanitizer_common/sanitizer_specific.h
index 1a802020cfd668..963d91cb305f60 100644
--- a/compiler-rt/test/sanitizer_common/sanitizer_specific.h
+++ b/compiler-rt/test/sanitizer_common/sanitizer_specific.h
@@ -1,6 +1,12 @@
 #ifndef __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
 #define __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
 
+#include 
+
+__attribute__((weak)) int __lsan_do_recoverable_leak_check() { return 0; }
+__attribute__((weak)) void __lsan_disable(void) {}
+__attribute__((weak)) void __lsan_enable(void) {}
+
 #ifndef __has_feature
 #  define __has_feature(x) 0
 #endif
@@ -10,6 +16,8 @@
 static void check_mem_is_good(void *p, size_t s) {
   __msan_check_mem_is_initialized(p, s);
 }
+static void make_mem_good(void *p, size_t s) { __msan_unpoison(p, s); }
+static void make_mem_bad(void *p, size_t s) { __msan_poison(p, s); }
 #elif __has_feature(address_sanitizer)
 #  include 
 #  include 
@@ -17,8 +25,16 @@ static void check_mem_is_good(void *p, size_t s) {
   if (__asan_region_is_poisoned(p, s))
 abort();
 }
+static void make_mem_good(void *p, size_t s) {
+  __asan_unpoison_memory_region(p, s);
+}
+static void make_mem_bad(void *p, size_t s) {
+  __asan_poison_memory_region(p, s);
+}
 #else
 static void check_mem_is_good(void *p, size_t s) {}
+static void make_mem_good(void *p, size_t s) {}
+static void make_mem_bad(void *p, size_t s) {}
 #endif
 
 #endif // __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
\ No newline at end of file

>From 5c4317f5610316cfe5550f1366e1323116529799 Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 17:09:13 -0800
Subject: [PATCH 2/4] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20introduced=20through=20rebase?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4

[skip ci]
---
 compiler-rt/test/sanitizer_common/sanitizer_specific.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler-rt/test/sanitizer_co

[Lldb-commits] [lldb] [mlir] [compiler-rt] [clang] [llvm] [test][sanitizer] Allow fork_threaded test on Msan, Tsan, Ubsan (PR #75260)

2023-12-12 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka closed 
https://github.com/llvm/llvm-project/pull/75260
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [mlir] [compiler-rt] [clang] [llvm] [hwasan] Add `__hwasan_get_tag_from_pointer` (PR #75267)

2023-12-12 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka edited 
https://github.com/llvm/llvm-project/pull/75267
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [mlir] [compiler-rt] [clang] [llvm] [hwasan] Add `__hwasan_get_tag_from_pointer` (PR #75267)

2023-12-12 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/75267

>From 7fa7ea4786d3c8244aff575d3147d421c761e02a Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 17:01:54 -0800
Subject: [PATCH 1/3] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4

[skip ci]
---
 .../TestCases/Posix/fork_threaded.cpp | 86 +++
 .../sanitizer_common/sanitizer_specific.h | 16 
 2 files changed, 102 insertions(+)
 create mode 100644 
compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp

diff --git 
a/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp 
b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
new file mode 100644
index 0..72a2f78a5a3e7
--- /dev/null
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
@@ -0,0 +1,86 @@
+// RUN: %clangxx -O0 %s -o %t && %env_tool_opts=die_after_fork=0 %run %t
+
+// UNSUPPORTED: asan, lsan, hwasan
+
+// Forking in multithread environment is unsupported. However we already have
+// some workarounds, and will add more, so this is the test.
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "sanitizer_common/sanitizer_specific.h"
+
+static const size_t kBufferSize = 1 << 20;
+
+static void *background(void *arg) { return nullptr; }
+
+pthread_barrier_t bar;
+
+void CanDeadLock() {
+  // Don't bother with leaks, we try to trigger allocator or lsan deadlock.
+  __lsan::ScopedDisabler disable;
+  char *volatile p = new char[10];
+  __lsan_do_recoverable_leak_check();
+  delete[] p;
+}
+
+// Prevent stack buffer cleanup by instrumentation.
+#define NOSAN __attribute__((no_sanitize("address", "hwaddress", "memory")))
+
+NOSAN static void *inparent(void *arg) {
+  fprintf(stderr, "inparent %d\n", gettid());
+
+  char t[kBufferSize];
+  make_mem_bad(t, sizeof(t));
+
+  pthread_barrier_wait(&bar);
+
+  for (;;)
+CanDeadLock();
+
+  return 0;
+}
+
+NOSAN static void *inchild(void *arg) {
+  char t[kBufferSize];
+  check_mem_is_good(t, sizeof(t));
+  CanDeadLock();
+  return 0;
+}
+
+int main(void) {
+  pid_t pid;
+
+  pthread_barrier_init(&bar, nullptr, 2);
+  pthread_t thread_id;
+  while (pthread_create(&thread_id, 0, &inparent, 0) != 0) {
+  }
+  pthread_barrier_wait(&bar);
+
+  pid = fork();
+  switch (pid) {
+  case -1:
+perror("fork");
+return -1;
+  case 0:
+while (pthread_create(&thread_id, 0, &inchild, 0) != 0) {
+}
+break;
+  default: {
+fprintf(stderr, "fork %d\n", pid);
+int status;
+while (waitpid(-1, &status, __WALL) != pid) {
+}
+assert(WIFEXITED(status) && WEXITSTATUS(status) == 0);
+break;
+  }
+  }
+
+  return 0;
+}
diff --git a/compiler-rt/test/sanitizer_common/sanitizer_specific.h 
b/compiler-rt/test/sanitizer_common/sanitizer_specific.h
index 1a802020cfd66..963d91cb305f6 100644
--- a/compiler-rt/test/sanitizer_common/sanitizer_specific.h
+++ b/compiler-rt/test/sanitizer_common/sanitizer_specific.h
@@ -1,6 +1,12 @@
 #ifndef __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
 #define __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
 
+#include 
+
+__attribute__((weak)) int __lsan_do_recoverable_leak_check() { return 0; }
+__attribute__((weak)) void __lsan_disable(void) {}
+__attribute__((weak)) void __lsan_enable(void) {}
+
 #ifndef __has_feature
 #  define __has_feature(x) 0
 #endif
@@ -10,6 +16,8 @@
 static void check_mem_is_good(void *p, size_t s) {
   __msan_check_mem_is_initialized(p, s);
 }
+static void make_mem_good(void *p, size_t s) { __msan_unpoison(p, s); }
+static void make_mem_bad(void *p, size_t s) { __msan_poison(p, s); }
 #elif __has_feature(address_sanitizer)
 #  include 
 #  include 
@@ -17,8 +25,16 @@ static void check_mem_is_good(void *p, size_t s) {
   if (__asan_region_is_poisoned(p, s))
 abort();
 }
+static void make_mem_good(void *p, size_t s) {
+  __asan_unpoison_memory_region(p, s);
+}
+static void make_mem_bad(void *p, size_t s) {
+  __asan_poison_memory_region(p, s);
+}
 #else
 static void check_mem_is_good(void *p, size_t s) {}
+static void make_mem_good(void *p, size_t s) {}
+static void make_mem_bad(void *p, size_t s) {}
 #endif
 
 #endif // __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
\ No newline at end of file

>From 6ed9198c136ead9c6726e5bfd83978e891522f5b Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 17:09:19 -0800
Subject: [PATCH 2/3] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20introduced=20through=20rebase?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4

[skip ci]
---
 compiler-rt/test/sanitizer_common/sanitizer_specific.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler-rt/test

[Lldb-commits] [mlir] [compiler-rt] [lldb] [clang-tools-extra] [clang] [llvm] [hwasan] Add `__hwasan_get_tag_from_pointer` (PR #75267)

2023-12-12 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/75267

>From 7fa7ea4786d3c8244aff575d3147d421c761e02a Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 17:01:54 -0800
Subject: [PATCH 1/3] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4

[skip ci]
---
 .../TestCases/Posix/fork_threaded.cpp | 86 +++
 .../sanitizer_common/sanitizer_specific.h | 16 
 2 files changed, 102 insertions(+)
 create mode 100644 
compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp

diff --git 
a/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp 
b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
new file mode 100644
index 00..72a2f78a5a3e77
--- /dev/null
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
@@ -0,0 +1,86 @@
+// RUN: %clangxx -O0 %s -o %t && %env_tool_opts=die_after_fork=0 %run %t
+
+// UNSUPPORTED: asan, lsan, hwasan
+
+// Forking in multithread environment is unsupported. However we already have
+// some workarounds, and will add more, so this is the test.
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "sanitizer_common/sanitizer_specific.h"
+
+static const size_t kBufferSize = 1 << 20;
+
+static void *background(void *arg) { return nullptr; }
+
+pthread_barrier_t bar;
+
+void CanDeadLock() {
+  // Don't bother with leaks, we try to trigger allocator or lsan deadlock.
+  __lsan::ScopedDisabler disable;
+  char *volatile p = new char[10];
+  __lsan_do_recoverable_leak_check();
+  delete[] p;
+}
+
+// Prevent stack buffer cleanup by instrumentation.
+#define NOSAN __attribute__((no_sanitize("address", "hwaddress", "memory")))
+
+NOSAN static void *inparent(void *arg) {
+  fprintf(stderr, "inparent %d\n", gettid());
+
+  char t[kBufferSize];
+  make_mem_bad(t, sizeof(t));
+
+  pthread_barrier_wait(&bar);
+
+  for (;;)
+CanDeadLock();
+
+  return 0;
+}
+
+NOSAN static void *inchild(void *arg) {
+  char t[kBufferSize];
+  check_mem_is_good(t, sizeof(t));
+  CanDeadLock();
+  return 0;
+}
+
+int main(void) {
+  pid_t pid;
+
+  pthread_barrier_init(&bar, nullptr, 2);
+  pthread_t thread_id;
+  while (pthread_create(&thread_id, 0, &inparent, 0) != 0) {
+  }
+  pthread_barrier_wait(&bar);
+
+  pid = fork();
+  switch (pid) {
+  case -1:
+perror("fork");
+return -1;
+  case 0:
+while (pthread_create(&thread_id, 0, &inchild, 0) != 0) {
+}
+break;
+  default: {
+fprintf(stderr, "fork %d\n", pid);
+int status;
+while (waitpid(-1, &status, __WALL) != pid) {
+}
+assert(WIFEXITED(status) && WEXITSTATUS(status) == 0);
+break;
+  }
+  }
+
+  return 0;
+}
diff --git a/compiler-rt/test/sanitizer_common/sanitizer_specific.h 
b/compiler-rt/test/sanitizer_common/sanitizer_specific.h
index 1a802020cfd668..963d91cb305f60 100644
--- a/compiler-rt/test/sanitizer_common/sanitizer_specific.h
+++ b/compiler-rt/test/sanitizer_common/sanitizer_specific.h
@@ -1,6 +1,12 @@
 #ifndef __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
 #define __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
 
+#include 
+
+__attribute__((weak)) int __lsan_do_recoverable_leak_check() { return 0; }
+__attribute__((weak)) void __lsan_disable(void) {}
+__attribute__((weak)) void __lsan_enable(void) {}
+
 #ifndef __has_feature
 #  define __has_feature(x) 0
 #endif
@@ -10,6 +16,8 @@
 static void check_mem_is_good(void *p, size_t s) {
   __msan_check_mem_is_initialized(p, s);
 }
+static void make_mem_good(void *p, size_t s) { __msan_unpoison(p, s); }
+static void make_mem_bad(void *p, size_t s) { __msan_poison(p, s); }
 #elif __has_feature(address_sanitizer)
 #  include 
 #  include 
@@ -17,8 +25,16 @@ static void check_mem_is_good(void *p, size_t s) {
   if (__asan_region_is_poisoned(p, s))
 abort();
 }
+static void make_mem_good(void *p, size_t s) {
+  __asan_unpoison_memory_region(p, s);
+}
+static void make_mem_bad(void *p, size_t s) {
+  __asan_poison_memory_region(p, s);
+}
 #else
 static void check_mem_is_good(void *p, size_t s) {}
+static void make_mem_good(void *p, size_t s) {}
+static void make_mem_bad(void *p, size_t s) {}
 #endif
 
 #endif // __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
\ No newline at end of file

>From 6ed9198c136ead9c6726e5bfd83978e891522f5b Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 17:09:19 -0800
Subject: [PATCH 2/3] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20introduced=20through=20rebase?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4

[skip ci]
---
 compiler-rt/test/sanitizer_common/sanitizer_specific.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler-rt/

[Lldb-commits] [mlir] [clang-tools-extra] [lld] [lldb] [libcxx] [llvm] [compiler-rt] [clang] [hwasan] Add `__hwasan_get_tag_from_pointer` (PR #75267)

2023-12-12 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/75267

>From 7fa7ea4786d3c8244aff575d3147d421c761e02a Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 17:01:54 -0800
Subject: [PATCH 1/3] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4

[skip ci]
---
 .../TestCases/Posix/fork_threaded.cpp | 86 +++
 .../sanitizer_common/sanitizer_specific.h | 16 
 2 files changed, 102 insertions(+)
 create mode 100644 
compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp

diff --git 
a/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp 
b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
new file mode 100644
index 0..72a2f78a5a3e7
--- /dev/null
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
@@ -0,0 +1,86 @@
+// RUN: %clangxx -O0 %s -o %t && %env_tool_opts=die_after_fork=0 %run %t
+
+// UNSUPPORTED: asan, lsan, hwasan
+
+// Forking in multithread environment is unsupported. However we already have
+// some workarounds, and will add more, so this is the test.
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "sanitizer_common/sanitizer_specific.h"
+
+static const size_t kBufferSize = 1 << 20;
+
+static void *background(void *arg) { return nullptr; }
+
+pthread_barrier_t bar;
+
+void CanDeadLock() {
+  // Don't bother with leaks, we try to trigger allocator or lsan deadlock.
+  __lsan::ScopedDisabler disable;
+  char *volatile p = new char[10];
+  __lsan_do_recoverable_leak_check();
+  delete[] p;
+}
+
+// Prevent stack buffer cleanup by instrumentation.
+#define NOSAN __attribute__((no_sanitize("address", "hwaddress", "memory")))
+
+NOSAN static void *inparent(void *arg) {
+  fprintf(stderr, "inparent %d\n", gettid());
+
+  char t[kBufferSize];
+  make_mem_bad(t, sizeof(t));
+
+  pthread_barrier_wait(&bar);
+
+  for (;;)
+CanDeadLock();
+
+  return 0;
+}
+
+NOSAN static void *inchild(void *arg) {
+  char t[kBufferSize];
+  check_mem_is_good(t, sizeof(t));
+  CanDeadLock();
+  return 0;
+}
+
+int main(void) {
+  pid_t pid;
+
+  pthread_barrier_init(&bar, nullptr, 2);
+  pthread_t thread_id;
+  while (pthread_create(&thread_id, 0, &inparent, 0) != 0) {
+  }
+  pthread_barrier_wait(&bar);
+
+  pid = fork();
+  switch (pid) {
+  case -1:
+perror("fork");
+return -1;
+  case 0:
+while (pthread_create(&thread_id, 0, &inchild, 0) != 0) {
+}
+break;
+  default: {
+fprintf(stderr, "fork %d\n", pid);
+int status;
+while (waitpid(-1, &status, __WALL) != pid) {
+}
+assert(WIFEXITED(status) && WEXITSTATUS(status) == 0);
+break;
+  }
+  }
+
+  return 0;
+}
diff --git a/compiler-rt/test/sanitizer_common/sanitizer_specific.h 
b/compiler-rt/test/sanitizer_common/sanitizer_specific.h
index 1a802020cfd66..963d91cb305f6 100644
--- a/compiler-rt/test/sanitizer_common/sanitizer_specific.h
+++ b/compiler-rt/test/sanitizer_common/sanitizer_specific.h
@@ -1,6 +1,12 @@
 #ifndef __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
 #define __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
 
+#include 
+
+__attribute__((weak)) int __lsan_do_recoverable_leak_check() { return 0; }
+__attribute__((weak)) void __lsan_disable(void) {}
+__attribute__((weak)) void __lsan_enable(void) {}
+
 #ifndef __has_feature
 #  define __has_feature(x) 0
 #endif
@@ -10,6 +16,8 @@
 static void check_mem_is_good(void *p, size_t s) {
   __msan_check_mem_is_initialized(p, s);
 }
+static void make_mem_good(void *p, size_t s) { __msan_unpoison(p, s); }
+static void make_mem_bad(void *p, size_t s) { __msan_poison(p, s); }
 #elif __has_feature(address_sanitizer)
 #  include 
 #  include 
@@ -17,8 +25,16 @@ static void check_mem_is_good(void *p, size_t s) {
   if (__asan_region_is_poisoned(p, s))
 abort();
 }
+static void make_mem_good(void *p, size_t s) {
+  __asan_unpoison_memory_region(p, s);
+}
+static void make_mem_bad(void *p, size_t s) {
+  __asan_poison_memory_region(p, s);
+}
 #else
 static void check_mem_is_good(void *p, size_t s) {}
+static void make_mem_good(void *p, size_t s) {}
+static void make_mem_bad(void *p, size_t s) {}
 #endif
 
 #endif // __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
\ No newline at end of file

>From 6ed9198c136ead9c6726e5bfd83978e891522f5b Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 17:09:19 -0800
Subject: [PATCH 2/3] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20introduced=20through=20rebase?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4

[skip ci]
---
 compiler-rt/test/sanitizer_common/sanitizer_specific.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler-rt/test

[Lldb-commits] [llvm] [clang] [compiler-rt] [lldb] [libcxx] [mlir] [clang-tools-extra] [lld] [hwasan] Add `__hwasan_get_tag_from_pointer` (PR #75267)

2023-12-13 Thread Vitaly Buka via lldb-commits


@@ -0,0 +1,24 @@
+// RUN: %clangxx_hwasan -O0 %s -o %t && %run %t
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+int main() {
+  auto p = std::make_unique();
+  std::set ptrs;
+  for (unsigned i = 0;; ++i) {
+void *ptr = __hwasan_tag_pointer(p.get(), i);
+if (!ptrs.insert(ptr).second)
+  break;
+fprintf(stderr, "%p, %u, %u\n", ptr, i, 
__hwasan_get_tag_from_pointer(ptr));
+assert(__hwasan_get_tag_from_pointer(ptr) == i);
+  }
+#ifdef __x86_64__
+  assert(ptrs.size() == 8);

vitalybuka wrote:

REQUIRES will disable the test completely. 
I guess we will update ifdef when we (or someone else) will have LAM

https://github.com/llvm/llvm-project/pull/75267
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [mlir] [lld] [clang-tools-extra] [llvm] [lldb] [clang] [compiler-rt] [libcxx] [hwasan] Add `__hwasan_get_tag_from_pointer` (PR #75267)

2023-12-13 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/75267

>From 7fa7ea4786d3c8244aff575d3147d421c761e02a Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 17:01:54 -0800
Subject: [PATCH 1/3] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4

[skip ci]
---
 .../TestCases/Posix/fork_threaded.cpp | 86 +++
 .../sanitizer_common/sanitizer_specific.h | 16 
 2 files changed, 102 insertions(+)
 create mode 100644 
compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp

diff --git 
a/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp 
b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
new file mode 100644
index 00..72a2f78a5a3e77
--- /dev/null
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.cpp
@@ -0,0 +1,86 @@
+// RUN: %clangxx -O0 %s -o %t && %env_tool_opts=die_after_fork=0 %run %t
+
+// UNSUPPORTED: asan, lsan, hwasan
+
+// Forking in multithread environment is unsupported. However we already have
+// some workarounds, and will add more, so this is the test.
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "sanitizer_common/sanitizer_specific.h"
+
+static const size_t kBufferSize = 1 << 20;
+
+static void *background(void *arg) { return nullptr; }
+
+pthread_barrier_t bar;
+
+void CanDeadLock() {
+  // Don't bother with leaks, we try to trigger allocator or lsan deadlock.
+  __lsan::ScopedDisabler disable;
+  char *volatile p = new char[10];
+  __lsan_do_recoverable_leak_check();
+  delete[] p;
+}
+
+// Prevent stack buffer cleanup by instrumentation.
+#define NOSAN __attribute__((no_sanitize("address", "hwaddress", "memory")))
+
+NOSAN static void *inparent(void *arg) {
+  fprintf(stderr, "inparent %d\n", gettid());
+
+  char t[kBufferSize];
+  make_mem_bad(t, sizeof(t));
+
+  pthread_barrier_wait(&bar);
+
+  for (;;)
+CanDeadLock();
+
+  return 0;
+}
+
+NOSAN static void *inchild(void *arg) {
+  char t[kBufferSize];
+  check_mem_is_good(t, sizeof(t));
+  CanDeadLock();
+  return 0;
+}
+
+int main(void) {
+  pid_t pid;
+
+  pthread_barrier_init(&bar, nullptr, 2);
+  pthread_t thread_id;
+  while (pthread_create(&thread_id, 0, &inparent, 0) != 0) {
+  }
+  pthread_barrier_wait(&bar);
+
+  pid = fork();
+  switch (pid) {
+  case -1:
+perror("fork");
+return -1;
+  case 0:
+while (pthread_create(&thread_id, 0, &inchild, 0) != 0) {
+}
+break;
+  default: {
+fprintf(stderr, "fork %d\n", pid);
+int status;
+while (waitpid(-1, &status, __WALL) != pid) {
+}
+assert(WIFEXITED(status) && WEXITSTATUS(status) == 0);
+break;
+  }
+  }
+
+  return 0;
+}
diff --git a/compiler-rt/test/sanitizer_common/sanitizer_specific.h 
b/compiler-rt/test/sanitizer_common/sanitizer_specific.h
index 1a802020cfd668..963d91cb305f60 100644
--- a/compiler-rt/test/sanitizer_common/sanitizer_specific.h
+++ b/compiler-rt/test/sanitizer_common/sanitizer_specific.h
@@ -1,6 +1,12 @@
 #ifndef __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
 #define __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
 
+#include 
+
+__attribute__((weak)) int __lsan_do_recoverable_leak_check() { return 0; }
+__attribute__((weak)) void __lsan_disable(void) {}
+__attribute__((weak)) void __lsan_enable(void) {}
+
 #ifndef __has_feature
 #  define __has_feature(x) 0
 #endif
@@ -10,6 +16,8 @@
 static void check_mem_is_good(void *p, size_t s) {
   __msan_check_mem_is_initialized(p, s);
 }
+static void make_mem_good(void *p, size_t s) { __msan_unpoison(p, s); }
+static void make_mem_bad(void *p, size_t s) { __msan_poison(p, s); }
 #elif __has_feature(address_sanitizer)
 #  include 
 #  include 
@@ -17,8 +25,16 @@ static void check_mem_is_good(void *p, size_t s) {
   if (__asan_region_is_poisoned(p, s))
 abort();
 }
+static void make_mem_good(void *p, size_t s) {
+  __asan_unpoison_memory_region(p, s);
+}
+static void make_mem_bad(void *p, size_t s) {
+  __asan_poison_memory_region(p, s);
+}
 #else
 static void check_mem_is_good(void *p, size_t s) {}
+static void make_mem_good(void *p, size_t s) {}
+static void make_mem_bad(void *p, size_t s) {}
 #endif
 
 #endif // __SANITIZER_COMMON_SANITIZER_SPECIFIC_H__
\ No newline at end of file

>From 6ed9198c136ead9c6726e5bfd83978e891522f5b Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 17:09:19 -0800
Subject: [PATCH 2/3] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20introduced=20through=20rebase?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4

[skip ci]
---
 compiler-rt/test/sanitizer_common/sanitizer_specific.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler-rt/

[Lldb-commits] [mlir] [lld] [llvm] [clang] [lldb] [clang-tools-extra] [compiler-rt] [libcxx] [hwasan] Add `__hwasan_get_tag_from_pointer` (PR #75267)

2023-12-13 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka closed 
https://github.com/llvm/llvm-project/pull/75267
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] [libc] [libunwind] [flang] [lld] [compiler-rt] [libcxx] [clang] [libcxxabi] [clang-tools-extra] [lsan] Install `pthread_atfork` (PR #75281)

2023-12-13 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka edited 
https://github.com/llvm/llvm-project/pull/75281
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [compiler-rt] [flang] [libc] [lldb] [clang-tools-extra] [libcxxabi] [libunwind] [lld] [llvm] [clang] [libcxx] [lsan] Install `pthread_atfork` (PR #75281)

2023-12-13 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka closed 
https://github.com/llvm/llvm-project/pull/75281
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [compiler-rt] [flang] [libc] [lldb] [libcxxabi] [libunwind] [llvm] [clang] [lld] [libcxx] [asan] Install `pthread_atfork` (PR #75290)

2023-12-13 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka edited 
https://github.com/llvm/llvm-project/pull/75290
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [mlir] [libunwind] [lldb] [compiler-rt] [clang] [libcxx] [llvm] [libc] [flang] [libcxxabi] [lld] [asan] Install `pthread_atfork` (PR #75290)

2023-12-13 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/75290

>From 2d98fe9115e37c60fd568008c27038015f28c7e3 Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 22:59:06 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20change?=
 =?UTF-8?q?s=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4

[skip ci]
---
 .../include/sanitizer/hwasan_interface.h  |  4 
 compiler-rt/lib/hwasan/hwasan.cpp |  2 ++
 compiler-rt/lib/hwasan/hwasan.h   |  6 ++---
 .../lib/hwasan/hwasan_interface_internal.h|  3 +++
 compiler-rt/lib/lsan/lsan.cpp |  1 +
 compiler-rt/lib/lsan/lsan.h   |  1 +
 compiler-rt/lib/lsan/lsan_common.cpp  |  3 +++
 compiler-rt/lib/lsan/lsan_common.h|  4 
 compiler-rt/lib/lsan/lsan_fuchsia.cpp |  1 +
 compiler-rt/lib/lsan/lsan_posix.cpp   | 18 ++
 compiler-rt/test/hwasan/TestCases/tag-ptr.cpp | 24 +++
 .../TestCases/Posix/fork_threaded.c   |  2 +-
 .../sanitizer_common/sanitizer_specific.h | 13 ++
 13 files changed, 78 insertions(+), 4 deletions(-)
 create mode 100644 compiler-rt/test/hwasan/TestCases/tag-ptr.cpp

diff --git a/compiler-rt/include/sanitizer/hwasan_interface.h 
b/compiler-rt/include/sanitizer/hwasan_interface.h
index abe310c0666948..407f488a24a617 100644
--- a/compiler-rt/include/sanitizer/hwasan_interface.h
+++ b/compiler-rt/include/sanitizer/hwasan_interface.h
@@ -44,6 +44,10 @@ void SANITIZER_CDECL __hwasan_tag_memory(const volatile void 
*p,
 void *SANITIZER_CDECL __hwasan_tag_pointer(const volatile void *p,
unsigned char tag);
 
+/// Get tag from the pointer.
+unsigned char SANITIZER_CDECL
+__hwasan_get_tag_from_pointer(const volatile void *p);
+
 // Set memory tag from the current SP address to the given address to zero.
 // This is meant to annotate longjmp and other non-local jumps.
 // This function needs to know the (almost) exact destination frame address;
diff --git a/compiler-rt/lib/hwasan/hwasan.cpp 
b/compiler-rt/lib/hwasan/hwasan.cpp
index 2f6cb10caf1be6..52780becbdb264 100644
--- a/compiler-rt/lib/hwasan/hwasan.cpp
+++ b/compiler-rt/lib/hwasan/hwasan.cpp
@@ -678,6 +678,8 @@ uptr __hwasan_tag_pointer(uptr p, u8 tag) {
   return AddTagToPointer(p, tag);
 }
 
+u8 __hwasan_get_tag_from_pointer(uptr p) { return GetTagFromPointer(p); }
+
 void __hwasan_handle_longjmp(const void *sp_dst) {
   uptr dst = (uptr)sp_dst;
   // HWASan does not support tagged SP.
diff --git a/compiler-rt/lib/hwasan/hwasan.h b/compiler-rt/lib/hwasan/hwasan.h
index 37ef4822285110..df21375e81671f 100644
--- a/compiler-rt/lib/hwasan/hwasan.h
+++ b/compiler-rt/lib/hwasan/hwasan.h
@@ -104,9 +104,9 @@ static inline void *UntagPtr(const void *tagged_ptr) {
 }
 
 static inline uptr AddTagToPointer(uptr p, tag_t tag) {
-  return InTaggableRegion(p)
- ? ((p & ~kAddressTagMask) | ((uptr)tag << kAddressTagShift))
- : p;
+  return InTaggableRegion(p) ? ((p & ~kAddressTagMask) |
+((uptr)(tag & kTagMask) << kAddressTagShift))
+ : p;
 }
 
 namespace __hwasan {
diff --git a/compiler-rt/lib/hwasan/hwasan_interface_internal.h 
b/compiler-rt/lib/hwasan/hwasan_interface_internal.h
index e7804cc4903343..8f2f77dad917d2 100644
--- a/compiler-rt/lib/hwasan/hwasan_interface_internal.h
+++ b/compiler-rt/lib/hwasan/hwasan_interface_internal.h
@@ -160,6 +160,9 @@ void __hwasan_tag_memory(uptr p, u8 tag, uptr sz);
 SANITIZER_INTERFACE_ATTRIBUTE
 uptr __hwasan_tag_pointer(uptr p, u8 tag);
 
+SANITIZER_INTERFACE_ATTRIBUTE
+u8 __hwasan_get_tag_from_pointer(uptr p);
+
 SANITIZER_INTERFACE_ATTRIBUTE
 void __hwasan_tag_mismatch(uptr addr, u8 ts);
 
diff --git a/compiler-rt/lib/lsan/lsan.cpp b/compiler-rt/lib/lsan/lsan.cpp
index 6b223603c6a79c..7a27b600f203f7 100644
--- a/compiler-rt/lib/lsan/lsan.cpp
+++ b/compiler-rt/lib/lsan/lsan.cpp
@@ -101,6 +101,7 @@ extern "C" void __lsan_init() {
   InstallDeadlySignalHandlers(LsanOnDeadlySignal);
   InitializeMainThread();
   InstallAtExitCheckLeaks();
+  InstallAtForkHandler();
 
   InitializeCoverage(common_flags()->coverage, common_flags()->coverage_dir);
 
diff --git a/compiler-rt/lib/lsan/lsan.h b/compiler-rt/lib/lsan/lsan.h
index 757edec8e104f9..0074ad5308785c 100644
--- a/compiler-rt/lib/lsan/lsan.h
+++ b/compiler-rt/lib/lsan/lsan.h
@@ -40,6 +40,7 @@ void InitializeInterceptors();
 void ReplaceSystemMalloc();
 void LsanOnDeadlySignal(int signo, void *siginfo, void *context);
 void InstallAtExitCheckLeaks();
+void InstallAtForkHandler();
 
 #define ENSURE_LSAN_INITED\
   do {\
diff --git a/compiler-rt/lib/lsan/lsan_common.cpp 
b/compiler-rt/lib/lsan/lsan_common.cpp
index 8b1af5b629fbce..e24839c984b346 1006

[Lldb-commits] [llvm] [lldb] [clang-tools-extra] [libcxx] [compiler-rt] [lld] [mlir] [libunwind] [libcxxabi] [flang] [libc] [clang] [asan] Install `pthread_atfork` (PR #75290)

2023-12-13 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/75290

>From 2d98fe9115e37c60fd568008c27038015f28c7e3 Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 22:59:06 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20change?=
 =?UTF-8?q?s=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4

[skip ci]
---
 .../include/sanitizer/hwasan_interface.h  |  4 
 compiler-rt/lib/hwasan/hwasan.cpp |  2 ++
 compiler-rt/lib/hwasan/hwasan.h   |  6 ++---
 .../lib/hwasan/hwasan_interface_internal.h|  3 +++
 compiler-rt/lib/lsan/lsan.cpp |  1 +
 compiler-rt/lib/lsan/lsan.h   |  1 +
 compiler-rt/lib/lsan/lsan_common.cpp  |  3 +++
 compiler-rt/lib/lsan/lsan_common.h|  4 
 compiler-rt/lib/lsan/lsan_fuchsia.cpp |  1 +
 compiler-rt/lib/lsan/lsan_posix.cpp   | 18 ++
 compiler-rt/test/hwasan/TestCases/tag-ptr.cpp | 24 +++
 .../TestCases/Posix/fork_threaded.c   |  2 +-
 .../sanitizer_common/sanitizer_specific.h | 13 ++
 13 files changed, 78 insertions(+), 4 deletions(-)
 create mode 100644 compiler-rt/test/hwasan/TestCases/tag-ptr.cpp

diff --git a/compiler-rt/include/sanitizer/hwasan_interface.h 
b/compiler-rt/include/sanitizer/hwasan_interface.h
index abe310c0666948..407f488a24a617 100644
--- a/compiler-rt/include/sanitizer/hwasan_interface.h
+++ b/compiler-rt/include/sanitizer/hwasan_interface.h
@@ -44,6 +44,10 @@ void SANITIZER_CDECL __hwasan_tag_memory(const volatile void 
*p,
 void *SANITIZER_CDECL __hwasan_tag_pointer(const volatile void *p,
unsigned char tag);
 
+/// Get tag from the pointer.
+unsigned char SANITIZER_CDECL
+__hwasan_get_tag_from_pointer(const volatile void *p);
+
 // Set memory tag from the current SP address to the given address to zero.
 // This is meant to annotate longjmp and other non-local jumps.
 // This function needs to know the (almost) exact destination frame address;
diff --git a/compiler-rt/lib/hwasan/hwasan.cpp 
b/compiler-rt/lib/hwasan/hwasan.cpp
index 2f6cb10caf1be6..52780becbdb264 100644
--- a/compiler-rt/lib/hwasan/hwasan.cpp
+++ b/compiler-rt/lib/hwasan/hwasan.cpp
@@ -678,6 +678,8 @@ uptr __hwasan_tag_pointer(uptr p, u8 tag) {
   return AddTagToPointer(p, tag);
 }
 
+u8 __hwasan_get_tag_from_pointer(uptr p) { return GetTagFromPointer(p); }
+
 void __hwasan_handle_longjmp(const void *sp_dst) {
   uptr dst = (uptr)sp_dst;
   // HWASan does not support tagged SP.
diff --git a/compiler-rt/lib/hwasan/hwasan.h b/compiler-rt/lib/hwasan/hwasan.h
index 37ef4822285110..df21375e81671f 100644
--- a/compiler-rt/lib/hwasan/hwasan.h
+++ b/compiler-rt/lib/hwasan/hwasan.h
@@ -104,9 +104,9 @@ static inline void *UntagPtr(const void *tagged_ptr) {
 }
 
 static inline uptr AddTagToPointer(uptr p, tag_t tag) {
-  return InTaggableRegion(p)
- ? ((p & ~kAddressTagMask) | ((uptr)tag << kAddressTagShift))
- : p;
+  return InTaggableRegion(p) ? ((p & ~kAddressTagMask) |
+((uptr)(tag & kTagMask) << kAddressTagShift))
+ : p;
 }
 
 namespace __hwasan {
diff --git a/compiler-rt/lib/hwasan/hwasan_interface_internal.h 
b/compiler-rt/lib/hwasan/hwasan_interface_internal.h
index e7804cc4903343..8f2f77dad917d2 100644
--- a/compiler-rt/lib/hwasan/hwasan_interface_internal.h
+++ b/compiler-rt/lib/hwasan/hwasan_interface_internal.h
@@ -160,6 +160,9 @@ void __hwasan_tag_memory(uptr p, u8 tag, uptr sz);
 SANITIZER_INTERFACE_ATTRIBUTE
 uptr __hwasan_tag_pointer(uptr p, u8 tag);
 
+SANITIZER_INTERFACE_ATTRIBUTE
+u8 __hwasan_get_tag_from_pointer(uptr p);
+
 SANITIZER_INTERFACE_ATTRIBUTE
 void __hwasan_tag_mismatch(uptr addr, u8 ts);
 
diff --git a/compiler-rt/lib/lsan/lsan.cpp b/compiler-rt/lib/lsan/lsan.cpp
index 6b223603c6a79c..7a27b600f203f7 100644
--- a/compiler-rt/lib/lsan/lsan.cpp
+++ b/compiler-rt/lib/lsan/lsan.cpp
@@ -101,6 +101,7 @@ extern "C" void __lsan_init() {
   InstallDeadlySignalHandlers(LsanOnDeadlySignal);
   InitializeMainThread();
   InstallAtExitCheckLeaks();
+  InstallAtForkHandler();
 
   InitializeCoverage(common_flags()->coverage, common_flags()->coverage_dir);
 
diff --git a/compiler-rt/lib/lsan/lsan.h b/compiler-rt/lib/lsan/lsan.h
index 757edec8e104f9..0074ad5308785c 100644
--- a/compiler-rt/lib/lsan/lsan.h
+++ b/compiler-rt/lib/lsan/lsan.h
@@ -40,6 +40,7 @@ void InitializeInterceptors();
 void ReplaceSystemMalloc();
 void LsanOnDeadlySignal(int signo, void *siginfo, void *context);
 void InstallAtExitCheckLeaks();
+void InstallAtForkHandler();
 
 #define ENSURE_LSAN_INITED\
   do {\
diff --git a/compiler-rt/lib/lsan/lsan_common.cpp 
b/compiler-rt/lib/lsan/lsan_common.cpp
index 8b1af5b629fbce..e24839c984b346 1006

[Lldb-commits] [compiler-rt] [mlir] [libunwind] [flang] [lldb] [lld] [clang] [clang-tools-extra] [libcxxabi] [libc] [libcxx] [llvm] [asan] Install `pthread_atfork` (PR #75290)

2023-12-13 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka closed 
https://github.com/llvm/llvm-project/pull/75290
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [libcxx] [clang] [flang] [llvm] [lld] [mlir] [libunwind] [clang-tools-extra] [libcxxabi] [libc] [lldb] [compiler-rt] [test][hwasan] Implement sanitizer_specific for HWASAN (PR #75280)

2023-12-13 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka edited 
https://github.com/llvm/llvm-project/pull/75280
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [libcxx] [clang] [flang] [llvm] [lld] [mlir] [libunwind] [clang-tools-extra] [libcxxabi] [libc] [lldb] [compiler-rt] [test][hwasan] Implement sanitizer_specific for HWASAN (PR #75280)

2023-12-13 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka closed 
https://github.com/llvm/llvm-project/pull/75280
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [flang] [libcxx] [llvm] [lld] [mlir] [libunwind] [clang-tools-extra] [libcxxabi] [libc] [lldb] [compiler-rt] [hwasan] Improve support of forking with threads (PR #75291)

2023-12-13 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka edited 
https://github.com/llvm/llvm-project/pull/75291
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [libunwind] [clang] [libc] [compiler-rt] [libcxx] [clang-tools-extra] [flang] [lldb] [lld] [mlir] [libcxxabi] [llvm] [hwasan] Improve support of forking with threads (PR #75291)

2023-12-13 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/75291

>From 1a361826b5345460c201c506f2d2c78a84aebf84 Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Tue, 12 Dec 2023 22:59:10 -0800
Subject: [PATCH 1/4] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4

[skip ci]
---
 .../include/sanitizer/hwasan_interface.h  |  4 
 compiler-rt/lib/asan/asan_fuchsia.cpp |  2 ++
 compiler-rt/lib/asan/asan_internal.h  |  1 +
 compiler-rt/lib/asan/asan_posix.cpp   | 24 +++
 compiler-rt/lib/asan/asan_rtl.cpp |  2 ++
 compiler-rt/lib/asan/asan_win.cpp |  2 ++
 compiler-rt/lib/hwasan/hwasan.cpp |  2 ++
 compiler-rt/lib/hwasan/hwasan.h   |  6 ++---
 .../lib/hwasan/hwasan_interface_internal.h|  3 +++
 compiler-rt/lib/lsan/lsan.cpp |  1 +
 compiler-rt/lib/lsan/lsan.h   |  1 +
 compiler-rt/lib/lsan/lsan_common.cpp  |  3 +++
 compiler-rt/lib/lsan/lsan_common.h|  4 
 compiler-rt/lib/lsan/lsan_fuchsia.cpp |  1 +
 compiler-rt/lib/lsan/lsan_posix.cpp   | 18 ++
 compiler-rt/test/hwasan/TestCases/tag-ptr.cpp | 24 +++
 .../TestCases/Posix/fork_threaded.c   |  2 +-
 .../sanitizer_common/sanitizer_specific.h | 13 ++
 18 files changed, 109 insertions(+), 4 deletions(-)
 create mode 100644 compiler-rt/test/hwasan/TestCases/tag-ptr.cpp

diff --git a/compiler-rt/include/sanitizer/hwasan_interface.h 
b/compiler-rt/include/sanitizer/hwasan_interface.h
index abe310c0666948..407f488a24a617 100644
--- a/compiler-rt/include/sanitizer/hwasan_interface.h
+++ b/compiler-rt/include/sanitizer/hwasan_interface.h
@@ -44,6 +44,10 @@ void SANITIZER_CDECL __hwasan_tag_memory(const volatile void 
*p,
 void *SANITIZER_CDECL __hwasan_tag_pointer(const volatile void *p,
unsigned char tag);
 
+/// Get tag from the pointer.
+unsigned char SANITIZER_CDECL
+__hwasan_get_tag_from_pointer(const volatile void *p);
+
 // Set memory tag from the current SP address to the given address to zero.
 // This is meant to annotate longjmp and other non-local jumps.
 // This function needs to know the (almost) exact destination frame address;
diff --git a/compiler-rt/lib/asan/asan_fuchsia.cpp 
b/compiler-rt/lib/asan/asan_fuchsia.cpp
index 2b15504123bee7..12625e9d75833d 100644
--- a/compiler-rt/lib/asan/asan_fuchsia.cpp
+++ b/compiler-rt/lib/asan/asan_fuchsia.cpp
@@ -240,6 +240,8 @@ void FlushUnneededASanShadowMemory(uptr p, uptr size) {
 // So this doesn't install any atexit hook like on other platforms.
 void InstallAtExitCheckLeaks() {}
 
+void InstallAtForkHandler() {}
+
 }  // namespace __asan
 
 namespace __lsan {
diff --git a/compiler-rt/lib/asan/asan_internal.h 
b/compiler-rt/lib/asan/asan_internal.h
index 5b97e77882cd67..2944ebe213b5d5 100644
--- a/compiler-rt/lib/asan/asan_internal.h
+++ b/compiler-rt/lib/asan/asan_internal.h
@@ -126,6 +126,7 @@ void *AsanDlSymNext(const char *sym);
 bool HandleDlopenInit();
 
 void InstallAtExitCheckLeaks();
+void InstallAtForkHandler();
 
 #define ASAN_ON_ERROR() \
   if (&__asan_on_error) \
diff --git a/compiler-rt/lib/asan/asan_posix.cpp 
b/compiler-rt/lib/asan/asan_posix.cpp
index e1f66641617cc1..37fca8aea51511 100644
--- a/compiler-rt/lib/asan/asan_posix.cpp
+++ b/compiler-rt/lib/asan/asan_posix.cpp
@@ -148,6 +148,30 @@ void PlatformTSDDtor(void *tsd) {
 }
 #endif
 
+void InstallAtForkHandler() {
+  auto before = []() {
+if (CAN_SANITIZE_LEAKS) {
+  __lsan::LockGlobal();
+}
+// `_lsan` functions defined regardless of `CAN_SANITIZE_LEAKS` and do the
+// job.
+__lsan::LockThreads();
+__lsan::LockAllocator();
+StackDepotLockAll();
+  };
+  auto after = []() {
+StackDepotUnlockAll();
+// `_lsan` functions defined regardless of `CAN_SANITIZE_LEAKS` and do the
+// job.
+__lsan::UnlockAllocator();
+__lsan::UnlockThreads();
+if (CAN_SANITIZE_LEAKS) {
+  __lsan::UnlockGlobal();
+}
+  };
+  pthread_atfork(before, after, after);
+}
+
 void InstallAtExitCheckLeaks() {
   if (CAN_SANITIZE_LEAKS) {
 if (common_flags()->detect_leaks && common_flags()->leak_check_at_exit) {
diff --git a/compiler-rt/lib/asan/asan_rtl.cpp 
b/compiler-rt/lib/asan/asan_rtl.cpp
index b28f9f181239b3..a61deed7382b02 100644
--- a/compiler-rt/lib/asan/asan_rtl.cpp
+++ b/compiler-rt/lib/asan/asan_rtl.cpp
@@ -493,6 +493,8 @@ static bool AsanInitInternal() {
 InstallAtExitCheckLeaks();
   }
 
+  InstallAtForkHandler();
+
 #if CAN_SANITIZE_UB
   __ubsan::InitAsPlugin();
 #endif
diff --git a/compiler-rt/lib/asan/asan_win.cpp 
b/compiler-rt/lib/asan/asan_win.cpp
index d5a30f471e2b0d..f16ce677618e4f 100644
--- a/compiler-rt/lib/asan/asa

[Lldb-commits] [libunwind] [clang] [libc] [compiler-rt] [libcxx] [clang-tools-extra] [flang] [lldb] [lld] [mlir] [libcxxabi] [llvm] [hwasan] Improve support of forking with threads (PR #75291)

2023-12-13 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka closed 
https://github.com/llvm/llvm-project/pull/75291
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang-tools-extra] [lldb] [libcxxabi] [lld] [flang] [libunwind] [compiler-rt] [clang] [llvm] [libc] [libcxx] [mlir] [asan] Install `pthread_atfork` (PR #75290)

2023-12-15 Thread Vitaly Buka via lldb-commits

vitalybuka wrote:

That's bad, we need to fix this.
Do you see how we endup in handler, from `internal_fork`.
`internal_fork` claims it will not call handlers.

https://github.com/llvm/llvm-project/pull/75290
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [mlir] [compiler-rt] [lld] [libcxx] [flang] [llvm] [clang] [builtins] Refactor cpu_model support to reduce #if nesting. NFCI (PR #75635)

2023-12-19 Thread Vitaly Buka via lldb-commits

vitalybuka wrote:

Breaks https://lab.llvm.org/buildbot/#/builders/269/builds/2975

https://github.com/llvm/llvm-project/pull/75635
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [compiler-rt] [lldb] [llvm] [libunwind] [clang] [flang] [clang-tools-extra] [libc] Reland the reland "[PGO][GlobalValue][LTO]In GlobalValues::getGlobalIdentifier, use semicolon as delim

2023-12-19 Thread Vitaly Buka via lldb-commits

vitalybuka wrote:

It fails here 
https://lab.llvm.org/buildbot/#/builders/18/builds/13216

https://github.com/llvm/llvm-project/pull/75954
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [llvm] [compiler-rt] [lldb] [mlir] [clang] [openmp] [flang] [libc] [hwasan] Respect strip_path_prefix printing locals (PR #76132)

2023-12-21 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka edited 
https://github.com/llvm/llvm-project/pull/76132
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [llvm] [lldb] [mlir] [libc] [compiler-rt] [flang] [clang] [openmp] [hwasan] Respect strip_path_prefix printing locals (PR #76132)

2023-12-21 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/76132

>From 8c5b5de0d4fda16cfa1c8c4281601b61a9ca774d Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Wed, 20 Dec 2023 23:58:01 -0800
Subject: [PATCH 1/3] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4

[skip ci]
---
 compiler-rt/lib/hwasan/hwasan_report.cpp | 16 +++-
 .../test/hwasan/TestCases/Linux/syscalls.cpp |  2 +-
 .../test/hwasan/TestCases/heap-buffer-overflow.c |  7 ---
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/compiler-rt/lib/hwasan/hwasan_report.cpp 
b/compiler-rt/lib/hwasan/hwasan_report.cpp
index 5e8aa315801bcd..71155c9814c186 100644
--- a/compiler-rt/lib/hwasan/hwasan_report.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_report.cpp
@@ -233,7 +233,7 @@ static void PrintStackAllocations(const 
StackAllocationsRingBuffer *sa,
 if (obj_offset >= local.size)
   continue;
 if (!found_local) {
-  Printf("Potentially referenced stack objects:\n");
+  Printf("\nPotentially referenced stack objects:\n");
   found_local = true;
 }
 Printf("  %s in %s %s:%d\n", local.name, local.function_name,
@@ -363,7 +363,7 @@ static void PrintTagsAroundAddr(uptr addr, GetTag get_tag,
   InternalScopedString s;
   addr = MemToShadow(addr);
   s.AppendF(
-  "Memory tags around the buggy address (one tag corresponds to %zd "
+  "\nMemory tags around the buggy address (one tag corresponds to %zd "
   "bytes):\n",
   kShadowAlignment);
   PrintTagInfoAroundAddr(addr, kShadowLines, s,
@@ -648,19 +648,23 @@ void BaseReport::PrintHeapOrGlobalCandidate() const {
   if (candidate.heap.is_allocated) {
 uptr offset;
 const char *whence;
+const char *cause;
 if (candidate.heap.begin <= untagged_addr &&
 untagged_addr < candidate.heap.end) {
   offset = untagged_addr - candidate.heap.begin;
   whence = "inside";
+  cause = "heap-use-after-free";
 } else if (candidate.after) {
   offset = untagged_addr - candidate.heap.end;
   whence = "after";
+  cause = "heap-buffer-overflow";
 } else {
   offset = candidate.heap.begin - untagged_addr;
   whence = "before";
+  cause = "heap-buffer-underflow";
 }
 Printf("%s", d.Error());
-Printf("\nCause: heap-buffer-overflow\n");
+Printf("\nCause: %s\n", cause);
 Printf("%s", d.Default());
 Printf("%s", d.Location());
 Printf("%p is located %zd bytes %s a %zd-byte region [%p,%p)\n",
@@ -803,8 +807,10 @@ void BaseReport::PrintAddressDescription() const {
   }
 
   // Print the remaining threads, as an extra information, 1 line per thread.
-  if (flags()->print_live_threads_info)
+  if (flags()->print_live_threads_info) {
+Printf("\n");
 hwasanThreadList().VisitAllLiveThreads([&](Thread *t) { t->Announce(); });
+  }
 
   if (!num_descriptions_printed)
 // We exhausted our possibilities. Bail out.
@@ -1020,7 +1026,7 @@ void ReportTagMismatch(StackTrace *stack, uptr 
tagged_addr, uptr access_size,
 // See the frame breakdown defined in __hwasan_tag_mismatch (from
 // hwasan_tag_mismatch_{aarch64,riscv64}.S).
 void ReportRegisters(const uptr *frame, uptr pc) {
-  Printf("Registers where the failure occurred (pc %p):\n", pc);
+  Printf("\nRegisters where the failure occurred (pc %p):\n", pc);
 
   // We explicitly print a single line (4 registers/line) each iteration to
   // reduce the amount of logcat error messages printed. Each Printf() will
diff --git a/compiler-rt/test/hwasan/TestCases/Linux/syscalls.cpp 
b/compiler-rt/test/hwasan/TestCases/Linux/syscalls.cpp
index 154b6989899352..eee43f458fac10 100644
--- a/compiler-rt/test/hwasan/TestCases/Linux/syscalls.cpp
+++ b/compiler-rt/test/hwasan/TestCases/Linux/syscalls.cpp
@@ -26,7 +26,7 @@ int main(int argc, char *argv[]) {
 
   __sanitizer_syscall_pre_recvmsg(0, buf - 1, 0);
   // CHECK: HWAddressSanitizer: tag-mismatch on address [[PTR:0x[a-f0-9]+]]
-  // CHECK: Cause: heap-buffer-overflow
+  // CHECK: Cause: heap-buffer-underflow
   // CHECK: [[PTR]] is located 1 bytes before a 1000-byte region
 
   free(buf);
diff --git a/compiler-rt/test/hwasan/TestCases/heap-buffer-overflow.c 
b/compiler-rt/test/hwasan/TestCases/heap-buffer-overflow.c
index 4e6638be584b0d..c1c7d458b9424f 100644
--- a/compiler-rt/test/hwasan/TestCases/heap-buffer-overflow.c
+++ b/compiler-rt/test/hwasan/TestCases/heap-buffer-overflow.c
@@ -29,7 +29,8 @@ int main(int argc, char **argv) {
   if (size == 100) {
 fprintf(stderr, "is a large allocated heap chunk; size: 1003520 offset: 
%d\n",
 offset);
-fprintf(stderr, "Cause: heap-buffer-overflow\n");
+fprintf(stderr, "Cause: heap-buffer-%s\n",
+offset == -30 ? "underflow" : "overflow");
 fpri

[Lldb-commits] [compiler-rt] [flang] [llvm] [libc] [openmp] [clang] [lldb] [mlir] [hwasan] Respect strip_path_prefix printing locals (PR #76132)

2023-12-21 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/76132

>From 8c5b5de0d4fda16cfa1c8c4281601b61a9ca774d Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Wed, 20 Dec 2023 23:58:01 -0800
Subject: [PATCH 1/4] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4

[skip ci]
---
 compiler-rt/lib/hwasan/hwasan_report.cpp | 16 +++-
 .../test/hwasan/TestCases/Linux/syscalls.cpp |  2 +-
 .../test/hwasan/TestCases/heap-buffer-overflow.c |  7 ---
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/compiler-rt/lib/hwasan/hwasan_report.cpp 
b/compiler-rt/lib/hwasan/hwasan_report.cpp
index 5e8aa315801bcd..71155c9814c186 100644
--- a/compiler-rt/lib/hwasan/hwasan_report.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_report.cpp
@@ -233,7 +233,7 @@ static void PrintStackAllocations(const 
StackAllocationsRingBuffer *sa,
 if (obj_offset >= local.size)
   continue;
 if (!found_local) {
-  Printf("Potentially referenced stack objects:\n");
+  Printf("\nPotentially referenced stack objects:\n");
   found_local = true;
 }
 Printf("  %s in %s %s:%d\n", local.name, local.function_name,
@@ -363,7 +363,7 @@ static void PrintTagsAroundAddr(uptr addr, GetTag get_tag,
   InternalScopedString s;
   addr = MemToShadow(addr);
   s.AppendF(
-  "Memory tags around the buggy address (one tag corresponds to %zd "
+  "\nMemory tags around the buggy address (one tag corresponds to %zd "
   "bytes):\n",
   kShadowAlignment);
   PrintTagInfoAroundAddr(addr, kShadowLines, s,
@@ -648,19 +648,23 @@ void BaseReport::PrintHeapOrGlobalCandidate() const {
   if (candidate.heap.is_allocated) {
 uptr offset;
 const char *whence;
+const char *cause;
 if (candidate.heap.begin <= untagged_addr &&
 untagged_addr < candidate.heap.end) {
   offset = untagged_addr - candidate.heap.begin;
   whence = "inside";
+  cause = "heap-use-after-free";
 } else if (candidate.after) {
   offset = untagged_addr - candidate.heap.end;
   whence = "after";
+  cause = "heap-buffer-overflow";
 } else {
   offset = candidate.heap.begin - untagged_addr;
   whence = "before";
+  cause = "heap-buffer-underflow";
 }
 Printf("%s", d.Error());
-Printf("\nCause: heap-buffer-overflow\n");
+Printf("\nCause: %s\n", cause);
 Printf("%s", d.Default());
 Printf("%s", d.Location());
 Printf("%p is located %zd bytes %s a %zd-byte region [%p,%p)\n",
@@ -803,8 +807,10 @@ void BaseReport::PrintAddressDescription() const {
   }
 
   // Print the remaining threads, as an extra information, 1 line per thread.
-  if (flags()->print_live_threads_info)
+  if (flags()->print_live_threads_info) {
+Printf("\n");
 hwasanThreadList().VisitAllLiveThreads([&](Thread *t) { t->Announce(); });
+  }
 
   if (!num_descriptions_printed)
 // We exhausted our possibilities. Bail out.
@@ -1020,7 +1026,7 @@ void ReportTagMismatch(StackTrace *stack, uptr 
tagged_addr, uptr access_size,
 // See the frame breakdown defined in __hwasan_tag_mismatch (from
 // hwasan_tag_mismatch_{aarch64,riscv64}.S).
 void ReportRegisters(const uptr *frame, uptr pc) {
-  Printf("Registers where the failure occurred (pc %p):\n", pc);
+  Printf("\nRegisters where the failure occurred (pc %p):\n", pc);
 
   // We explicitly print a single line (4 registers/line) each iteration to
   // reduce the amount of logcat error messages printed. Each Printf() will
diff --git a/compiler-rt/test/hwasan/TestCases/Linux/syscalls.cpp 
b/compiler-rt/test/hwasan/TestCases/Linux/syscalls.cpp
index 154b6989899352..eee43f458fac10 100644
--- a/compiler-rt/test/hwasan/TestCases/Linux/syscalls.cpp
+++ b/compiler-rt/test/hwasan/TestCases/Linux/syscalls.cpp
@@ -26,7 +26,7 @@ int main(int argc, char *argv[]) {
 
   __sanitizer_syscall_pre_recvmsg(0, buf - 1, 0);
   // CHECK: HWAddressSanitizer: tag-mismatch on address [[PTR:0x[a-f0-9]+]]
-  // CHECK: Cause: heap-buffer-overflow
+  // CHECK: Cause: heap-buffer-underflow
   // CHECK: [[PTR]] is located 1 bytes before a 1000-byte region
 
   free(buf);
diff --git a/compiler-rt/test/hwasan/TestCases/heap-buffer-overflow.c 
b/compiler-rt/test/hwasan/TestCases/heap-buffer-overflow.c
index 4e6638be584b0d..c1c7d458b9424f 100644
--- a/compiler-rt/test/hwasan/TestCases/heap-buffer-overflow.c
+++ b/compiler-rt/test/hwasan/TestCases/heap-buffer-overflow.c
@@ -29,7 +29,8 @@ int main(int argc, char **argv) {
   if (size == 100) {
 fprintf(stderr, "is a large allocated heap chunk; size: 1003520 offset: 
%d\n",
 offset);
-fprintf(stderr, "Cause: heap-buffer-overflow\n");
+fprintf(stderr, "Cause: heap-buffer-%s\n",
+offset == -30 ? "underflow" : "overflow");
 fpri

[Lldb-commits] [compiler-rt] [flang] [llvm] [libc] [openmp] [clang] [lldb] [mlir] [hwasan] Respect strip_path_prefix printing locals (PR #76132)

2023-12-21 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka closed 
https://github.com/llvm/llvm-project/pull/76132
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [flang] [clang] [mlir] [llvm] [libcxx] [compiler-rt] [libc] [lldb] [openmp] [hwasan] Classify stack overflow, and use after scope (PR #76133)

2023-12-21 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka edited 
https://github.com/llvm/llvm-project/pull/76133
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [flang] [clang] [mlir] [llvm] [libcxx] [compiler-rt] [libc] [lldb] [openmp] [hwasan] Classify stack overflow, and use after scope (PR #76133)

2023-12-21 Thread Vitaly Buka via lldb-commits


@@ -221,29 +221,55 @@ static void PrintStackAllocations(const 
StackAllocationsRingBuffer *sa,
   for (LocalInfo &local : frame.locals) {
 if (!local.has_frame_offset || !local.has_size || 
!local.has_tag_offset)
   continue;
+if (!(local.name && internal_strlen(local.name)) &&
+!(local.function_name && internal_strlen(local.name)) &&
+!local.decl_file)

vitalybuka wrote:

will check

https://github.com/llvm/llvm-project/pull/76133
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [flang] [clang] [mlir] [llvm] [libcxx] [compiler-rt] [libc] [lldb] [openmp] [hwasan] Classify stack overflow, and use after scope (PR #76133)

2023-12-21 Thread Vitaly Buka via lldb-commits


@@ -0,0 +1,25 @@
+// RUN: %clang_hwasan -g %s -o %t && not %run %t 2>&1 | FileCheck %s
+
+// Stack histories currently are not recorded on x86.
+// XFAIL: target=x86_64{{.*}}
+
+__attribute((noinline)) void buggy() {
+  char c[64];
+  char *volatile p = c;
+  p[-2] = 0;
+}
+
+int main() {
+  buggy();
+  // CHECK: WRITE of size 1 at
+  // CHECK: #0 {{.*}} in buggy{{.*}}stack-underflow.c:[[@LINE-6]]
+  // CHECK: Cause: stack tag-mismatch

vitalybuka wrote:

The first one is true, the second one is "Potentially"

https://github.com/llvm/llvm-project/pull/76133
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [mlir] [openmp] [libcxx] [compiler-rt] [llvm] [lldb] [libc] [clang] [flang] [hwasan] Classify stack overflow, and use after scope (PR #76133)

2023-12-21 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/76133

>From 89636904337efe75ef6e0743e4f098f0d5b5ab56 Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Wed, 20 Dec 2023 23:58:05 -0800
Subject: [PATCH 1/3] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4

[skip ci]
---
 compiler-rt/lib/hwasan/hwasan_report.cpp  | 26 ++-
 .../test/hwasan/TestCases/Linux/syscalls.cpp  |  2 +-
 .../hwasan/TestCases/heap-buffer-overflow.c   |  7 ++---
 3 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/compiler-rt/lib/hwasan/hwasan_report.cpp 
b/compiler-rt/lib/hwasan/hwasan_report.cpp
index 5e8aa315801bcd..dc34cded48e12c 100644
--- a/compiler-rt/lib/hwasan/hwasan_report.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_report.cpp
@@ -205,6 +205,7 @@ static void PrintStackAllocations(const 
StackAllocationsRingBuffer *sa,
   tag_t addr_tag, uptr untagged_addr) {
   uptr frames = Min((uptr)flags()->stack_history_size, sa->size());
   bool found_local = false;
+  InternalScopedString location;
   for (uptr i = 0; i < frames; i++) {
 const uptr *record_addr = &(*sa)[i];
 uptr record = *record_addr;
@@ -233,11 +234,16 @@ static void PrintStackAllocations(const 
StackAllocationsRingBuffer *sa,
 if (obj_offset >= local.size)
   continue;
 if (!found_local) {
-  Printf("Potentially referenced stack objects:\n");
+  Printf("\nPotentially referenced stack objects:\n");
   found_local = true;
 }
-Printf("  %s in %s %s:%d\n", local.name, local.function_name,
-   local.decl_file, local.decl_line);
+StackTracePrinter::GetOrInit()->RenderSourceLocation(
+&location, local.decl_file, local.decl_line, 0,
+common_flags()->symbolize_vs_style,
+common_flags()->strip_path_prefix);
+Printf("  %s in %s %s\n", local.name, local.function_name,
+   location.data());
+location.clear();
   }
   frame.Clear();
 }
@@ -363,7 +369,7 @@ static void PrintTagsAroundAddr(uptr addr, GetTag get_tag,
   InternalScopedString s;
   addr = MemToShadow(addr);
   s.AppendF(
-  "Memory tags around the buggy address (one tag corresponds to %zd "
+  "\nMemory tags around the buggy address (one tag corresponds to %zd "
   "bytes):\n",
   kShadowAlignment);
   PrintTagInfoAroundAddr(addr, kShadowLines, s,
@@ -648,19 +654,23 @@ void BaseReport::PrintHeapOrGlobalCandidate() const {
   if (candidate.heap.is_allocated) {
 uptr offset;
 const char *whence;
+const char *cause;
 if (candidate.heap.begin <= untagged_addr &&
 untagged_addr < candidate.heap.end) {
   offset = untagged_addr - candidate.heap.begin;
   whence = "inside";
+  cause = "heap-use-after-free";
 } else if (candidate.after) {
   offset = untagged_addr - candidate.heap.end;
   whence = "after";
+  cause = "heap-buffer-overflow";
 } else {
   offset = candidate.heap.begin - untagged_addr;
   whence = "before";
+  cause = "heap-buffer-underflow";
 }
 Printf("%s", d.Error());
-Printf("\nCause: heap-buffer-overflow\n");
+Printf("\nCause: %s\n", cause);
 Printf("%s", d.Default());
 Printf("%s", d.Location());
 Printf("%p is located %zd bytes %s a %zd-byte region [%p,%p)\n",
@@ -803,8 +813,10 @@ void BaseReport::PrintAddressDescription() const {
   }
 
   // Print the remaining threads, as an extra information, 1 line per thread.
-  if (flags()->print_live_threads_info)
+  if (flags()->print_live_threads_info) {
+Printf("\n");
 hwasanThreadList().VisitAllLiveThreads([&](Thread *t) { t->Announce(); });
+  }
 
   if (!num_descriptions_printed)
 // We exhausted our possibilities. Bail out.
@@ -1020,7 +1032,7 @@ void ReportTagMismatch(StackTrace *stack, uptr 
tagged_addr, uptr access_size,
 // See the frame breakdown defined in __hwasan_tag_mismatch (from
 // hwasan_tag_mismatch_{aarch64,riscv64}.S).
 void ReportRegisters(const uptr *frame, uptr pc) {
-  Printf("Registers where the failure occurred (pc %p):\n", pc);
+  Printf("\nRegisters where the failure occurred (pc %p):\n", pc);
 
   // We explicitly print a single line (4 registers/line) each iteration to
   // reduce the amount of logcat error messages printed. Each Printf() will
diff --git a/compiler-rt/test/hwasan/TestCases/Linux/syscalls.cpp 
b/compiler-rt/test/hwasan/TestCases/Linux/syscalls.cpp
index 154b6989899352..eee43f458fac10 100644
--- a/compiler-rt/test/hwasan/TestCases/Linux/syscalls.cpp
+++ b/compiler-rt/test/hwasan/TestCases/Linux/syscalls.cpp
@@ -26,7 +26,7 @@ int main(int argc, char *argv[]) {
 
   __sanitizer_syscall_pre_recvmsg(0, buf - 1, 0);
   // CHECK: HWAddressSanitizer: tag-mismatch on

[Lldb-commits] [mlir] [openmp] [libcxx] [compiler-rt] [llvm] [lldb] [libc] [clang] [flang] [hwasan] Classify stack overflow, and use after scope (PR #76133)

2023-12-21 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/76133

>From 89636904337efe75ef6e0743e4f098f0d5b5ab56 Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Wed, 20 Dec 2023 23:58:05 -0800
Subject: [PATCH 1/4] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4

[skip ci]
---
 compiler-rt/lib/hwasan/hwasan_report.cpp  | 26 ++-
 .../test/hwasan/TestCases/Linux/syscalls.cpp  |  2 +-
 .../hwasan/TestCases/heap-buffer-overflow.c   |  7 ++---
 3 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/compiler-rt/lib/hwasan/hwasan_report.cpp 
b/compiler-rt/lib/hwasan/hwasan_report.cpp
index 5e8aa315801bcd..dc34cded48e12c 100644
--- a/compiler-rt/lib/hwasan/hwasan_report.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_report.cpp
@@ -205,6 +205,7 @@ static void PrintStackAllocations(const 
StackAllocationsRingBuffer *sa,
   tag_t addr_tag, uptr untagged_addr) {
   uptr frames = Min((uptr)flags()->stack_history_size, sa->size());
   bool found_local = false;
+  InternalScopedString location;
   for (uptr i = 0; i < frames; i++) {
 const uptr *record_addr = &(*sa)[i];
 uptr record = *record_addr;
@@ -233,11 +234,16 @@ static void PrintStackAllocations(const 
StackAllocationsRingBuffer *sa,
 if (obj_offset >= local.size)
   continue;
 if (!found_local) {
-  Printf("Potentially referenced stack objects:\n");
+  Printf("\nPotentially referenced stack objects:\n");
   found_local = true;
 }
-Printf("  %s in %s %s:%d\n", local.name, local.function_name,
-   local.decl_file, local.decl_line);
+StackTracePrinter::GetOrInit()->RenderSourceLocation(
+&location, local.decl_file, local.decl_line, 0,
+common_flags()->symbolize_vs_style,
+common_flags()->strip_path_prefix);
+Printf("  %s in %s %s\n", local.name, local.function_name,
+   location.data());
+location.clear();
   }
   frame.Clear();
 }
@@ -363,7 +369,7 @@ static void PrintTagsAroundAddr(uptr addr, GetTag get_tag,
   InternalScopedString s;
   addr = MemToShadow(addr);
   s.AppendF(
-  "Memory tags around the buggy address (one tag corresponds to %zd "
+  "\nMemory tags around the buggy address (one tag corresponds to %zd "
   "bytes):\n",
   kShadowAlignment);
   PrintTagInfoAroundAddr(addr, kShadowLines, s,
@@ -648,19 +654,23 @@ void BaseReport::PrintHeapOrGlobalCandidate() const {
   if (candidate.heap.is_allocated) {
 uptr offset;
 const char *whence;
+const char *cause;
 if (candidate.heap.begin <= untagged_addr &&
 untagged_addr < candidate.heap.end) {
   offset = untagged_addr - candidate.heap.begin;
   whence = "inside";
+  cause = "heap-use-after-free";
 } else if (candidate.after) {
   offset = untagged_addr - candidate.heap.end;
   whence = "after";
+  cause = "heap-buffer-overflow";
 } else {
   offset = candidate.heap.begin - untagged_addr;
   whence = "before";
+  cause = "heap-buffer-underflow";
 }
 Printf("%s", d.Error());
-Printf("\nCause: heap-buffer-overflow\n");
+Printf("\nCause: %s\n", cause);
 Printf("%s", d.Default());
 Printf("%s", d.Location());
 Printf("%p is located %zd bytes %s a %zd-byte region [%p,%p)\n",
@@ -803,8 +813,10 @@ void BaseReport::PrintAddressDescription() const {
   }
 
   // Print the remaining threads, as an extra information, 1 line per thread.
-  if (flags()->print_live_threads_info)
+  if (flags()->print_live_threads_info) {
+Printf("\n");
 hwasanThreadList().VisitAllLiveThreads([&](Thread *t) { t->Announce(); });
+  }
 
   if (!num_descriptions_printed)
 // We exhausted our possibilities. Bail out.
@@ -1020,7 +1032,7 @@ void ReportTagMismatch(StackTrace *stack, uptr 
tagged_addr, uptr access_size,
 // See the frame breakdown defined in __hwasan_tag_mismatch (from
 // hwasan_tag_mismatch_{aarch64,riscv64}.S).
 void ReportRegisters(const uptr *frame, uptr pc) {
-  Printf("Registers where the failure occurred (pc %p):\n", pc);
+  Printf("\nRegisters where the failure occurred (pc %p):\n", pc);
 
   // We explicitly print a single line (4 registers/line) each iteration to
   // reduce the amount of logcat error messages printed. Each Printf() will
diff --git a/compiler-rt/test/hwasan/TestCases/Linux/syscalls.cpp 
b/compiler-rt/test/hwasan/TestCases/Linux/syscalls.cpp
index 154b6989899352..eee43f458fac10 100644
--- a/compiler-rt/test/hwasan/TestCases/Linux/syscalls.cpp
+++ b/compiler-rt/test/hwasan/TestCases/Linux/syscalls.cpp
@@ -26,7 +26,7 @@ int main(int argc, char *argv[]) {
 
   __sanitizer_syscall_pre_recvmsg(0, buf - 1, 0);
   // CHECK: HWAddressSanitizer: tag-mismatch on

[Lldb-commits] [mlir] [openmp] [libcxx] [compiler-rt] [llvm] [lldb] [libc] [clang] [flang] [hwasan] Classify stack overflow, and use after scope (PR #76133)

2023-12-21 Thread Vitaly Buka via lldb-commits

vitalybuka wrote:

> Remove this comment?
> 
> Line 780
> 
> ```
> // TODO(fmayer): figure out how to distinguish use-after-return and
> // stack-buffer-overflow.
> ```

done

https://github.com/llvm/llvm-project/pull/76133
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [libc] [clang] [openmp] [flang] [libcxx] [llvm] [compiler-rt] [lldb] [mlir] [hwasan] Classify stack overflow, and use after scope (PR #76133)

2023-12-21 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka closed 
https://github.com/llvm/llvm-project/pull/76133
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [libcxx] [flang] [lldb] [lld] [clang] [libc] [clang-tools-extra] [compiler-rt] [llvm] [msan] Unwind stack before fatal reports (PR #77168)

2024-01-08 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/77168

>From d4953b7a14dfb1d351b543e2546d710ae30173ed Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Fri, 5 Jan 2024 18:42:43 -0800
Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
 =?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 compiler-rt/lib/msan/msan.h   |  3 ++
 compiler-rt/lib/msan/msan_allocator.cpp   | 29 ---
 compiler-rt/lib/msan/msan_new_delete.cpp  | 26 ++---
 .../TestCases/max_allocation_size.cpp | 10 ++-
 4 files changed, 47 insertions(+), 21 deletions(-)

diff --git a/compiler-rt/lib/msan/msan.h b/compiler-rt/lib/msan/msan.h
index 25fa2212bdadd3..b717161577a1db 100644
--- a/compiler-rt/lib/msan/msan.h
+++ b/compiler-rt/lib/msan/msan.h
@@ -321,6 +321,9 @@ const int STACK_TRACE_TAG_VPTR = STACK_TRACE_TAG_FIELDS + 1;
 stack.Unwind(pc, bp, nullptr, common_flags()->fast_unwind_on_fatal); \
   }
 
+#define GET_FATAL_STACK_TRACE \
+  GET_FATAL_STACK_TRACE_PC_BP(StackTrace::GetCurrentPc(), GET_CURRENT_FRAME())
+
 class ScopedThreadLocalStateBackup {
  public:
   ScopedThreadLocalStateBackup() { Backup(); }
diff --git a/compiler-rt/lib/msan/msan_allocator.cpp 
b/compiler-rt/lib/msan/msan_allocator.cpp
index 72a7f980d39fb0..f71f59cedf820e 100644
--- a/compiler-rt/lib/msan/msan_allocator.cpp
+++ b/compiler-rt/lib/msan/msan_allocator.cpp
@@ -180,17 +180,19 @@ void MsanThreadLocalMallocStorage::CommitBack() {
 
 static void *MsanAllocate(StackTrace *stack, uptr size, uptr alignment,
   bool zeroise) {
-  if (size > max_malloc_size) {
+  if (UNLIKELY(size > max_malloc_size)) {
 if (AllocatorMayReturnNull()) {
   Report("WARNING: MemorySanitizer failed to allocate 0x%zx bytes\n", 
size);
   return nullptr;
 }
-ReportAllocationSizeTooBig(size, max_malloc_size, stack);
+GET_FATAL_STACK_TRACE;
+ReportAllocationSizeTooBig(size, max_malloc_size, &stack);
   }
   if (UNLIKELY(IsRssLimitExceeded())) {
 if (AllocatorMayReturnNull())
   return nullptr;
-ReportRssLimitExceeded(stack);
+GET_FATAL_STACK_TRACE;
+ReportRssLimitExceeded(&stack);
   }
   MsanThread *t = GetCurrentThread();
   void *allocated;
@@ -206,7 +208,8 @@ static void *MsanAllocate(StackTrace *stack, uptr size, 
uptr alignment,
 SetAllocatorOutOfMemory();
 if (AllocatorMayReturnNull())
   return nullptr;
-ReportOutOfMemory(size, stack);
+GET_FATAL_STACK_TRACE;
+ReportOutOfMemory(size, &stack);
   }
   Metadata *meta =
   reinterpret_cast(allocator.GetMetaData(allocated));
@@ -288,7 +291,8 @@ static void *MsanCalloc(StackTrace *stack, uptr nmemb, uptr 
size) {
   if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) {
 if (AllocatorMayReturnNull())
   return nullptr;
-ReportCallocOverflow(nmemb, size, stack);
+GET_FATAL_STACK_TRACE;
+ReportCallocOverflow(nmemb, size, &stack);
   }
   return MsanAllocate(stack, nmemb * size, sizeof(u64), true);
 }
@@ -343,7 +347,8 @@ void *msan_reallocarray(void *ptr, uptr nmemb, uptr size, 
StackTrace *stack) {
 errno = errno_ENOMEM;
 if (AllocatorMayReturnNull())
   return nullptr;
-ReportReallocArrayOverflow(nmemb, size, stack);
+GET_FATAL_STACK_TRACE;
+ReportReallocArrayOverflow(nmemb, size, &stack);
   }
   return msan_realloc(ptr, nmemb * size, stack);
 }
@@ -358,7 +363,8 @@ void *msan_pvalloc(uptr size, StackTrace *stack) {
 errno = errno_ENOMEM;
 if (AllocatorMayReturnNull())
   return nullptr;
-ReportPvallocOverflow(size, stack);
+GET_FATAL_STACK_TRACE;
+ReportPvallocOverflow(size, &stack);
   }
   // pvalloc(0) should allocate one page.
   size = size ? RoundUpTo(size, PageSize) : PageSize;
@@ -370,7 +376,8 @@ void *msan_aligned_alloc(uptr alignment, uptr size, 
StackTrace *stack) {
 errno = errno_EINVAL;
 if (AllocatorMayReturnNull())
   return nullptr;
-ReportInvalidAlignedAllocAlignment(size, alignment, stack);
+GET_FATAL_STACK_TRACE;
+ReportInvalidAlignedAllocAlignment(size, alignment, &stack);
   }
   return SetErrnoOnNull(MsanAllocate(stack, size, alignment, false));
 }
@@ -380,7 +387,8 @@ void *msan_memalign(uptr alignment, uptr size, StackTrace 
*stack) {
 errno = errno_EINVAL;
 if (AllocatorMayReturnNull())
   return nullptr;
-ReportInvalidAllocationAlignment(alignment, stack);
+GET_FATAL_STACK_TRACE;
+ReportInvalidAllocationAlignment(alignment, &stack);
   }
   return SetErrnoOnNull(MsanAllocate(stack, size, alignment, false));
 }
@@ -390,7 +398,8 @@ int msan_posix_memalign(void **memptr, uptr alignment, uptr 
size,
   if (UNLIKELY(!CheckPosixMemalignAlignment(alignment))) {
 if (AllocatorMayReturnNull())
   return errno_EINVAL;
-ReportInvalidPosixMemalignAlignment(alignment, stack);
+GET_FATAL_STA

[Lldb-commits] [compiler-rt] [libcxx] [mlir] [clang] [clang-tools-extra] [lld] [libcxxabi] [lldb] [libc] [openmp] [llvm] [msan] Unwind stack before fatal reports (PR #77168)

2024-01-08 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/77168

>From a127373cf1ac1676ce17ce8dca909d0c3bce9d18 Mon Sep 17 00:00:00 2001
From: Vitaly Buka 
Date: Mon, 8 Jan 2024 11:45:37 -0800
Subject: [PATCH 1/2] [NFC][msan] Switch allocator interface to use
 BufferedStackTrace

We will need it to unwind for fatal errors.

Pull Request: https://github.com/llvm/llvm-project/pull/77363
---
 compiler-rt/lib/msan/msan.h | 23 ++--
 compiler-rt/lib/msan/msan_allocator.cpp | 29 +
 2 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/compiler-rt/lib/msan/msan.h b/compiler-rt/lib/msan/msan.h
index 25fa2212bdadd3..753e6b260734f9 100644
--- a/compiler-rt/lib/msan/msan.h
+++ b/compiler-rt/lib/msan/msan.h
@@ -255,18 +255,19 @@ char *GetProcSelfMaps();
 void InitializeInterceptors();
 
 void MsanAllocatorInit();
-void MsanDeallocate(StackTrace *stack, void *ptr);
-
-void *msan_malloc(uptr size, StackTrace *stack);
-void *msan_calloc(uptr nmemb, uptr size, StackTrace *stack);
-void *msan_realloc(void *ptr, uptr size, StackTrace *stack);
-void *msan_reallocarray(void *ptr, uptr nmemb, uptr size, StackTrace *stack);
-void *msan_valloc(uptr size, StackTrace *stack);
-void *msan_pvalloc(uptr size, StackTrace *stack);
-void *msan_aligned_alloc(uptr alignment, uptr size, StackTrace *stack);
-void *msan_memalign(uptr alignment, uptr size, StackTrace *stack);
+void MsanDeallocate(BufferedStackTrace *stack, void *ptr);
+
+void *msan_malloc(uptr size, BufferedStackTrace *stack);
+void *msan_calloc(uptr nmemb, uptr size, BufferedStackTrace *stack);
+void *msan_realloc(void *ptr, uptr size, BufferedStackTrace *stack);
+void *msan_reallocarray(void *ptr, uptr nmemb, uptr size,
+BufferedStackTrace *stack);
+void *msan_valloc(uptr size, BufferedStackTrace *stack);
+void *msan_pvalloc(uptr size, BufferedStackTrace *stack);
+void *msan_aligned_alloc(uptr alignment, uptr size, BufferedStackTrace *stack);
+void *msan_memalign(uptr alignment, uptr size, BufferedStackTrace *stack);
 int msan_posix_memalign(void **memptr, uptr alignment, uptr size,
-StackTrace *stack);
+BufferedStackTrace *stack);
 
 void InstallTrapHandler();
 void InstallAtExitHandler();
diff --git a/compiler-rt/lib/msan/msan_allocator.cpp 
b/compiler-rt/lib/msan/msan_allocator.cpp
index 72a7f980d39fb0..987c894c79d45e 100644
--- a/compiler-rt/lib/msan/msan_allocator.cpp
+++ b/compiler-rt/lib/msan/msan_allocator.cpp
@@ -178,7 +178,7 @@ void MsanThreadLocalMallocStorage::CommitBack() {
   allocator.DestroyCache(GetAllocatorCache(this));
 }
 
-static void *MsanAllocate(StackTrace *stack, uptr size, uptr alignment,
+static void *MsanAllocate(BufferedStackTrace *stack, uptr size, uptr alignment,
   bool zeroise) {
   if (size > max_malloc_size) {
 if (AllocatorMayReturnNull()) {
@@ -229,7 +229,7 @@ static void *MsanAllocate(StackTrace *stack, uptr size, 
uptr alignment,
   return allocated;
 }
 
-void MsanDeallocate(StackTrace *stack, void *p) {
+void MsanDeallocate(BufferedStackTrace *stack, void *p) {
   CHECK(p);
   UnpoisonParam(1);
   RunFreeHooks(p);
@@ -259,8 +259,8 @@ void MsanDeallocate(StackTrace *stack, void *p) {
   }
 }
 
-static void *MsanReallocate(StackTrace *stack, void *old_p, uptr new_size,
-uptr alignment) {
+static void *MsanReallocate(BufferedStackTrace *stack, void *old_p,
+uptr new_size, uptr alignment) {
   Metadata *meta = reinterpret_cast(allocator.GetMetaData(old_p));
   uptr old_size = meta->requested_size;
   uptr actually_allocated_size = allocator.GetActuallyAllocatedSize(old_p);
@@ -284,7 +284,7 @@ static void *MsanReallocate(StackTrace *stack, void *old_p, 
uptr new_size,
   return new_p;
 }
 
-static void *MsanCalloc(StackTrace *stack, uptr nmemb, uptr size) {
+static void *MsanCalloc(BufferedStackTrace *stack, uptr nmemb, uptr size) {
   if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) {
 if (AllocatorMayReturnNull())
   return nullptr;
@@ -320,15 +320,15 @@ static uptr AllocationSizeFast(const void *p) {
   return reinterpret_cast(allocator.GetMetaData(p))->requested_size;
 }
 
-void *msan_malloc(uptr size, StackTrace *stack) {
+void *msan_malloc(uptr size, BufferedStackTrace *stack) {
   return SetErrnoOnNull(MsanAllocate(stack, size, sizeof(u64), false));
 }
 
-void *msan_calloc(uptr nmemb, uptr size, StackTrace *stack) {
+void *msan_calloc(uptr nmemb, uptr size, BufferedStackTrace *stack) {
   return SetErrnoOnNull(MsanCalloc(stack, nmemb, size));
 }
 
-void *msan_realloc(void *ptr, uptr size, StackTrace *stack) {
+void *msan_realloc(void *ptr, uptr size, BufferedStackTrace *stack) {
   if (!ptr)
 return SetErrnoOnNull(MsanAllocate(stack, size, sizeof(u64), false));
   if (size == 0) {
@@ -338,7 +338,8 @@ void *msan_realloc(void *ptr, uptr size, StackTrace *stack) 
{
   return SetErrno

[Lldb-commits] [compiler-rt] [libcxx] [mlir] [clang] [clang-tools-extra] [lld] [libcxxabi] [lldb] [libc] [openmp] [llvm] [msan] Unwind stack before fatal reports (PR #77168)

2024-01-08 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka closed 
https://github.com/llvm/llvm-project/pull/77168
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [flang] [libc] [libcxx] [lld] [lldb] [llvm] [NFC][IR] Add SetNoSanitize helpers (PR #86772)

2024-03-27 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka edited 
https://github.com/llvm/llvm-project/pull/86772
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [compiler-rt] [flang] [libc] [libcxx] [lld] [lldb] [llvm] [NFC][IR] Add SetNoSanitize helpers (PR #86772)

2024-03-27 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka closed 
https://github.com/llvm/llvm-project/pull/86772
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [llvm] [lldb] [lld] [libc] [libcxx] [flang] [libcxxabi] [clang] [msan] Unpoison indirect outputs for userspace using llvm.memset.* (PR #79924)

2024-01-30 Thread Vitaly Buka via lldb-commits


@@ -4552,16 +4552,22 @@ struct MemorySanitizerVisitor : public 
InstVisitor {
 }
 if (!ElemTy->isSized())
   return;
-Value *SizeVal =
-  IRB.CreateTypeSize(MS.IntptrTy, DL.getTypeStoreSize(ElemTy));
+auto Size = DL.getTypeStoreSize(ElemTy);
+Value *SizeVal = IRB.CreateTypeSize(MS.IntptrTy, Size);
 if (MS.CompileKernel) {
   IRB.CreateCall(MS.MsanInstrumentAsmStoreFn, {Operand, SizeVal});
 } else {
   // ElemTy, derived from elementtype(), does not encode the alignment of
   // the pointer. Conservatively assume that the shadow memory is 
unaligned.
+  // When Size is large, avoid StoreInst as it would expand to many
+  // instructions.
   auto [ShadowPtr, _] =
   getShadowOriginPtrUserspace(Operand, IRB, IRB.getInt8Ty(), Align(1));
-  IRB.CreateAlignedStore(getCleanShadow(ElemTy), ShadowPtr, Align(1));
+  if (Size <= 32)
+IRB.CreateAlignedStore(getCleanShadow(ElemTy), ShadowPtr, Align(1));
+  else
+IRB.CreateMemSet(ShadowPtr, ConstantInt::getNullValue(IRB.getInt8Ty()),

vitalybuka wrote:

it will hit interceptor

https://github.com/llvm/llvm-project/pull/79924
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [llvm] [lldb] [lld] [libc] [libcxx] [flang] [libcxxabi] [clang] [msan] Unpoison indirect outputs for userspace using llvm.memset.* (PR #79924)

2024-01-30 Thread Vitaly Buka via lldb-commits


@@ -4552,16 +4552,22 @@ struct MemorySanitizerVisitor : public 
InstVisitor {
 }
 if (!ElemTy->isSized())
   return;
-Value *SizeVal =
-  IRB.CreateTypeSize(MS.IntptrTy, DL.getTypeStoreSize(ElemTy));
+auto Size = DL.getTypeStoreSize(ElemTy);
+Value *SizeVal = IRB.CreateTypeSize(MS.IntptrTy, Size);
 if (MS.CompileKernel) {
   IRB.CreateCall(MS.MsanInstrumentAsmStoreFn, {Operand, SizeVal});
 } else {
   // ElemTy, derived from elementtype(), does not encode the alignment of
   // the pointer. Conservatively assume that the shadow memory is 
unaligned.
+  // When Size is large, avoid StoreInst as it would expand to many
+  // instructions.
   auto [ShadowPtr, _] =
   getShadowOriginPtrUserspace(Operand, IRB, IRB.getInt8Ty(), Align(1));
-  IRB.CreateAlignedStore(getCleanShadow(ElemTy), ShadowPtr, Align(1));
+  if (Size <= 32)
+IRB.CreateAlignedStore(getCleanShadow(ElemTy), ShadowPtr, Align(1));
+  else
+IRB.CreateMemSet(ShadowPtr, ConstantInt::getNullValue(IRB.getInt8Ty()),

vitalybuka wrote:

Never mind, we do this all the time here.

https://github.com/llvm/llvm-project/pull/79924
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [llvm] [lldb] [lld] [libc] [libcxx] [flang] [libcxxabi] [clang] [msan] Unpoison indirect outputs for userspace using llvm.memset.* (PR #79924)

2024-01-30 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka approved this pull request.


https://github.com/llvm/llvm-project/pull/79924
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [libcxxabi] [lldb] [flang] [lld] [llvm] [libcxx] [libc] [msan] Unpoison indirect outputs for userspace using memset for large operands (PR #79924)

2024-02-02 Thread Vitaly Buka via lldb-commits


@@ -4552,16 +4552,22 @@ struct MemorySanitizerVisitor : public 
InstVisitor {
 }
 if (!ElemTy->isSized())
   return;
-Value *SizeVal =
-  IRB.CreateTypeSize(MS.IntptrTy, DL.getTypeStoreSize(ElemTy));
+auto Size = DL.getTypeStoreSize(ElemTy);
+Value *SizeVal = IRB.CreateTypeSize(MS.IntptrTy, Size);
 if (MS.CompileKernel) {
   IRB.CreateCall(MS.MsanInstrumentAsmStoreFn, {Operand, SizeVal});
 } else {
   // ElemTy, derived from elementtype(), does not encode the alignment of
   // the pointer. Conservatively assume that the shadow memory is 
unaligned.
+  // When Size is large, avoid StoreInst as it would expand to many
+  // instructions.
   auto [ShadowPtr, _] =
   getShadowOriginPtrUserspace(Operand, IRB, IRB.getInt8Ty(), Align(1));
-  IRB.CreateAlignedStore(getCleanShadow(ElemTy), ShadowPtr, Align(1));
+  if (Size <= 32)

vitalybuka wrote:

Memset will go into interceptor and do a lot of check, see `__msan_memset`, so 
it's more expensive than a regular memset. I can't tell what can be optimal 
constant here, but I would expect something larger. But I doubt it will make a 
meaningful difference.

https://github.com/llvm/llvm-project/pull/79924
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] f3f9045 - [lldb] Fix leak in test

2021-06-11 Thread Vitaly Buka via lldb-commits

Author: Vitaly Buka
Date: 2021-06-11T00:20:35-07:00
New Revision: f3f904563ec9ce8c7bfda83bbca19790cc4d9afc

URL: 
https://github.com/llvm/llvm-project/commit/f3f904563ec9ce8c7bfda83bbca19790cc4d9afc
DIFF: 
https://github.com/llvm/llvm-project/commit/f3f904563ec9ce8c7bfda83bbca19790cc4d9afc.diff

LOG: [lldb] Fix leak in test

Test leaks if we run
tools/lldb/unittests/Host/HostTests without --gtest_filter

Reviewed By: teemperor

Differential Revision: https://reviews.llvm.org/D104091

Added: 


Modified: 
lldb/include/lldb/Host/linux/HostInfoLinux.h
lldb/source/Host/linux/HostInfoLinux.cpp
lldb/unittests/Host/HostInfoTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Host/linux/HostInfoLinux.h 
b/lldb/include/lldb/Host/linux/HostInfoLinux.h
index e8080033cd8f8..4a7bb6cc11fbb 100644
--- a/lldb/include/lldb/Host/linux/HostInfoLinux.h
+++ b/lldb/include/lldb/Host/linux/HostInfoLinux.h
@@ -28,6 +28,7 @@ class HostInfoLinux : public HostInfoPosix {
 
 public:
   static void Initialize(SharedLibraryDirectoryHelper *helper = nullptr);
+  static void Terminate();
 
   static llvm::VersionTuple GetOSVersion();
   static bool GetOSBuildString(std::string &s);

diff  --git a/lldb/source/Host/linux/HostInfoLinux.cpp 
b/lldb/source/Host/linux/HostInfoLinux.cpp
index 36ac0ec6c3c37..6c37b97d7ccfb 100644
--- a/lldb/source/Host/linux/HostInfoLinux.cpp
+++ b/lldb/source/Host/linux/HostInfoLinux.cpp
@@ -41,6 +41,13 @@ void HostInfoLinux::Initialize(SharedLibraryDirectoryHelper 
*helper) {
   g_fields = new HostInfoLinuxFields();
 }
 
+void HostInfoLinux::Terminate() {
+  assert(g_fields && "Missing call to Initialize?");
+  delete g_fields;
+  g_fields = nullptr;
+  HostInfoBase::Terminate();
+}
+
 llvm::VersionTuple HostInfoLinux::GetOSVersion() {
   assert(g_fields && "Missing call to Initialize?");
   llvm::call_once(g_fields->m_os_version_once_flag, []() {

diff  --git a/lldb/unittests/Host/HostInfoTest.cpp 
b/lldb/unittests/Host/HostInfoTest.cpp
index 96d47d75794a3..0accdd8dbcdbf 100644
--- a/lldb/unittests/Host/HostInfoTest.cpp
+++ b/lldb/unittests/Host/HostInfoTest.cpp
@@ -60,3 +60,16 @@ TEST_F(HostInfoTest, GetXcodeSDK) {
   
EXPECT_TRUE(HostInfo::GetXcodeSDKPath(XcodeSDK("CeciNestPasUnOS.sdk")).empty());
 }
 #endif
+
+TEST(HostInfoTestInitialization, InitTwice) {
+  llvm::VersionTuple Version;
+  {
+SubsystemRAII subsystems;
+Version = HostInfo::GetOSVersion();
+  }
+
+  {
+SubsystemRAII subsystems;
+EXPECT_EQ(Version, HostInfo::GetOSVersion());
+  }
+}



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] Upcoming upgrade of LLVM buildbot

2020-10-07 Thread Vitaly Buka via lldb-commits
It looks like all sanitizer builder are still offline
http://lab.llvm.org:8011/#/builders

On Tue, 6 Oct 2020 at 00:34, Galina Kistanova via cfe-commits <
cfe-comm...@lists.llvm.org> wrote:

> Hello everyone,
>
> The staging buildbot was up and running for 6 days now, and looks good.
>
> Tomorrow at 12:00 PM PDT we will switch the production buildbot to the new
> version.
>
> If you are a bot owner, you do not need to do anything at this point,
> unless I'll ask you to help.
> The buildbot will go down for a short period of time, and then a new
> version will come up and will accept connections from your bots.
>
> Please note that the new version has a bit different URL structure. You
> will need to update the bookmarks or scripts if you have stored direct URLs
> to inside the buldbot.
>
> We will be watching the production and staging bots and will be improving
> zorg for the next week or so.
>
> I will need your feedback about blame e-mails delivery, IRC reporting
> issues, and anything you could spot wrong with the new bot. I  hope the
> transition will go smoothly and we will handle issues quickly if any would
> come up.
>
> After production is good and we have about a week of running history, I'll
> ask the bot owners to upgrade buildbots on their side. Please do not
> upgrade your buildbots unless I'll ask you to. We are trying to limit a
> number of moving parts at this stage. We will start accepting change to
> zorg at this point. Please feel free to talk to me if you will have a
> special situation and if you would absolutely have to make changes.
>
> Thanks for your support and help. And please feel free to ask if you have
> questions.
>
> Galina
>
>
> On Thu, Sep 10, 2020 at 9:35 PM Galina Kistanova 
> wrote:
>
>> Hello everyone,
>>
>> The buildbot upgrade is entering the phase when the results to become
>> visible.
>>
>> No change is required at this time on any of the builders. The bot owners
>> could upgrade the buildbot on build computers later, at their convenience,
>> as this is not on the critical path.
>>
>> We are going to upgrade the staging bot first. Then, once that is stable
>> and all detected issues are resolved, we will upgrade the production bot.
>>
>> I will need some help with testing, and will be asking to move some of
>> the builders temporarily to the staging. LLVM buildbot is a piece of
>> critical infrastructure, so more eyes and hands in making sure it works
>> properly the better.
>>
>> I'll be posting updates and ETA of particular changes in this thread.
>>
>> Please feel free to ask if you have any questions or concerns.
>>
>> Thanks
>>
>> Galina
>>
>> ___
> cfe-commits mailing list
> cfe-comm...@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] Upcoming upgrade of LLVM buildbot

2020-10-12 Thread Vitaly Buka via lldb-commits
Thanks, I see them.

On Wed, 7 Oct 2020 at 16:32, Galina Kistanova  wrote:

> They are online now - http://lab.llvm.org:8011/#/waterfall?tags=sanitizer
>
> AnnotatedCommand has severe design conflict with the new buildbot.
> We have changed it to be safe and still do something useful, but it will
> need more love and care.
>
> Please let me know if you have some spare time to work on porting
> AnnotatedCommand.
>
> It's unlikely in near future.
What is missing exactly?


> Thanks
>
> Galina
>
> On Wed, Oct 7, 2020 at 2:57 PM Vitaly Buka  wrote:
>
>> It looks like all sanitizer builder are still offline
>> http://lab.llvm.org:8011/#/builders
>>
>> On Tue, 6 Oct 2020 at 00:34, Galina Kistanova via cfe-commits <
>> cfe-comm...@lists.llvm.org> wrote:
>>
>>> Hello everyone,
>>>
>>> The staging buildbot was up and running for 6 days now, and looks good.
>>>
>>> Tomorrow at 12:00 PM PDT we will switch the production buildbot to the
>>> new version.
>>>
>>> If you are a bot owner, you do not need to do anything at this point,
>>> unless I'll ask you to help.
>>> The buildbot will go down for a short period of time, and then a new
>>> version will come up and will accept connections from your bots.
>>>
>>> Please note that the new version has a bit different URL structure. You
>>> will need to update the bookmarks or scripts if you have stored direct URLs
>>> to inside the buldbot.
>>>
>>> We will be watching the production and staging bots and will be
>>> improving zorg for the next week or so.
>>>
>>> I will need your feedback about blame e-mails delivery, IRC reporting
>>> issues, and anything you could spot wrong with the new bot. I  hope the
>>> transition will go smoothly and we will handle issues quickly if any would
>>> come up.
>>>
>>> After production is good and we have about a week of running history,
>>> I'll ask the bot owners to upgrade buildbots on their side. Please do
>>> not upgrade your buildbots unless I'll ask you to. We are trying to
>>> limit a number of moving parts at this stage. We will start accepting
>>> change to zorg at this point. Please feel free to talk to me if you will
>>> have a special situation and if you would absolutely have to make changes.
>>>
>>> Thanks for your support and help. And please feel free to ask if you
>>> have questions.
>>>
>>> Galina
>>>
>>>
>>> On Thu, Sep 10, 2020 at 9:35 PM Galina Kistanova 
>>> wrote:
>>>
 Hello everyone,

 The buildbot upgrade is entering the phase when the results to become
 visible.

 No change is required at this time on any of the builders. The bot
 owners could upgrade the buildbot on build computers later, at their
 convenience, as this is not on the critical path.

 We are going to upgrade the staging bot first. Then, once that is
 stable and all detected issues are resolved, we will upgrade the production
 bot.

 I will need some help with testing, and will be asking to move some of
 the builders temporarily to the staging. LLVM buildbot is a piece of
 critical infrastructure, so more eyes and hands in making sure it works
 properly the better.

 I'll be posting updates and ETA of particular changes in this thread.

 Please feel free to ask if you have any questions or concerns.

 Thanks

 Galina

 ___
>>> cfe-commits mailing list
>>> cfe-comm...@lists.llvm.org
>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>>
>>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] Upcoming upgrade of LLVM buildbot

2020-10-12 Thread Vitaly Buka via lldb-commits
Switched all but PPC, I don't have access to them. But they run the same
script as sanitizer-x86_64-linux.
http://lab.llvm.org:8014/#/waterfall?tags=sanitizer

On Mon, 12 Oct 2020 at 19:19, Galina Kistanova  wrote:

> We have a better version of AnnotatedCommand on the staging. It should be
> a functional equivalent of the old one.
> We need to stress test it well before moving to the production build bot.
>
> For that we need all sanitizer + other bots which use the AnnotatedCommand
> directly or indirectly moved temporarily to the staging.
>
> Please let me know when that could be arranged.
>
> Thanks
>
> Galina
>
> On Mon, Oct 12, 2020 at 11:39 AM Reid Kleckner  wrote:
>
>> On Wed, Oct 7, 2020 at 4:32 PM Galina Kistanova via lldb-commits <
>> lldb-commits@lists.llvm.org> wrote:
>>
>>> They are online now -
>>> http://lab.llvm.org:8011/#/waterfall?tags=sanitizer
>>>
>>> AnnotatedCommand has severe design conflict with the new buildbot.
>>> We have changed it to be safe and still do something useful, but it will
>>> need more love and care.
>>>
>>> Please let me know if you have some spare time to work on porting
>>> AnnotatedCommand.
>>>
>>
>> That's unfortunate, it would've been good to know that earlier. I and
>> another team member have spent a fair amount of time porting things to use
>> more AnnotatedCommand steps, because it gives us the flexibility to test
>> steps locally and make changes to the steps without restarting the buildbot
>> master. IMO that is the Right Way to define steps: a script that you can
>> run locally on a machine that satisfies the OS and dep requirements of the
>> script.
>>
>> I am restarting the two bots that I am responsible for, and may need some
>> help debugging further issues soon. I'll let you know.
>>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] Upcoming upgrade of LLVM buildbot

2020-10-12 Thread Vitaly Buka via lldb-commits
Looks like staging AnnotatedCommand fixed step statuses, so we can see
which one is green.
Please let me know when to switch bots back from the staging.
Thank you!

On Mon, 12 Oct 2020 at 21:38, Vitaly Buka  wrote:

> Switched all but PPC, I don't have access to them. But they run the same
> script as sanitizer-x86_64-linux.
> http://lab.llvm.org:8014/#/waterfall?tags=sanitizer
>
> On Mon, 12 Oct 2020 at 19:19, Galina Kistanova 
> wrote:
>
>> We have a better version of AnnotatedCommand on the staging. It should be
>> a functional equivalent of the old one.
>> We need to stress test it well before moving to the production build bot.
>>
>> For that we need all sanitizer + other bots which use the
>> AnnotatedCommand directly or indirectly moved temporarily to the staging.
>>
>> Please let me know when that could be arranged.
>>
>> Thanks
>>
>> Galina
>>
>> On Mon, Oct 12, 2020 at 11:39 AM Reid Kleckner  wrote:
>>
>>> On Wed, Oct 7, 2020 at 4:32 PM Galina Kistanova via lldb-commits <
>>> lldb-commits@lists.llvm.org> wrote:
>>>
 They are online now -
 http://lab.llvm.org:8011/#/waterfall?tags=sanitizer

 AnnotatedCommand has severe design conflict with the new buildbot.
 We have changed it to be safe and still do something useful, but it
 will need more love and care.

 Please let me know if you have some spare time to work on porting
 AnnotatedCommand.

>>>
>>> That's unfortunate, it would've been good to know that earlier. I and
>>> another team member have spent a fair amount of time porting things to use
>>> more AnnotatedCommand steps, because it gives us the flexibility to test
>>> steps locally and make changes to the steps without restarting the buildbot
>>> master. IMO that is the Right Way to define steps: a script that you can
>>> run locally on a machine that satisfies the OS and dep requirements of the
>>> script.
>>>
>>> I am restarting the two bots that I am responsible for, and may need
>>> some help debugging further issues soon. I'll let you know.
>>>
>>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] Upcoming upgrade of LLVM buildbot

2020-10-13 Thread Vitaly Buka via lldb-commits
On Mon, 12 Oct 2020 at 22:01, Galina Kistanova  wrote:

> Thanks, Vitaly!
>
> Let's have them there for at least 24 hours, shall we?
>

We can do that.


>
> Could you move sanitizer-buildbot1, sanitizer-buildbot3,
> sanitizer-buildbot7 as well, please?
>

Done.


> AnnotatedCommand on the staging has been tested functionally and is good.
> My only concern at this point is how it would handle a heavy load, so the
> more bots we will have on the staging the better.
>
> If somebody else could move their AnnotatedCommand bots to the staging
> area, that would be much appreciated.
>
> Thanks
>
> Galina
>
> On Mon, Oct 12, 2020 at 9:45 PM Vitaly Buka  wrote:
>
>> Looks like staging AnnotatedCommand fixed step statuses, so we can see
>> which one is green.
>> Please let me know when to switch bots back from the staging.
>> Thank you!
>>
>> On Mon, 12 Oct 2020 at 21:38, Vitaly Buka  wrote:
>>
>>> Switched all but PPC, I don't have access to them. But they run the same
>>> script as sanitizer-x86_64-linux.
>>> http://lab.llvm.org:8014/#/waterfall?tags=sanitizer
>>>
>>> On Mon, 12 Oct 2020 at 19:19, Galina Kistanova 
>>> wrote:
>>>
 We have a better version of AnnotatedCommand on the staging. It should
 be a functional equivalent of the old one.
 We need to stress test it well before moving to the production build
 bot.

 For that we need all sanitizer + other bots which use the
 AnnotatedCommand directly or indirectly moved temporarily to the staging.

 Please let me know when that could be arranged.

 Thanks

 Galina

 On Mon, Oct 12, 2020 at 11:39 AM Reid Kleckner  wrote:

> On Wed, Oct 7, 2020 at 4:32 PM Galina Kistanova via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
>
>> They are online now -
>> http://lab.llvm.org:8011/#/waterfall?tags=sanitizer
>>
>> AnnotatedCommand has severe design conflict with the new buildbot.
>> We have changed it to be safe and still do something useful, but it
>> will need more love and care.
>>
>> Please let me know if you have some spare time to work on porting
>> AnnotatedCommand.
>>
>
> That's unfortunate, it would've been good to know that earlier. I and
> another team member have spent a fair amount of time porting things to use
> more AnnotatedCommand steps, because it gives us the flexibility to test
> steps locally and make changes to the steps without restarting the 
> buildbot
> master. IMO that is the Right Way to define steps: a script that you can
> run locally on a machine that satisfies the OS and dep requirements of the
> script.
>
> I am restarting the two bots that I am responsible for, and may need
> some help debugging further issues soon. I'll let you know.
>

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] Upcoming upgrade of LLVM buildbot

2020-10-13 Thread Vitaly Buka via lldb-commits
They do on staging.
http://lab.llvm.org:8014/#/builders/sanitizer-windows
http://lab.llvm.org:8014/#/builders/clang-x64-windows-msvc

Galina, when do you plan to push this to the primary server?
If it's a few days, I'd rather keep bots on staging to have colors.



On Tue, 13 Oct 2020 at 11:11, Reid Kleckner  wrote:

> FWIW, I don't see any issues with my two bots that use buildbot annotated
> commands:
> http://lab.llvm.org:8011/#/builders/sanitizer-windows
> http://lab.llvm.org:8011/#/builders/clang-x64-windows-msvc
> The individual steps don't highlight as green or red, but that's OK for
> now.
>
> On Mon, Oct 12, 2020 at 7:19 PM Galina Kistanova 
> wrote:
>
>> We have a better version of AnnotatedCommand on the staging. It should be
>> a functional equivalent of the old one.
>> We need to stress test it well before moving to the production build bot.
>>
>> For that we need all sanitizer + other bots which use the
>> AnnotatedCommand directly or indirectly moved temporarily to the staging.
>>
>> Please let me know when that could be arranged.
>>
>> Thanks
>>
>> Galina
>>
>> On Mon, Oct 12, 2020 at 11:39 AM Reid Kleckner  wrote:
>>
>>> On Wed, Oct 7, 2020 at 4:32 PM Galina Kistanova via lldb-commits <
>>> lldb-commits@lists.llvm.org> wrote:
>>>
 They are online now -
 http://lab.llvm.org:8011/#/waterfall?tags=sanitizer

 AnnotatedCommand has severe design conflict with the new buildbot.
 We have changed it to be safe and still do something useful, but it
 will need more love and care.

 Please let me know if you have some spare time to work on porting
 AnnotatedCommand.

>>>
>>> That's unfortunate, it would've been good to know that earlier. I and
>>> another team member have spent a fair amount of time porting things to use
>>> more AnnotatedCommand steps, because it gives us the flexibility to test
>>> steps locally and make changes to the steps without restarting the buildbot
>>> master. IMO that is the Right Way to define steps: a script that you can
>>> run locally on a machine that satisfies the OS and dep requirements of the
>>> script.
>>>
>>> I am restarting the two bots that I am responsible for, and may need
>>> some help debugging further issues soon. I'll let you know.
>>>
>>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] Upcoming upgrade of LLVM buildbot

2020-10-14 Thread Vitaly Buka via lldb-commits
I switched sanitizers and two rnk@ bots back to the primary server.
http://lab.llvm.org:8011/#/waterfall?tags=sanitizer

On Tue, 13 Oct 2020 at 22:42, Vitaly Buka  wrote:

> They do on staging.
> http://lab.llvm.org:8014/#/builders/sanitizer-windows
> http://lab.llvm.org:8014/#/builders/clang-x64-windows-msvc
>
> Galina, when do you plan to push this to the primary server?
> If it's a few days, I'd rather keep bots on staging to have colors.
>
>
>
> On Tue, 13 Oct 2020 at 11:11, Reid Kleckner  wrote:
>
>> FWIW, I don't see any issues with my two bots that use buildbot annotated
>> commands:
>> http://lab.llvm.org:8011/#/builders/sanitizer-windows
>> http://lab.llvm.org:8011/#/builders/clang-x64-windows-msvc
>> The individual steps don't highlight as green or red, but that's OK for
>> now.
>>
>> On Mon, Oct 12, 2020 at 7:19 PM Galina Kistanova 
>> wrote:
>>
>>> We have a better version of AnnotatedCommand on the staging. It should
>>> be a functional equivalent of the old one.
>>> We need to stress test it well before moving to the production build bot.
>>>
>>> For that we need all sanitizer + other bots which use the
>>> AnnotatedCommand directly or indirectly moved temporarily to the staging.
>>>
>>> Please let me know when that could be arranged.
>>>
>>> Thanks
>>>
>>> Galina
>>>
>>> On Mon, Oct 12, 2020 at 11:39 AM Reid Kleckner  wrote:
>>>
 On Wed, Oct 7, 2020 at 4:32 PM Galina Kistanova via lldb-commits <
 lldb-commits@lists.llvm.org> wrote:

> They are online now -
> http://lab.llvm.org:8011/#/waterfall?tags=sanitizer
>
> AnnotatedCommand has severe design conflict with the new buildbot.
> We have changed it to be safe and still do something useful, but it
> will need more love and care.
>
> Please let me know if you have some spare time to work on porting
> AnnotatedCommand.
>

 That's unfortunate, it would've been good to know that earlier. I and
 another team member have spent a fair amount of time porting things to use
 more AnnotatedCommand steps, because it gives us the flexibility to test
 steps locally and make changes to the steps without restarting the buildbot
 master. IMO that is the Right Way to define steps: a script that you can
 run locally on a machine that satisfies the OS and dep requirements of the
 script.

 I am restarting the two bots that I am responsible for, and may need
 some help debugging further issues soon. I'll let you know.

>>>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] Upcoming upgrade of LLVM buildbot

2020-10-15 Thread Vitaly Buka via lldb-commits
Ok, I can switch them back to staging. However today's staging was
frequently offline.


On Wed, 14 Oct 2020 at 21:44, Galina Kistanova  wrote:

> Thanks everyone!
>
> I would like to keep the bots in the staging till Friday. And if
> everything is good, then apply the changes to the production and let you
> move all the green bots back there.
>
> Thanks
>
> Galina
>
>
> On Tue, Oct 13, 2020 at 10:43 PM Vitaly Buka 
> wrote:
>
>> They do on staging.
>> http://lab.llvm.org:8014/#/builders/sanitizer-windows
>> http://lab.llvm.org:8014/#/builders/clang-x64-windows-msvc
>>
>> Galina, when do you plan to push this to the primary server?
>> If it's a few days, I'd rather keep bots on staging to have colors.
>>
>>
>>
>> On Tue, 13 Oct 2020 at 11:11, Reid Kleckner  wrote:
>>
>>> FWIW, I don't see any issues with my two bots that use buildbot
>>> annotated commands:
>>> http://lab.llvm.org:8011/#/builders/sanitizer-windows
>>> http://lab.llvm.org:8011/#/builders/clang-x64-windows-msvc
>>> The individual steps don't highlight as green or red, but that's OK for
>>> now.
>>>
>>> On Mon, Oct 12, 2020 at 7:19 PM Galina Kistanova 
>>> wrote:
>>>
 We have a better version of AnnotatedCommand on the staging. It should
 be a functional equivalent of the old one.
 We need to stress test it well before moving to the production build
 bot.

 For that we need all sanitizer + other bots which use the
 AnnotatedCommand directly or indirectly moved temporarily to the staging.

 Please let me know when that could be arranged.

 Thanks

 Galina

 On Mon, Oct 12, 2020 at 11:39 AM Reid Kleckner  wrote:

> On Wed, Oct 7, 2020 at 4:32 PM Galina Kistanova via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
>
>> They are online now -
>> http://lab.llvm.org:8011/#/waterfall?tags=sanitizer
>>
>> AnnotatedCommand has severe design conflict with the new buildbot.
>> We have changed it to be safe and still do something useful, but it
>> will need more love and care.
>>
>> Please let me know if you have some spare time to work on porting
>> AnnotatedCommand.
>>
>
> That's unfortunate, it would've been good to know that earlier. I and
> another team member have spent a fair amount of time porting things to use
> more AnnotatedCommand steps, because it gives us the flexibility to test
> steps locally and make changes to the steps without restarting the 
> buildbot
> master. IMO that is the Right Way to define steps: a script that you can
> run locally on a machine that satisfies the OS and dep requirements of the
> script.
>
> I am restarting the two bots that I am responsible for, and may need
> some help debugging further issues soon. I'll let you know.
>

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] Upcoming upgrade of LLVM buildbot

2020-10-19 Thread Vitaly Buka via lldb-commits
Thanks!
Done.

On Sat, 17 Oct 2020 at 12:45, Galina Kistanova  wrote:

> Thanks everyone for keeping your annotated builders in the staging area!
> Much appreciated.
>
> Please feel free to move all the green builders back to the production. It
> has a new AnnotatedCommand now.
>
> Thanks
>
> Galina
>
>
> On Thu, Oct 15, 2020 at 12:46 AM Vitaly Buka 
> wrote:
>
>> Ok, I can switch them back to staging. However today's staging was
>> frequently offline.
>>
>>
>> On Wed, 14 Oct 2020 at 21:44, Galina Kistanova 
>> wrote:
>>
>>> Thanks everyone!
>>>
>>> I would like to keep the bots in the staging till Friday. And if
>>> everything is good, then apply the changes to the production and let you
>>> move all the green bots back there.
>>>
>>> Thanks
>>>
>>> Galina
>>>
>>>
>>> On Tue, Oct 13, 2020 at 10:43 PM Vitaly Buka 
>>> wrote:
>>>
 They do on staging.
 http://lab.llvm.org:8014/#/builders/sanitizer-windows
 http://lab.llvm.org:8014/#/builders/clang-x64-windows-msvc

 Galina, when do you plan to push this to the primary server?
 If it's a few days, I'd rather keep bots on staging to have colors.



 On Tue, 13 Oct 2020 at 11:11, Reid Kleckner  wrote:

> FWIW, I don't see any issues with my two bots that use buildbot
> annotated commands:
> http://lab.llvm.org:8011/#/builders/sanitizer-windows
> http://lab.llvm.org:8011/#/builders/clang-x64-windows-msvc
> The individual steps don't highlight as green or red, but that's OK
> for now.
>
> On Mon, Oct 12, 2020 at 7:19 PM Galina Kistanova 
> wrote:
>
>> We have a better version of AnnotatedCommand on the staging. It
>> should be a functional equivalent of the old one.
>> We need to stress test it well before moving to the production build
>> bot.
>>
>> For that we need all sanitizer + other bots which use the
>> AnnotatedCommand directly or indirectly moved temporarily to the staging.
>>
>> Please let me know when that could be arranged.
>>
>> Thanks
>>
>> Galina
>>
>> On Mon, Oct 12, 2020 at 11:39 AM Reid Kleckner 
>> wrote:
>>
>>> On Wed, Oct 7, 2020 at 4:32 PM Galina Kistanova via lldb-commits <
>>> lldb-commits@lists.llvm.org> wrote:
>>>
 They are online now -
 http://lab.llvm.org:8011/#/waterfall?tags=sanitizer

 AnnotatedCommand has severe design conflict with the new buildbot.
 We have changed it to be safe and still do something useful, but it
 will need more love and care.

 Please let me know if you have some spare time to work on porting
 AnnotatedCommand.

>>>
>>> That's unfortunate, it would've been good to know that earlier. I
>>> and another team member have spent a fair amount of time porting things 
>>> to
>>> use more AnnotatedCommand steps, because it gives us the flexibility to
>>> test steps locally and make changes to the steps without restarting the
>>> buildbot master. IMO that is the Right Way to define steps: a script 
>>> that
>>> you can run locally on a machine that satisfies the OS and dep 
>>> requirements
>>> of the script.
>>>
>>> I am restarting the two bots that I am responsible for, and may need
>>> some help debugging further issues soon. I'll let you know.
>>>
>>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] Upcoming upgrade of LLVM buildbot

2020-10-19 Thread Vitaly Buka via lldb-commits
There is some issue, at least on staging.
http://lab.llvm.org:8014/#/builders/89/builds/184 has multiple failed
stages but marked as SUCCESS


On Mon, 19 Oct 2020 at 11:43, Vitaly Buka  wrote:

> Thanks!
> Done.
>
> On Sat, 17 Oct 2020 at 12:45, Galina Kistanova 
> wrote:
>
>> Thanks everyone for keeping your annotated builders in the staging area!
>> Much appreciated.
>>
>> Please feel free to move all the green builders back to the production.
>> It has a new AnnotatedCommand now.
>>
>> Thanks
>>
>> Galina
>>
>>
>> On Thu, Oct 15, 2020 at 12:46 AM Vitaly Buka 
>> wrote:
>>
>>> Ok, I can switch them back to staging. However today's staging was
>>> frequently offline.
>>>
>>>
>>> On Wed, 14 Oct 2020 at 21:44, Galina Kistanova 
>>> wrote:
>>>
 Thanks everyone!

 I would like to keep the bots in the staging till Friday. And if
 everything is good, then apply the changes to the production and let you
 move all the green bots back there.

 Thanks

 Galina


 On Tue, Oct 13, 2020 at 10:43 PM Vitaly Buka 
 wrote:

> They do on staging.
> http://lab.llvm.org:8014/#/builders/sanitizer-windows
> http://lab.llvm.org:8014/#/builders/clang-x64-windows-msvc
>
> Galina, when do you plan to push this to the primary server?
> If it's a few days, I'd rather keep bots on staging to have colors.
>
>
>
> On Tue, 13 Oct 2020 at 11:11, Reid Kleckner  wrote:
>
>> FWIW, I don't see any issues with my two bots that use buildbot
>> annotated commands:
>> http://lab.llvm.org:8011/#/builders/sanitizer-windows
>> http://lab.llvm.org:8011/#/builders/clang-x64-windows-msvc
>> The individual steps don't highlight as green or red, but that's OK
>> for now.
>>
>> On Mon, Oct 12, 2020 at 7:19 PM Galina Kistanova <
>> gkistan...@gmail.com> wrote:
>>
>>> We have a better version of AnnotatedCommand on the staging. It
>>> should be a functional equivalent of the old one.
>>> We need to stress test it well before moving to the production build
>>> bot.
>>>
>>> For that we need all sanitizer + other bots which use the
>>> AnnotatedCommand directly or indirectly moved temporarily to the 
>>> staging.
>>>
>>> Please let me know when that could be arranged.
>>>
>>> Thanks
>>>
>>> Galina
>>>
>>> On Mon, Oct 12, 2020 at 11:39 AM Reid Kleckner 
>>> wrote:
>>>
 On Wed, Oct 7, 2020 at 4:32 PM Galina Kistanova via lldb-commits <
 lldb-commits@lists.llvm.org> wrote:

> They are online now -
> http://lab.llvm.org:8011/#/waterfall?tags=sanitizer
>
> AnnotatedCommand has severe design conflict with the new buildbot.
> We have changed it to be safe and still do something useful, but
> it will need more love and care.
>
> Please let me know if you have some spare time to work on porting
> AnnotatedCommand.
>

 That's unfortunate, it would've been good to know that earlier. I
 and another team member have spent a fair amount of time porting 
 things to
 use more AnnotatedCommand steps, because it gives us the flexibility to
 test steps locally and make changes to the steps without restarting the
 buildbot master. IMO that is the Right Way to define steps: a script 
 that
 you can run locally on a machine that satisfies the OS and dep 
 requirements
 of the script.

 I am restarting the two bots that I am responsible for, and may
 need some help debugging further issues soon. I'll let you know.

>>>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] Upcoming upgrade of LLVM buildbot

2020-10-19 Thread Vitaly Buka via lldb-commits
it's not just staging, this build must be marked as failed
http://lab.llvm.org:8011/#/builders/74/builds/122


On Mon, 19 Oct 2020 at 11:50, Vitaly Buka  wrote:

> There is some issue, at least on staging.
> http://lab.llvm.org:8014/#/builders/89/builds/184 has multiple failed
> stages but marked as SUCCESS
>
>
> On Mon, 19 Oct 2020 at 11:43, Vitaly Buka  wrote:
>
>> Thanks!
>> Done.
>>
>> On Sat, 17 Oct 2020 at 12:45, Galina Kistanova 
>> wrote:
>>
>>> Thanks everyone for keeping your annotated builders in the staging area!
>>> Much appreciated.
>>>
>>> Please feel free to move all the green builders back to the production.
>>> It has a new AnnotatedCommand now.
>>>
>>> Thanks
>>>
>>> Galina
>>>
>>>
>>> On Thu, Oct 15, 2020 at 12:46 AM Vitaly Buka 
>>> wrote:
>>>
 Ok, I can switch them back to staging. However today's staging was
 frequently offline.


 On Wed, 14 Oct 2020 at 21:44, Galina Kistanova 
 wrote:

> Thanks everyone!
>
> I would like to keep the bots in the staging till Friday. And if
> everything is good, then apply the changes to the production and let you
> move all the green bots back there.
>
> Thanks
>
> Galina
>
>
> On Tue, Oct 13, 2020 at 10:43 PM Vitaly Buka 
> wrote:
>
>> They do on staging.
>> http://lab.llvm.org:8014/#/builders/sanitizer-windows
>> http://lab.llvm.org:8014/#/builders/clang-x64-windows-msvc
>>
>> Galina, when do you plan to push this to the primary server?
>> If it's a few days, I'd rather keep bots on staging to have colors.
>>
>>
>>
>> On Tue, 13 Oct 2020 at 11:11, Reid Kleckner  wrote:
>>
>>> FWIW, I don't see any issues with my two bots that use buildbot
>>> annotated commands:
>>> http://lab.llvm.org:8011/#/builders/sanitizer-windows
>>> http://lab.llvm.org:8011/#/builders/clang-x64-windows-msvc
>>> The individual steps don't highlight as green or red, but that's OK
>>> for now.
>>>
>>> On Mon, Oct 12, 2020 at 7:19 PM Galina Kistanova <
>>> gkistan...@gmail.com> wrote:
>>>
 We have a better version of AnnotatedCommand on the staging. It
 should be a functional equivalent of the old one.
 We need to stress test it well before moving to the production
 build bot.

 For that we need all sanitizer + other bots which use the
 AnnotatedCommand directly or indirectly moved temporarily to the 
 staging.

 Please let me know when that could be arranged.

 Thanks

 Galina

 On Mon, Oct 12, 2020 at 11:39 AM Reid Kleckner 
 wrote:

> On Wed, Oct 7, 2020 at 4:32 PM Galina Kistanova via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
>
>> They are online now -
>> http://lab.llvm.org:8011/#/waterfall?tags=sanitizer
>>
>> AnnotatedCommand has severe design conflict with the new buildbot.
>> We have changed it to be safe and still do something useful, but
>> it will need more love and care.
>>
>> Please let me know if you have some spare time to work on porting
>> AnnotatedCommand.
>>
>
> That's unfortunate, it would've been good to know that earlier. I
> and another team member have spent a fair amount of time porting 
> things to
> use more AnnotatedCommand steps, because it gives us the flexibility 
> to
> test steps locally and make changes to the steps without restarting 
> the
> buildbot master. IMO that is the Right Way to define steps: a script 
> that
> you can run locally on a machine that satisfies the OS and dep 
> requirements
> of the script.
>
> I am restarting the two bots that I am responsible for, and may
> need some help debugging further issues soon. I'll let you know.
>

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] Upcoming upgrade of LLVM buildbot

2020-10-27 Thread Vitaly Buka via lldb-commits
Any news regarding false-negatives?

+Mitch Phillips 

On Mon, 19 Oct 2020 at 22:07, Galina Kistanova  wrote:

> Thanks, Vitaly.
> Somebody is looking at this.
>
>
> On Mon, Oct 19, 2020 at 9:56 PM Vitaly Buka  wrote:
>
>> it's not just staging, this build must be marked as failed
>> http://lab.llvm.org:8011/#/builders/74/builds/122
>>
>>
>> On Mon, 19 Oct 2020 at 11:50, Vitaly Buka  wrote:
>>
>>> There is some issue, at least on staging.
>>> http://lab.llvm.org:8014/#/builders/89/builds/184 has multiple failed
>>> stages but marked as SUCCESS
>>>
>>>
>>> On Mon, 19 Oct 2020 at 11:43, Vitaly Buka  wrote:
>>>
 Thanks!
 Done.

 On Sat, 17 Oct 2020 at 12:45, Galina Kistanova 
 wrote:

> Thanks everyone for keeping your annotated builders in the staging
> area! Much appreciated.
>
> Please feel free to move all the green builders back to the
> production. It has a new AnnotatedCommand now.
>
> Thanks
>
> Galina
>
>
> On Thu, Oct 15, 2020 at 12:46 AM Vitaly Buka 
> wrote:
>
>> Ok, I can switch them back to staging. However today's staging was
>> frequently offline.
>>
>>
>> On Wed, 14 Oct 2020 at 21:44, Galina Kistanova 
>> wrote:
>>
>>> Thanks everyone!
>>>
>>> I would like to keep the bots in the staging till Friday. And if
>>> everything is good, then apply the changes to the production and let you
>>> move all the green bots back there.
>>>
>>> Thanks
>>>
>>> Galina
>>>
>>>
>>> On Tue, Oct 13, 2020 at 10:43 PM Vitaly Buka 
>>> wrote:
>>>
 They do on staging.
 http://lab.llvm.org:8014/#/builders/sanitizer-windows
 http://lab.llvm.org:8014/#/builders/clang-x64-windows-msvc

 Galina, when do you plan to push this to the primary server?
 If it's a few days, I'd rather keep bots on staging to have colors.



 On Tue, 13 Oct 2020 at 11:11, Reid Kleckner  wrote:

> FWIW, I don't see any issues with my two bots that use buildbot
> annotated commands:
> http://lab.llvm.org:8011/#/builders/sanitizer-windows
> http://lab.llvm.org:8011/#/builders/clang-x64-windows-msvc
> The individual steps don't highlight as green or red, but that's
> OK for now.
>
> On Mon, Oct 12, 2020 at 7:19 PM Galina Kistanova <
> gkistan...@gmail.com> wrote:
>
>> We have a better version of AnnotatedCommand on the staging. It
>> should be a functional equivalent of the old one.
>> We need to stress test it well before moving to the production
>> build bot.
>>
>> For that we need all sanitizer + other bots which use the
>> AnnotatedCommand directly or indirectly moved temporarily to the 
>> staging.
>>
>> Please let me know when that could be arranged.
>>
>> Thanks
>>
>> Galina
>>
>> On Mon, Oct 12, 2020 at 11:39 AM Reid Kleckner 
>> wrote:
>>
>>> On Wed, Oct 7, 2020 at 4:32 PM Galina Kistanova via lldb-commits
>>>  wrote:
>>>
 They are online now -
 http://lab.llvm.org:8011/#/waterfall?tags=sanitizer

 AnnotatedCommand has severe design conflict with the new
 buildbot.
 We have changed it to be safe and still do something useful,
 but it will need more love and care.

 Please let me know if you have some spare time to work on
 porting AnnotatedCommand.

>>>
>>> That's unfortunate, it would've been good to know that earlier.
>>> I and another team member have spent a fair amount of time porting 
>>> things
>>> to use more AnnotatedCommand steps, because it gives us the 
>>> flexibility to
>>> test steps locally and make changes to the steps without restarting 
>>> the
>>> buildbot master. IMO that is the Right Way to define steps: a 
>>> script that
>>> you can run locally on a machine that satisfies the OS and dep 
>>> requirements
>>> of the script.
>>>
>>> I am restarting the two bots that I am responsible for, and may
>>> need some help debugging further issues soon. I'll let you know.
>>>
>>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] Upcoming upgrade of LLVM buildbot

2020-10-27 Thread Vitaly Buka via lldb-commits
It looks fixed. I haven't seen them in recent reports.

On Tue, 27 Oct 2020 at 16:32, Vitaly Buka  wrote:

> Any news regarding false-negatives?
>
> +Mitch Phillips 
>
> On Mon, 19 Oct 2020 at 22:07, Galina Kistanova 
> wrote:
>
>> Thanks, Vitaly.
>> Somebody is looking at this.
>>
>>
>> On Mon, Oct 19, 2020 at 9:56 PM Vitaly Buka 
>> wrote:
>>
>>> it's not just staging, this build must be marked as failed
>>> http://lab.llvm.org:8011/#/builders/74/builds/122
>>>
>>>
>>> On Mon, 19 Oct 2020 at 11:50, Vitaly Buka  wrote:
>>>
 There is some issue, at least on staging.
 http://lab.llvm.org:8014/#/builders/89/builds/184 has multiple failed
 stages but marked as SUCCESS


 On Mon, 19 Oct 2020 at 11:43, Vitaly Buka 
 wrote:

> Thanks!
> Done.
>
> On Sat, 17 Oct 2020 at 12:45, Galina Kistanova 
> wrote:
>
>> Thanks everyone for keeping your annotated builders in the staging
>> area! Much appreciated.
>>
>> Please feel free to move all the green builders back to the
>> production. It has a new AnnotatedCommand now.
>>
>> Thanks
>>
>> Galina
>>
>>
>> On Thu, Oct 15, 2020 at 12:46 AM Vitaly Buka 
>> wrote:
>>
>>> Ok, I can switch them back to staging. However today's staging was
>>> frequently offline.
>>>
>>>
>>> On Wed, 14 Oct 2020 at 21:44, Galina Kistanova 
>>> wrote:
>>>
 Thanks everyone!

 I would like to keep the bots in the staging till Friday. And if
 everything is good, then apply the changes to the production and let 
 you
 move all the green bots back there.

 Thanks

 Galina


 On Tue, Oct 13, 2020 at 10:43 PM Vitaly Buka 
 wrote:

> They do on staging.
> http://lab.llvm.org:8014/#/builders/sanitizer-windows
> http://lab.llvm.org:8014/#/builders/clang-x64-windows-msvc
>
> Galina, when do you plan to push this to the primary server?
> If it's a few days, I'd rather keep bots on staging to have colors.
>
>
>
> On Tue, 13 Oct 2020 at 11:11, Reid Kleckner 
> wrote:
>
>> FWIW, I don't see any issues with my two bots that use buildbot
>> annotated commands:
>> http://lab.llvm.org:8011/#/builders/sanitizer-windows
>> http://lab.llvm.org:8011/#/builders/clang-x64-windows-msvc
>> The individual steps don't highlight as green or red, but that's
>> OK for now.
>>
>> On Mon, Oct 12, 2020 at 7:19 PM Galina Kistanova <
>> gkistan...@gmail.com> wrote:
>>
>>> We have a better version of AnnotatedCommand on the staging. It
>>> should be a functional equivalent of the old one.
>>> We need to stress test it well before moving to the production
>>> build bot.
>>>
>>> For that we need all sanitizer + other bots which use the
>>> AnnotatedCommand directly or indirectly moved temporarily to the 
>>> staging.
>>>
>>> Please let me know when that could be arranged.
>>>
>>> Thanks
>>>
>>> Galina
>>>
>>> On Mon, Oct 12, 2020 at 11:39 AM Reid Kleckner 
>>> wrote:
>>>
 On Wed, Oct 7, 2020 at 4:32 PM Galina Kistanova via
 lldb-commits  wrote:

> They are online now -
> http://lab.llvm.org:8011/#/waterfall?tags=sanitizer
>
> AnnotatedCommand has severe design conflict with the new
> buildbot.
> We have changed it to be safe and still do something useful,
> but it will need more love and care.
>
> Please let me know if you have some spare time to work on
> porting AnnotatedCommand.
>

 That's unfortunate, it would've been good to know that earlier.
 I and another team member have spent a fair amount of time porting 
 things
 to use more AnnotatedCommand steps, because it gives us the 
 flexibility to
 test steps locally and make changes to the steps without 
 restarting the
 buildbot master. IMO that is the Right Way to define steps: a 
 script that
 you can run locally on a machine that satisfies the OS and dep 
 requirements
 of the script.

 I am restarting the two bots that I am responsible for, and may
 need some help debugging further issues soon. I'll let you know.

>>>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [clang-tools-extra] [flang] [lldb] [llvm] [mlir] [polly] Add static to command line option (cl::opt) (PR #126243)

2025-02-07 Thread Vitaly Buka via lldb-commits

vitalybuka wrote:

All these changes are independent and quite straight forward.

I'd suggest to split in some way, so it's easier to review, land, and revert if 
we miss and break something.

Maybe by component.
also globals vs function local etc.


https://github.com/llvm/llvm-project/pull/126243
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [libcxx] [libcxxabi] [lldb] [libc++] Stop copying headers to the build directory (PR #115380)

2025-01-14 Thread Vitaly Buka via lldb-commits

vitalybuka wrote:

> @kstoimenov @vitalybuka Could you folks show us how the sanitizer builds you 
> run are different from the ones we already run in our CI pipeline? It would 
> be important to align both since we often run into issues with your 
> post-commit CI jobs failing but our pre-commit CI not catching it.

We have many of them:
1. This one is from 
https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh,
 which is strange build for `cmake -DCOMPILER_RT_ENABLE_INTERNAL_SYMBOLIZER=ON`
This build is strange, but I don't remember it breaks libc++ before. I don't 
think it worse having it on pre-submit.

2. Then a bunch of 
https://lab.llvm.org/buildbot/#/builders/sanitizer-{x86_64,aarch64}-linux-bootstrap-{asan,msan,ubsan,hwasan}/

```
/usr/bin/cmake -DLLVM_APPEND_VC_REV=OFF -GNinja -DCMAKE_BUILD_TYPE=Release 
-DLLVM_CCACHE_BUILD=ON -DLLVM_USE_LINKER=lld -DLLVM_ENABLE_ASSERTIONS=ON 
-DCMAKE_C_COMPILER=/home/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang
 
-DCMAKE_CXX_COMPILER=/home/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm_build0/bin/clang++
 -DLIBCXXABI_USE_LLVM_UNWINDER=OFF 
-DCMAKE_INSTALL_PREFIX=/home/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/libcxx_install_ubsan
 '-DLLVM_ENABLE_RUNTIMES=libcxx;libcxxabi' 
-DLIBCXX_TEST_PARAMS=long_tests=False -DLIBCXX_INCLUDE_BENCHMARKS=OFF 
-DLLVM_USE_SANITIZER=Undefined '-DCMAKE_C_FLAGS=-fsanitize=undefined 
-fno-sanitize-recover=all   -fno-sanitize=vptr' 
'-DCMAKE_CXX_FLAGS=-fsanitize=undefined -fno-sanitize-recover=all   
-fno-sanitize=vptr' 
/home/b/sanitizer-x86_64-linux-bootstrap-ubsan/build/llvm-project/llvm/../runtimes--
```

These must be very close to what libc++ have in CI.
Main diff is that we repeat sanitizers in -DCMAKE_CXX_FLAGS.

The most important part of this build is instrumented libc++ used  for 2nd 
stage clang build. But it's very slow. I don't expect we can afford this on 
pre-commit CI.

3. For some sanitizers there is nested libcxx build 
https://github.com/search?q=repo%3Allvm%2Fllvm-project%20add_custom_libcxx&type=code
correctly configured "check-compiler-rt" should cover them. I suspect you don't 
have these on pre-commit, maybe it worse having them.

https://github.com/llvm/llvm-project/pull/115380
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [libcxx] [libcxxabi] [lldb] [libc++] Stop copying headers to the build directory (PR #115380)

2025-01-15 Thread Vitaly Buka via lldb-commits

vitalybuka wrote:

> IIUC, the build that encountered issues in this patch ([in the comment 
> above](https://github.com/llvm/llvm-project/pull/115380#issuecomment-2590801533))
>  is a flavour of (2), right? That seems surprising to me though since we also 
> use the same flags when configuring libc++: 
> https://github.com/llvm/llvm-project/blob/main/libcxx/CMakeLists.txt#L596
> 
> So the difference would be that you folks are building libc++ instrumented 
> via the bootstrapping build instead of the "runtimes" build that we use for 
> the rest of libc++ CI.
> I also fail to understand why our own bootstrapping build pre-commit CI 
> didn't trip this wire.

it's no.1
The difference Is that 
https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
 builds build libc++ into IR full LTO, with minimal features as possible to be 
able to build LLVM symbolizer.



https://github.com/llvm/llvm-project/pull/115380
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [libcxx] [libcxxabi] [lldb] [libc++] Stop copying headers to the build directory (PR #115380)

2025-01-15 Thread Vitaly Buka via lldb-commits

vitalybuka wrote:

> > https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
> 
> It looks like 
> https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
>  tries to run `ninja cxx cxxabi` and then use the build dir of that build for 
> the build of LLVM. I think runnning `ninja install-cxx install-cxxabi` and 
> using the install dir as the destination might fix it?

Very likely. I can take a look, unless you are already there.

https://github.com/llvm/llvm-project/pull/115380
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [UBSan][BoundsSafety] Implement support for more expressive "trap reasons" (PR #154618)

2025-08-26 Thread Vitaly Buka via lldb-commits

https://github.com/vitalybuka approved this pull request.

LGTM, but please address others comments

https://github.com/llvm/llvm-project/pull/154618
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits