-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[UBSan] Implement src:*=sanitize for UBSan #140529
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
vitalybuka
merged 30 commits into
main
from
users/qinkunbao/spr/implement-srcsanitize-for-ubsan
May 28, 2025
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
b83755d
[𝘀𝗽𝗿] initial version
qinkunbao 51abb3b
Fix format
qinkunbao df61d7a
Fix format
qinkunbao 117144c
remove braces for simple statements.
qinkunbao b2f90f5
[𝘀𝗽𝗿] changes introduced through rebase
qinkunbao e499598
rebase
qinkunbao c9d4f4f
[𝘀𝗽𝗿] changes introduced through rebase
qinkunbao caa59da
rebase
qinkunbao 28b35ef
rebase
qinkunbao 5c2363d
rebase
qinkunbao af1c6c8
Update SpecialCaseList.cpp
qinkunbao 406bbd4
Update SanitizerSpecialCaseList.rst and ReleaseNotes.rst
qinkunbao 80b2c18
fix doc
qinkunbao 898658c
remove the second lookup in containsFile.
qinkunbao 9be5d44
Add unit tests for inSectionBlame
qinkunbao 9c37ea0
Update the docs
qinkunbao c6e4f8e
Merge branch 'main' into users/qinkunbao/spr/implement-srcsanitize-fo…
qinkunbao 79610ab
Address test cases for contradict5 and contradict6.
qinkunbao bfd7cba
Update the doc.
qinkunbao 9966e67
Update the doc.
qinkunbao 815c4c2
Merge branch 'main' into users/qinkunbao/spr/implement-srcsanitize-fo…
qinkunbao fc352fb
Update with the new globs
qinkunbao 8b5684d
Update the tests.
qinkunbao 6be9bfd
Add more tests.
qinkunbao f582891
iterate SanitizerSections reverse.
qinkunbao 2a8adf6
Merge branch 'main' into users/qinkunbao/spr/implement-srcsanitize-fo…
qinkunbao 73f0de8
Merge branch 'main' into users/qinkunbao/spr/implement-srcsanitize-fo…
qinkunbao 1167303
Merge branch 'main' into users/qinkunbao/spr/implement-srcsanitize-fo…
qinkunbao 9b1d03c
rebase
qinkunbao 8884762
fix build
qinkunbao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,14 +3,15 @@ | |
|
||
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist -emit-llvm %t/test2.c -o - | FileCheck %s --check-prefixes=CHECK2 | ||
|
||
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,IGNORE | ||
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,SANITIZE | ||
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict1 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,IGNORE | ||
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict2 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,IGNORE | ||
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict2 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,SANITIZE | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please in separate PR extend this test for:
|
||
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict3 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,IGNORE | ||
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict4 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,IGNORE | ||
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict4 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,SANITIZE | ||
qinkunbao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict5 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,IGNORE | ||
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict6 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,IGNORE | ||
|
||
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict6 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,SANITIZE | ||
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict7 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,IGNORE | ||
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=signed-integer-overflow -fsanitize-ignorelist=%t/src.ignorelist.contradict8 -emit-llvm %t/test1.c -o - | FileCheck %s --check-prefixes=CHECK1,SANITIZE | ||
|
||
// Verify ubsan only emits checks for files in the allowlist | ||
|
||
|
@@ -52,6 +53,31 @@ src:*/tes*1.c=sanitize | |
src:*/te*t1.c | ||
src:*/t*st1.c=sanitize | ||
|
||
//--- src.ignorelist.contradict7 | ||
[{unsigned-integer-overflow,signed-integer-overflow}] | ||
src:* | ||
src:*/tes*1.c=sanitize | ||
src:*/te*t1.c | ||
src:*/t*st1.c=sanitize | ||
[{unsigned-integer-overflow,signed-integer-overflow}] | ||
src:* | ||
src:*/te*t1.c | ||
src:*/tes*1.c=sanitize | ||
src:*/test1.c | ||
|
||
//--- src.ignorelist.contradict8 | ||
[{unsigned-integer-overflow,signed-integer-overflow}] | ||
src:* | ||
src:*/te*t1.c | ||
src:*/tes*1.c=sanitize | ||
src:*/test1.c | ||
[{unsigned-integer-overflow,signed-integer-overflow}] | ||
src:* | ||
src:*/tes*1.c=sanitize | ||
src:*/te*t1.c | ||
src:*/t*st1.c=sanitize | ||
|
||
|
||
//--- test1.c | ||
// CHECK1-LABEL: define dso_local i32 @add | ||
int add(int a, int b) { | ||
|
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.