- Notifications
You must be signed in to change notification settings - Fork 15.1k
[TySan][Clang] Add clang flag to use tysan outlined instrumentation a… #166170
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
| | @@ -2454,6 +2454,18 @@ def fsanitize_address_outline_instrumentation : Flag<["-"], "fsanitize-address-o | |
| def fno_sanitize_address_outline_instrumentation : Flag<["-"], "fno-sanitize-address-outline-instrumentation">, | ||
| Group<f_clang_Group>, | ||
| HelpText<"Use default code inlining logic for the address sanitizer">; | ||
| def fsanitize_type_outline_instrumentation : Flag<["-"], "fsanitize-type-outline-instrumentation">, | ||
| Group<f_clang_Group>, | ||
| HelpText<"Always generate function calls for type sanitizer instrumentation">; | ||
| def fno_sanitize_type_outline_instrumentation : Flag<["-"], "fno-sanitize-type-outline-instrumentation">, | ||
| Group<f_clang_Group>, | ||
| HelpText<"Use default code inlining logic for the type sanitizer">; | ||
| def fsanitize_type_verify_outlined_instrumentation : Flag<["-"], "fsanitize-type-verify-outlined-instrumentation">, | ||
| Group<f_clang_Group>, | ||
| HelpText<"Use both inlined and outlined instrumentation for type sanitizer to verify equivilence">; | ||
| def fno_sanitize_type_verify_outlined_instrumentation : Flag<["-"], "fno_sanitize-type-verify-outlined-instrumentation">, | ||
gbMattN marked this conversation as resolved. Show resolved Hide resolved | ||
| Group<f_clang_Group>, | ||
| HelpText<"Don't use both inlined and outlined instrumentation for type sanitizer to verify equivilence">; | ||
| 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. typo: "equivilence" | ||
| defm sanitize_stable_abi | ||
| : OptInCC1FFlag<"sanitize-stable-abi", "Stable ", "Conventional ", | ||
| "ABI instrumentation for sanitizer runtime. Default: Conventional">; | ||
| | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // UNSUPPORTED: target={{.*}}-windows-{{.*}} | ||
| | ||
| // RUN: %clang -S -fsanitize=type -emit-llvm -o - -fsanitize=type %s \ | ||
| // RUN: | FileCheck %s --check-prefixes=CHECK-NO-OUTLINE | ||
| // RUN: %clang -S -fsanitize=type -emit-llvm -o - -fsanitize=type %s \ | ||
| // RUN: -fsanitize-type-outline-instrumentation \ | ||
| // RUN: | FileCheck %s --check-prefixes=CHECK-OUTLINE | ||
| | ||
| // RUN: %clang -S -fsanitize=type -emit-llvm -o - -fsanitize=type %s \ | ||
| // RUN: -fsanitize-type-outline-instrumentation \ | ||
| // RUN: -fsanitize-type-verify-outlined-instrumentation \ | ||
| // RUN: | FileCheck %s --check-prefixes=CHECK-OUTLINE-VERIFY | ||
| // RUN: %clang -S -fsanitize=type -emit-llvm -o - -fsanitize=type %s \ | ||
| // RUN: -fsanitize-type-verify-outlined-instrumentation \ | ||
| // RUN: | FileCheck %s --check-prefixes=CHECK-VERIFY | ||
| | ||
| // CHECK-NO-OUTLINE-NOT: call{{.*}}@__tysan_instrument_mem_inst | ||
| 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. The existing IR test for outline instrumentation (llvm/test/Instrumentation/TypeSanitizer/basic_outlined.ll) checks __tysan_instrument_with_shadow_update. Why does this test pass? Are there any memintrinsics here? 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. Both __tysan_instrument_mem_inst and __tysan_instrument_with_shadow_update are functions which can be inserted when outlining is enabled, so either (perhaps better if both) can be used to check that the outlining of instrumentation is occurring. I made this test mimicking the minimal one ASan has but on second thought maybe I should make it a bit more verbose to properly check for all possible outlined functions 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. Right. Note the ASan tests were written ages ago, so maybe we know better now :-) | ||
| // CHECK-OUTLINE: call{{.*}}@__tysan_instrument_mem_inst | ||
| // CHECK-OUTLINE-VERIFY: call{{.*}}@__tysan_instrument_mem_inst | ||
| // CHECK-VERIFY: call{{.*}}@__tysan_instrument_mem_inst | ||
| | ||
| float alias(int *ptr){ | ||
| 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. Can you use CHECK-LABEL to avoid accidentally passing the test for some reason? | ||
| float *aliasedPtr = (float *)ptr; | ||
| return *aliasedPtr; | ||
| } | ||
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.
typo: "equivilence"