-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[Sanitizer][Ignorelist] Expanding =sanitize to global. #142456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
qinkunbao
merged 5 commits into
main
from
users/qinkunbao/spr/ubsanignorelist-expanding-sanitize-to-global-1
Jun 2, 2025
Merged
[Sanitizer][Ignorelist] Expanding =sanitize to global. #142456
qinkunbao
merged 5 commits into
main
from
users/qinkunbao/spr/ubsanignorelist-expanding-sanitize-to-global-1
Jun 2, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Created using spr 1.3.6 [skip ci]
Created using spr 1.3.6
@llvm/pr-subscribers-clang Author: Qinkun Bao (qinkunbao) ChangesSee #139128 Full diff: https://github.com/llvm/llvm-project/pull/142456.diff 1 Files Affected:
diff --git a/clang/test/CodeGen/ubsan-global-ignorelist.test b/clang/test/CodeGen/ubsan-global-ignorelist.test
new file mode 100644
index 0000000000000..8d7812217f331
--- /dev/null
+++ b/clang/test/CodeGen/ubsan-global-ignorelist.test
@@ -0,0 +1,39 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+
+// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=bounds %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE
+// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=bounds -fsanitize-ignorelist=%t/order-0.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,IGNORE
+// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=bounds -fsanitize-ignorelist=%t/order-1.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE
+// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=bounds -fsanitize-ignorelist=%t/order-2.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,IGNORE
+// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=bounds -fsanitize-ignorelist=%t/order-3.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE
+
+// The same type can appear multiple times within an ignorelist. Any ``=sanitize`` type
+// entries enable sanitizer instrumentation, even if it was ignored by entries before.
+// If multiple entries match the source, then the latest entry takes the
+// precedence.
+
+//--- order-0.ignorelist
+global:global_array
+
+//--- order-1.ignorelist
+global:global_array
+global:global_array=sanitize
+
+//--- order-2.ignorelist
+global:*
+global:global_array=sanitize
+global:global_array
+
+//--- order-3.ignorelist
+global:*
+global:global_array=sanitize
+global:global*
+global:*array=sanitize
+
+//--- test.c
+unsigned global_array[100] = {-1};
+
+// CHECK-LABEL: define dso_local i32 @test
+// IGNORE-NOT: call void @__ubsan_handle_out_of_bounds
+// SANITIZE: call void @__ubsan_handle_out_of_bounds
+int test(int i) { return global_array[i]; }
|
Created using spr 1.3.6
Created using spr 1.3.6
vitalybuka
approved these changes
Jun 2, 2025
…g-sanitize-to-global-1
sallto
pushed a commit
to sallto/llvm-project
that referenced
this pull request
Jun 3, 2025
See llvm#139128 If multiple entries match the source, than the latest entry takes the precedence.`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
clang
Clang issues not falling into any other category
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See #139128
If multiple entries match the source, than the latest entry takes the
precedence.`