[PATCH] D150262: Disable sanitizer's on ifunc resolvers.
Daniel Kiss via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 14 11:57:12 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1ef3de6b09f6: Disable sanitizer's on ifunc resolvers. (authored by danielkiss).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150262/new/
https://reviews.llvm.org/D150262
Files:
clang/lib/CodeGen/CodeGenModule.cpp
clang/test/CodeGen/ifunc.c
Index: clang/test/CodeGen/ifunc.c
===================================================================
--- clang/test/CodeGen/ifunc.c
+++ clang/test/CodeGen/ifunc.c
@@ -1,5 +1,8 @@
// RUN: %clang_cc1 -triple i386-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s
// RUN: %clang_cc1 -triple i386-unknown-linux-gnu -O2 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=thread -O2 -emit-llvm -o - %s | FileCheck %s --check-prefix=SAN
+// RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=address -O2 -emit-llvm -o - %s | FileCheck %s --check-prefix=SAN
+// RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=memory -O2 -emit-llvm -o - %s | FileCheck %s --check-prefix=SAN
int foo(int) __attribute__ ((ifunc("foo_ifunc")));
@@ -39,3 +42,11 @@
// CHECK: call i32 @foo(i32
// CHECK: call void @goo()
+
+// SAN: define internal nonnull ptr @foo_ifunc() #[[#FOO_IFUNC:]] {
+
+// SAN: define dso_local noalias ptr @goo_ifunc() #[[#GOO_IFUNC:]] {
+
+// SAN-DAG: attributes #[[#FOO_IFUNC]] = {{{.*}} disable_sanitizer_instrumentation {{.*}}
+
+// SAN-DAG: attributes #[[#GOO_IFUNC]] = {{{.*}} disable_sanitizer_instrumentation {{.*}}
Index: clang/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -5832,7 +5832,9 @@
Entry->eraseFromParent();
} else
GIF->setName(MangledName);
-
+ if (auto *F = dyn_cast<llvm::Function>(Resolver)) {
+ F->addFnAttr(llvm::Attribute::DisableSanitizerInstrumentation);
+ }
SetCommonAttributes(GD, GIF);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150262.550046.patch
Type: text/x-patch
Size: 1651 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230814/c8e74f2b/attachment-0001.bin>
More information about the cfe-commits
mailing list