-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[sanitizer] Add plumbing for -fsanitize-annotate-debug-info and partly replace '-mllvm -array-bounds-pseudofn' #138577
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
Changes from 2 commits
1cb28ef
959cbe0
31cdd17
8cdce5e
9380a10
74cd26a
de25cce
d25206a
25c3fce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2533,6 +2533,30 @@ def fno_sanitize_merge_handlers : Flag<["-"], "fno-sanitize-merge">, Group<f_cla | |
| Alias<fno_sanitize_merge_handlers_EQ>, AliasArgs<["all"]>, | ||
| Visibility<[ClangOption, CLOption]>, | ||
| HelpText<"Do not allow compiler to merge handlers for any sanitizers">; | ||
| def fsanitize_add_pseudo_functions_EQ | ||
| : CommaJoined<["-"], "fsanitize-add-pseudo-functions=">, | ||
| Group<f_clang_Group>, | ||
| HelpText<"Add pseudo-functions to checks for specified sanitizers">; | ||
|
||
| def fno_sanitize_add_pseudo_functions_EQ | ||
| : CommaJoined<["-"], "fno-sanitize-add-pseudo-functions=">, | ||
| Group<f_clang_Group>, | ||
| HelpText<"Do not allow compiler to add pseudo-functions to checks for " | ||
|
||
| "specified sanitizers">; | ||
| def fsanitize_add_pseudo_functions | ||
|
||
| : Flag<["-"], "fsanitize-add-pseudo-functions">, | ||
| Group<f_clang_Group>, | ||
| Alias<fsanitize_add_pseudo_functions_EQ>, | ||
| AliasArgs<["all"]>, | ||
| HelpText<"Allow compiler to add pseudo-functions to checks for all " | ||
| "sanitizers">; | ||
| def fno_sanitize_add_pseudo_functions | ||
| : Flag<["-"], "fno-sanitize-add-pseudo-functions">, | ||
| Group<f_clang_Group>, | ||
| Alias<fno_sanitize_add_pseudo_functions_EQ>, | ||
| AliasArgs<["all"]>, | ||
| Visibility<[ClangOption, CLOption]>, | ||
| HelpText<"Do not allow compiler to add pseudo-functions to checks for " | ||
| "any sanitizers">; | ||
| def fsanitize_undefined_trap_on_error | ||
| : Flag<["-"], "fsanitize-undefined-trap-on-error">, Group<f_clang_Group>, | ||
| Alias<fsanitize_trap_EQ>, AliasArgs<["undefined"]>; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1228,7 +1228,10 @@ void CodeGenFunction::EmitBoundsCheckImpl(const Expr *E, llvm::Value *Bound, | |
| SanitizerScope SanScope(this); | ||
|
|
||
| llvm::DILocation *CheckDI = Builder.getCurrentDebugLocation(); | ||
| if (ClArrayBoundsPseudoFn && CheckDI) { | ||
| if ((ClArrayBoundsPseudoFn || | ||
|
Contributor
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. Add TODO to clean up mllvm flag
Contributor
Author
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. Done
Collaborator
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. Could be nice to make clear that SO_ArrayBounds here is the same as on line 1252
Contributor
Author
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. Added CurrentCheckKind (there is already a
Contributor
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. I would drop the Current then for symmety
Contributor
Author
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. Done |
||
| CGM.getCodeGenOpts().SanitizeAddPseudoFunctions.has( | ||
| SanitizerKind::SO_ArrayBounds)) && | ||
| CheckDI) { | ||
| CheckDI = getDebugInfo()->CreateSyntheticInlineAt( | ||
| Builder.getCurrentDebugLocation(), "__ubsan_check_array_bounds"); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe
-fsanitize-add-pseudo-functions->-fsanitize-pseudo-function?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-fsanitize-pseudo-functionis slightly ambiguous: it sounds like it is an option to sanitize any existing pseudo-functions, rather than sanitizers adding pseudo-functionsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
convention is -fsanitize-=, so I think it's not a problem.
But unless someone step in, either name is fine to me, your call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with vitaly.
-fsanitize-trap doesn't sanitize traps either