kda updated this revision to Diff 340746. kda added a comment. Revisions as requested.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D101122/new/ https://reviews.llvm.org/D101122 Files: clang/include/clang/Basic/CodeGenOptions.def clang/include/clang/Driver/Options.td llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerOptions.h Index: llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerOptions.h =================================================================== --- llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerOptions.h +++ llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerOptions.h @@ -20,5 +20,16 @@ Invalid, ///< Not a valid destructor Kind. // TODO(dliew): Add more more kinds. }; + +/// Kinds of ASan detect stack use after return +enum class AsanDetectStackUseAfterReturnKind { + Never, ///< Never detect stack use after return. + Runtime, ///< Detect stack use after return if runtime flag is enabled + ///< (ASAN_OPTIONS=detect_stack_use_after_return=1) + Always, ///< Always detect stack use after return. + Invalid, ///< Not a valid detect mode. +}; + } // namespace llvm + #endif Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -1544,6 +1544,16 @@ NormalizedValuesScope<"llvm::AsanDtorKind">, NormalizedValues<["None", "Global"]>, MarshallingInfoEnum<CodeGenOpts<"SanitizeAddressDtorKind">, "Global">; +def sanitize_address_detect_stack_use_after_return_mode_EQ + : Joined<["-"], "fsanitize-address-detect-stack-use-after-return-mode=">, + MetaVarName<"<mode>">, + Flags<[CC1Option]>, + HelpText<"Select the enabling method of detect-stack-use-after-return in AddressSanitizer">, + Group<f_clang_Group>, + Values<"always,runtime,never">, + NormalizedValuesScope<"llvm::AsanDetectStackUseAfterReturnKind">, + NormalizedValues<["Never", "Runtime", "Always"]>, + MarshallingInfoEnum<CodeGenOpts<"SanitizeAddressDetectStackUseAfterReturn">, "Runtime">; // Note: This flag was introduced when it was necessary to distinguish between // ABI for correct codegen. This is no longer needed, but the flag is // not removed since targeting either ABI will behave the same. Index: clang/include/clang/Basic/CodeGenOptions.def =================================================================== --- clang/include/clang/Basic/CodeGenOptions.def +++ clang/include/clang/Basic/CodeGenOptions.def @@ -222,6 +222,10 @@ ENUM_CODEGENOPT(SanitizeAddressDtorKind, llvm::AsanDtorKind, 2, llvm::AsanDtorKind::Global) ///< Set how ASan global ///< destructors are emitted. +ENUM_CODEGENOPT(SanitizeAddressDetectStackUseAfterReturn, + llvm::AsanDetectStackUseAfterReturnKind, 2, + llvm::AsanDetectStackUseAfterReturnKind::Runtime + ) ///< Set detection mode for stack-use-after-return. CODEGENOPT(SanitizeMemoryUseAfterDtor, 1, 0) ///< Enable use-after-delete detection ///< in MemorySanitizer CODEGENOPT(SanitizeCfiCrossDso, 1, 0) ///< Enable cross-dso support in CFI.
Index: llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerOptions.h =================================================================== --- llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerOptions.h +++ llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerOptions.h @@ -20,5 +20,16 @@ Invalid, ///< Not a valid destructor Kind. // TODO(dliew): Add more more kinds. }; + +/// Kinds of ASan detect stack use after return +enum class AsanDetectStackUseAfterReturnKind { + Never, ///< Never detect stack use after return. + Runtime, ///< Detect stack use after return if runtime flag is enabled + ///< (ASAN_OPTIONS=detect_stack_use_after_return=1) + Always, ///< Always detect stack use after return. + Invalid, ///< Not a valid detect mode. +}; + } // namespace llvm + #endif Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -1544,6 +1544,16 @@ NormalizedValuesScope<"llvm::AsanDtorKind">, NormalizedValues<["None", "Global"]>, MarshallingInfoEnum<CodeGenOpts<"SanitizeAddressDtorKind">, "Global">; +def sanitize_address_detect_stack_use_after_return_mode_EQ + : Joined<["-"], "fsanitize-address-detect-stack-use-after-return-mode=">, + MetaVarName<"<mode>">, + Flags<[CC1Option]>, + HelpText<"Select the enabling method of detect-stack-use-after-return in AddressSanitizer">, + Group<f_clang_Group>, + Values<"always,runtime,never">, + NormalizedValuesScope<"llvm::AsanDetectStackUseAfterReturnKind">, + NormalizedValues<["Never", "Runtime", "Always"]>, + MarshallingInfoEnum<CodeGenOpts<"SanitizeAddressDetectStackUseAfterReturn">, "Runtime">; // Note: This flag was introduced when it was necessary to distinguish between // ABI for correct codegen. This is no longer needed, but the flag is // not removed since targeting either ABI will behave the same. Index: clang/include/clang/Basic/CodeGenOptions.def =================================================================== --- clang/include/clang/Basic/CodeGenOptions.def +++ clang/include/clang/Basic/CodeGenOptions.def @@ -222,6 +222,10 @@ ENUM_CODEGENOPT(SanitizeAddressDtorKind, llvm::AsanDtorKind, 2, llvm::AsanDtorKind::Global) ///< Set how ASan global ///< destructors are emitted. +ENUM_CODEGENOPT(SanitizeAddressDetectStackUseAfterReturn, + llvm::AsanDetectStackUseAfterReturnKind, 2, + llvm::AsanDetectStackUseAfterReturnKind::Runtime + ) ///< Set detection mode for stack-use-after-return. CODEGENOPT(SanitizeMemoryUseAfterDtor, 1, 0) ///< Enable use-after-delete detection ///< in MemorySanitizer CODEGENOPT(SanitizeCfiCrossDso, 1, 0) ///< Enable cross-dso support in CFI.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits