[llvm] Revert "[ASan][JSON] Unpoison memory before its reuse" (PR #196203)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Wed May 6 15:51:24 PDT 2026
https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/196203
Reverts llvm/llvm-project#79065
This is no longer necessary now that we have gotten rid of ASan short string annotations in libc++.
>From ad7d6fcf803fb35c36916e682110256b7d758873 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <agrossman154 at yahoo.com>
Date: Wed, 6 May 2026 15:50:53 -0700
Subject: [PATCH] Revert "[ASan][JSON] Unpoison memory before its reuse
(#79065)"
This reverts commit c416b2efe89c11db593fe8041c366e0cb63d4eeb.
---
llvm/include/llvm/Support/JSON.h | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/llvm/include/llvm/Support/JSON.h b/llvm/include/llvm/Support/JSON.h
index 27862eb7ab6bb..9dd0a656251db 100644
--- a/llvm/include/llvm/Support/JSON.h
+++ b/llvm/include/llvm/Support/JSON.h
@@ -47,10 +47,9 @@
#define LLVM_SUPPORT_JSON_H
#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/STLFunctionalExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/Compiler.h"
+#include "llvm/ADT/STLFunctionalExtras.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/raw_ostream.h"
@@ -491,18 +490,6 @@ class Value {
friend class Object;
template <typename T, typename... U> void create(U &&... V) {
-#if LLVM_ADDRESS_SANITIZER_BUILD
- // Unpoisoning to prevent overwriting poisoned object (e.g., annotated short
- // string). Objects that have had their memory poisoned may cause an ASan
- // error if their memory is reused without calling their destructor.
- // Unpoisoning the memory prevents this error from occurring.
- // FIXME: This is a temporary solution to prevent buildbots from failing.
- // The more appropriate approach would be to call the object's destructor
- // to unpoison memory. This would prevent any potential memory leaks (long
- // strings). Read for details:
- // https://github.com/llvm/llvm-project/pull/79065#discussion_r1462621761
- __asan_unpoison_memory_region(&Union, sizeof(T));
-#endif
new (reinterpret_cast<T *>(&Union)) T(std::forward<U>(V)...);
}
template <typename T> T &as() const {
More information about the llvm-commits
mailing list