HomePhabricator

hwasan: Compatibility fixes for short granules.

Description

hwasan: Compatibility fixes for short granules.

We can't use short granules with stack instrumentation when targeting older
API levels because the rest of the system won't understand the short granule
tags stored in shadow memory.

Moreover, we need to be able to let old binaries (which won't understand
short granule tags) run on a new system that supports short granule
tags. Such binaries will call the hwasan_tag_mismatch function when their
outlined checks fail. We can compensate for the binary's lack of support
for short granules by implementing the short granule part of the check in
the
hwasan_tag_mismatch function. Unfortunately we can't do anything about
inline checks, but I don't believe that we can generate these by default on
aarch64, nor did we do so when the ABI was fixed.

A new function, __hwasan_tag_mismatch_v2, is introduced that lets code
targeting the new runtime avoid redoing the short granule check. Because tag
mismatches are rare this isn't important from a performance perspective; the
main benefit is that it introduces a symbol dependency that prevents binaries
targeting the new runtime from running on older (i.e. incompatible) runtimes.

Differential Revision: https://reviews.llvm.org/D68059

Details

Committed
pccSep 26 2019, 6:02 PM
Differential Revision
D68059: hwasan: Compatibility fixes for short granules.
Branches
Unknown
Tags
Unknown

Event Timeline

hafixo added a subscriber: hafixo.
hafixo added edges: D109304: [OpenMP][libomptarget] Add __tgt_target_return_t enum for __tgt_target_XXX return int, D109303: [OpenMP][libomptarget][NFC] Change checkDeviceAndCtors return type to bool., D109302: [PowerPC] Check subregister defines before removing XXMFACC/XXMTACC, D109301: [AMDGPU] Enable copy between VGPR and AGPR classes during regalloc, D109300: [AMDGPU] Make vector superclasses allocatable, D109299: [mlir][linalg] Fix dim(iter_arg) canonicalization, D109298: [libc++][NFC] Make tuple dtor test compile test, D109297: [ConstFold] Support opaque pointers in constexpr GEPs, D109296: [LV] Improve inclusivity of vectorization, D109295: [X86] Handle inverted inputs when matching VPTERNLOG from 2 binary ops., D109294: [Inline] Introduce Constant::hasOneLiveUse, use it instead of hasOneUse in inline cost model (PR51667), D109293: [JITLink] Add initial native TLS support to ELFNix platform, D109292: [RuntimeDyld] Don't use bitwise operation on SymbolRef::Type, D109291: [SelectionDAGBuilder] Bugfix in visitInlineAsm(), D109290: [OpaquePtr] Forbid mixing typed and opaque pointers, D109289: [InstCombine] snprintf(NULL, 0, "%s", str) to strlen(str), D109288: [AggresiveInstCombine] Add wrapper calls for `KnownBits` computing, D109287: [Sanitizers] intercept netent, protoent and mincore on freebsd, D109284: Port the cost model printer to New PM, D109286: [libc++][NFC] Test span is nothrow trivially destructible, D109283: [InstCombine] ror/rol(X, RotAmt) == C --> X == rol/ror(C, RotAmt) (PR51567), D109282: [UseListOrder] Fix use list order for function operands, D109281: [lldb] [gdb-remote] Extend x86 pseudo-regs to i386, D109280: [WIP][DSE] Memory intrinsics like memset, memcpy, memmove are removed if they are overwritten by a store in a loop, D109279: [InstCombine] Sink bin op into hands of select if one hand becomes constant, D109278: [Sanitizers] intercept clock_getcpuid/pthread_getcpuid on netbsd, D109277: [OpenMP][libomptarget] Change internal return status to enum type, D109276: [OpenMP][libomptarget] Change device vector elements to unique_ptr type, D109275: [exegesis][X86] ParallelSnippetGenerator: don't accidentally create serialized instructions, D109273: [X86] Fold (and (or (xor X, -1), Y), Z) -> PTERNLOG Z, Y, X, 0xD0, D109272: [lldb] [gdb-remote] Try using <architecture/> for remote arch unconditionally, D109269: [NFC] Cleanup the overload of ASTImporter::import(), D109267: [mlir][linalg] Tiling: Use loop ub in extract_slice size computation if possible, D109268: [mlir][linalg] New tiling option: Scalarize dynamic dims, D109265: [X86][mingw] Modify the alignment of __m128/__m256/__m512 vector type for mingw, D109264: [GlobalISel] Add G_ROTL and G_ROTR to right_identity_zero, D109263: [lldb] Update crashlog.py to accept multiple results from mdfind, D109262: [flang] Fix GetHostProcedure() for main program, D109261: [libc] add atof, strtof and strtod, D109260: [RISCV] Add SiFive cores E and S series, D109259: [SROA] Support opaque pointers, D109258: [fuzzer][fuchsia] Close exception channel before exiting., D109254: [AArch64] Enable CFIInstrInserter, D109253: [AArch64] Emit some .cfi_* for non-SVE cases in emitEpilogue, D109250: [flang] evaluate: Fold SQRT, HYPOT, & CABS, D109249: [lldb] Add Getdescription function for SBInstruction., D109252: Add extra check for llvm::Any::TypeId visibility, D109247: [mlir][linalg] Fix `FoldInitTensorWithDimOp` if dim(init_tensor) is static., D109248: Annotate `llvm.eh.sjlj.setjmp` as `returns_twice`, D109246: [AArch64][MC] Merge FeaturePMU into FeaturePerfMon, D109245: [RISCV] Use V0 instead of VMV0: for mask vectors in isel patterns., D109243: AMDGPU/GlobalISel: Add build_vector_trunc post-legalizer combine, D109242: [GlobalISel] Build_vector artifact combine into concat_vector, D109240: [GlobalISel] Build_vector artifact combine into copy, D109241: [GlobalISel] Build_vector artifact combine into unmerge_values, D109238: [MLIR] PresburgerSet: support divisions in subtract, intersect, and equality checks, D109236: [AggressiveInstCombine] Add `{extract/insert}element` to `TruncInstCombine` DAG, D109235: Use new plistlib API, D109234: [PGO] Change ThinLTO test for targets with loop unrolling disabled, D109233: [hwasan] Respect returns attribute when tracking values., D109231: [lldb] Improve error handling around GetRngListData(), D109228: [AMDGPU][GlobalISel] Legalize G_MUL for non-standard types, D109227: [flang] GET_COMMAND_ARGUMENT(LENGTH) runtime implementation, D109223: [mlir][NFC] Add explicit "::mlir" namespace to tblgen generated code, D109221: [LowerConstantIntrinsics] Fix heap-use-after-free bug in worklist, D109220: [tsan] Handle pthread_mutex_timedlock() with PTHREAD_MUTEX_ROBUST, D109224: [hwasan] Test use-after-scope with -fno-exceptions., D109218: SwiftAsync: use runtime-provided flag for extended frame if back-deploying, D109219: [Intrinsics] Move dest arg functions of MemIntrinsicBase deeper in mem intrinsics hierarchy, D109217: [llvm-dwarfdump] Fix unsigned overflow when calculating stats, D109216: [LNT] Fixed fieldchanges grouping to a regression, D109215: [RISCV] Fix arch string parsing for multi-character extensions, D109213: [RegAllocFast] Clean-up. Remove redundant operations. NFC., D109212: [libc++][NFCI] span: replace enable_if with requires, D109210: [clang-tidy] Attach fixit to warning, not note, in add_new_check.py example, D109205: [NFC][support] Extract `IsHashableData` out of class, D109203: [X86] Don't clobber EBX in stackprobes, D109202: [WebAssembly] Change WebAssemblyMCLowerPrePass to ModulePass, D109199: [compiler-rt][Fuchsia] Support building + running compiler-rt tests on fuchsia's host toolchain, D109196: scudo: Only add no-omit-frame-pointer flags when the compiler supports them, D109194: [InstCombine] Canonicalize masked merge; optimize (a & b) | (~a & c), D109192: [WIP/DNM] Support: introduce public API annotation support, D109190: [mlir] Refactor ElementsAttr into an AttrInterface, D109187: [Transforms] Remove dead ModuleLevelChanges parameters from CloneAndPrune functions, D109189: [mlir] Tighten verification of SparseElementsAttr, D109184: [Darwin][TSan] Add interceptor for mach_vm_map(), D109178: [PowerPC] Disable vector types when not supported by subtarget features, D109185: [gn build] Add build files for LLDB, D109175: [openmp] Emit deferred diag only when device compilation presents, D109174: [MSP430][Clang] Infer CPU type from -mcpu= or -mmcu=, D109170: [Attributor] Look through allocated heap memory, D109169: [GlobalDCE] In VFE support for relative pointers, allow GEP references to the base symbol, D109165: [OpenMP] Add callback annotation to `__kmpc_parallel_51`, D109164: [OpenMP] Manually unroll the argument copy loop, D109163: [AArch64][sve] Prevent incorrect function call on fixed width vector, D109162: [RISCV] Select (srl (sext_inreg X, i32), uimm5) to SRAIW if only lower 32 bits are used., D109158: [clang][deps] Test diagnostic options are being respected, D109159: [amdgpu] Enable selection of `s_cselect_b64`..Sep 6 2021, 12:44 AM
thopre removed edges: D109159: [amdgpu] Enable selection of `s_cselect_b64`., D109158: [clang][deps] Test diagnostic options are being respected, D109162: [RISCV] Select (srl (sext_inreg X, i32), uimm5) to SRAIW if only lower 32 bits are used., D109163: [AArch64][sve] Prevent incorrect function call on fixed width vector, D109164: [OpenMP] Manually unroll the argument copy loop, D109165: [OpenMP] Add callback annotation to `__kmpc_parallel_51`, D109169: [GlobalDCE] In VFE support for relative pointers, allow GEP references to the base symbol, D109170: [Attributor] Look through allocated heap memory, D109174: [MSP430][Clang] Infer CPU type from -mcpu= or -mmcu=, D109175: [openmp] Emit deferred diag only when device compilation presents, D109185: [gn build] Add build files for LLDB, D109178: [PowerPC] Disable vector types when not supported by subtarget features, D109184: [Darwin][TSan] Add interceptor for mach_vm_map(), D109189: [mlir] Tighten verification of SparseElementsAttr, D109187: [Transforms] Remove dead ModuleLevelChanges parameters from CloneAndPrune functions, D109190: [mlir] Refactor ElementsAttr into an AttrInterface, D109192: [WIP/DNM] Support: introduce public API annotation support, D109194: [InstCombine] Canonicalize masked merge; optimize (a & b) | (~a & c), D109196: scudo: Only add no-omit-frame-pointer flags when the compiler supports them, D109199: [compiler-rt][Fuchsia] Support building + running compiler-rt tests on fuchsia's host toolchain, D109202: [WebAssembly] Change WebAssemblyMCLowerPrePass to ModulePass, D109203: [X86] Don't clobber EBX in stackprobes, D109205: [NFC][support] Extract `IsHashableData` out of class, D109210: [clang-tidy] Attach fixit to warning, not note, in add_new_check.py example, D109212: [libc++][NFCI] span: replace enable_if with requires, D109213: [RegAllocFast] Clean-up. Remove redundant operations. NFC., D109215: [RISCV] Fix arch string parsing for multi-character extensions, D109216: [LNT] Fixed fieldchanges grouping to a regression, D109217: [llvm-dwarfdump] Fix unsigned overflow when calculating stats, D109219: [Intrinsics] Move dest arg functions of MemIntrinsicBase deeper in mem intrinsics hierarchy, D109218: SwiftAsync: use runtime-provided flag for extended frame if back-deploying, D109224: [hwasan] Test use-after-scope with -fno-exceptions., D109220: [tsan] Handle pthread_mutex_timedlock() with PTHREAD_MUTEX_ROBUST, D109221: [LowerConstantIntrinsics] Fix heap-use-after-free bug in worklist, D109223: [mlir][NFC] Add explicit "::mlir" namespace to tblgen generated code, D109227: [flang] GET_COMMAND_ARGUMENT(LENGTH) runtime implementation, D109228: [AMDGPU][GlobalISel] Legalize G_MUL for non-standard types, D109231: [lldb] Improve error handling around GetRngListData(), D109233: [hwasan] Respect returns attribute when tracking values., D109236: [AggressiveInstCombine] Add `{extract/insert}element` to `TruncInstCombine` DAG, D109238: [MLIR] PresburgerSet: support divisions in subtract, intersect, and equality checks, D109241: [GlobalISel] Build_vector artifact combine into unmerge_values, D109240: [GlobalISel] Build_vector artifact combine into copy, D109242: [GlobalISel] Build_vector artifact combine into concat_vector, D109243: AMDGPU/GlobalISel: Add build_vector_trunc post-legalizer combine, D109245: [RISCV] Use V0 instead of VMV0: for mask vectors in isel patterns., D109248: Annotate `llvm.eh.sjlj.setjmp` as `returns_twice`, D109247: [mlir][linalg] Fix `FoldInitTensorWithDimOp` if dim(init_tensor) is static., D109252: Add extra check for llvm::Any::TypeId visibility, D109249: [lldb] Add Getdescription function for SBInstruction., D109250: [flang] evaluate: Fold SQRT, HYPOT, & CABS, D109253: [AArch64] Emit some .cfi_* for non-SVE cases in emitEpilogue, D109254: [AArch64] Enable CFIInstrInserter, D109258: [fuzzer][fuchsia] Close exception channel before exiting., D109259: [SROA] Support opaque pointers, D109260: [RISCV] Add SiFive cores E and S series, D109261: [libc] add atof, strtof and strtod, D109262: [flang] Fix GetHostProcedure() for main program, D109263: [lldb] Update crashlog.py to accept multiple results from mdfind, D109264: [GlobalISel] Add G_ROTL and G_ROTR to right_identity_zero, D109265: [X86][mingw] Modify the alignment of __m128/__m256/__m512 vector type for mingw, D109268: [mlir][linalg] New tiling option: Scalarize dynamic dims, D109267: [mlir][linalg] Tiling: Use loop ub in extract_slice size computation if possible, D109269: [NFC] Cleanup the overload of ASTImporter::import(), D109272: [lldb] [gdb-remote] Try using <architecture/> for remote arch unconditionally, D109273: [X86] Fold (and (or (xor X, -1), Y), Z) -> PTERNLOG Z, Y, X, 0xD0, D109275: [exegesis][X86] ParallelSnippetGenerator: don't accidentally create serialized instructions, D109276: [OpenMP][libomptarget] Change device vector elements to unique_ptr type, D109277: [OpenMP][libomptarget] Change internal return status to enum type, D109278: [Sanitizers] intercept clock_getcpuid/pthread_getcpuid on netbsd, D109279: [InstCombine] Sink bin op into hands of select if one hand becomes constant, D109280: [WIP][DSE] Memory intrinsics like memset, memcpy, memmove are removed if they are overwritten by a store in a loop, D109281: [lldb] [gdb-remote] Extend x86 pseudo-regs to i386, D109282: [UseListOrder] Fix use list order for function operands, D109283: [InstCombine] ror/rol(X, RotAmt) == C --> X == rol/ror(C, RotAmt) (PR51567), D109286: [libc++][NFC] Test span is nothrow trivially destructible, D109284: Port the cost model printer to New PM, D109287: [Sanitizers] intercept netent, protoent and mincore on freebsd, D109288: [AggresiveInstCombine] Add wrapper calls for `KnownBits` computing, D109289: [InstCombine] snprintf(NULL, 0, "%s", str) to strlen(str), D109290: [OpaquePtr] Forbid mixing typed and opaque pointers, D109291: [SelectionDAGBuilder] Bugfix in visitInlineAsm(), D109292: [RuntimeDyld] Don't use bitwise operation on SymbolRef::Type, D109293: [JITLink] Add initial native TLS support to ELFNix platform, D109294: [Inline] Introduce Constant::hasOneLiveUse, use it instead of hasOneUse in inline cost model (PR51667), D109295: [X86] Handle inverted inputs when matching VPTERNLOG from 2 binary ops., D109296: [LV] Improve inclusivity of vectorization, D109297: [ConstFold] Support opaque pointers in constexpr GEPs, D109298: [libc++][NFC] Make tuple dtor test compile test, D109299: [mlir][linalg] Fix dim(iter_arg) canonicalization, D109300: [AMDGPU] Make vector superclasses allocatable, D109301: [AMDGPU] Enable copy between VGPR and AGPR classes during regalloc, D109302: [PowerPC] Check subregister defines before removing XXMFACC/XXMTACC, D109303: [OpenMP][libomptarget][NFC] Change checkDeviceAndCtors return type to bool., D109304: [OpenMP][libomptarget] Add __tgt_target_return_t enum for __tgt_target_XXX return int.Sep 7 2021, 2:51 AM