1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/test/Instrumentation/AddressSanitizer
Jann Horn 3c86383c3a [AddressSanitizer] Instrument byval call arguments
Summary:
In the LLVM IR, "call" instructions read memory for each byval operand.
For example:

```
$ cat blah.c
struct foo { void *a, *b, *c; };
struct bar { struct foo foo; };
void func1(const struct foo);
void func2(struct bar *bar) { func1(bar->foo); }
$ [...]/bin/clang -S -flto -c blah.c -O2 ; cat blah.s
[...]
define dso_local void @func2(%struct.bar* %bar) local_unnamed_addr #0 {
entry:
  %foo = getelementptr inbounds %struct.bar, %struct.bar* %bar, i64 0, i32 0
  tail call void @func1(%struct.foo* byval(%struct.foo) align 8 %foo) #2
  ret void
}
[...]
$ [...]/bin/clang -S -c blah.c -O2 ; cat blah.s
[...]
func2:                                  # @func2
[...]
        subq    $24, %rsp
[...]
        movq    16(%rdi), %rax
        movq    %rax, 16(%rsp)
        movups  (%rdi), %xmm0
        movups  %xmm0, (%rsp)
        callq   func1
        addq    $24, %rsp
[...]
        retq
```

Let ASAN instrument these hidden memory accesses.

This is patch 4/4 of a patch series:
https://reviews.llvm.org/D77616 [PATCH 1/4] [AddressSanitizer] Refactor ClDebug{Min,Max} handling
https://reviews.llvm.org/D77617 [PATCH 2/4] [AddressSanitizer] Split out memory intrinsic handling
https://reviews.llvm.org/D77618 [PATCH 3/4] [AddressSanitizer] Refactor: Permit >1 interesting operands per instruction
https://reviews.llvm.org/D77619 [PATCH 4/4] [AddressSanitizer] Instrument byval call arguments

Reviewers: kcc, glider

Reviewed By: glider

Subscribers: hiraditya, dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D77619
2020-04-30 17:09:13 +02:00
..
X86 [lit] Delete empty lines at the end of lit.local.cfg NFC 2019-06-17 09:51:07 +00:00
adaptive_global_redzones.ll
asan_address_space_attr.ll
asan-detect-invalid-pointer-pair.ll [asan] Add options -asan-detect-invalid-pointer-cmp and -asan-detect-invalid-pointer-sub options. 2019-03-28 10:51:24 +00:00
asan-masked-load-store.ll IR: Support parsing numeric block ids, and emit them in textual output. 2019-03-22 18:27:13 +00:00
asan-vs-gvn.ll
basic-msvc64.ll [llvm] Fix missing FileCheck directive colons 2020-04-06 09:59:08 -06:00
basic-myriad.ll
basic.ll [NewPM] Second attempt at porting ASan 2019-02-13 22:22:48 +00:00
byval-args.ll [AddressSanitizer] Instrument byval call arguments 2020-04-30 17:09:13 +02:00
debug_info_noninstrumented_alloca2.ll
debug_info_noninstrumented_alloca.ll
debug_info.ll [Local] Do not move around dbg.declares during replaceDbgDeclare 2020-02-13 14:35:02 -08:00
debug-info-alloca.ll Make IRBuilder automatically set alignment on load/store/alloca. 2020-04-13 13:43:14 -07:00
debug-info-global-var.ll
do-not-instrument-globals-darwin.ll
do-not-instrument-globals-linux.ll
do-not-instrument-internal-globals.ll
do-not-instrument-profiling-globals.ll
do-not-instrument-promotable-allocas.ll
do-not-instrument-sanitizers.ll
do-not-touch-comdat-global.ll
do-not-touch-odr-global.ll [asan] Don't check ODR violations for particular types of globals 2018-12-13 09:47:39 +00:00
do-not-touch-threadlocal.ll
dynamic-shadow-darwin.ll [ASan] Use dynamic shadow on 32-bit iOS and simulators 2019-06-21 21:01:39 +00:00
experiment-call.ll
experiment.ll
force-dynamic-shadow.ll [llvm] Fix missing FileCheck directive colons 2020-04-06 09:59:08 -06:00
freebsd.ll
global_addrspace.ll [AddressSanitizer] Only instrument globals of default address space 2019-10-30 09:32:19 +01:00
global_cstring_darwin.ll [asan] Prevent folding of globals with redzones 2018-12-20 00:30:18 +00:00
global_lto_merge.ll
global_metadata_array.ll Migrate function attribute "no-frame-pointer-elim"="false" to "frame-pointer"="none" as cleanups after D56351 2019-12-24 16:27:51 -08:00
global_metadata_bitcasts.ll [asan] In llvm.asan.globals, allow entries to be non-GlobalVariable and skip over them 2018-12-18 21:20:17 +00:00
global_metadata_darwin.ll
global_metadata_external_comdat.ll Fix global_metadata_external_comdat.ll test 2018-08-21 00:03:21 +00:00
global_metadata_windows.ll Migrate function attribute "no-frame-pointer-elim"="false" to "frame-pointer"="none" as cleanups after D56351 2019-12-24 16:27:51 -08:00
global_metadata.ll Migrate function attribute "no-frame-pointer-elim"="false" to "frame-pointer"="none" as cleanups after D56351 2019-12-24 16:27:51 -08:00
hoist-argument-init-insts.ll [AddressSanitizer] Fix for wrong argument values appearing in backtraces 2020-04-06 15:59:25 -07:00
instrument_global.ll
instrument_initializer_metadata.ll [IR] Disallow llvm.global_ctors and llvm.global_dtors of the 2-field form in textual format 2019-05-15 02:35:32 +00:00
instrument_load_then_store.ll
instrument-dynamic-allocas.ll
instrument-no-return.ll [Sanitizers] UBSan unreachable incompatible with Kernel ASan 2019-02-04 23:37:50 +00:00
instrument-stack.ll
instrumentation-with-call-threshold.ll
keep_going.ll
lifetime-throw.ll
lifetime-uar-uas.ll
lifetime.ll
local_alias.ll [asan] Don't check ODR violations for particular types of globals 2018-12-13 09:47:39 +00:00
local_stack_base.ll [Local] Do not move around dbg.declares during replaceDbgDeclare 2020-02-13 14:35:02 -08:00
localescape.ll [EH] Rename llvm.x86.seh.recoverfp intrinsic to llvm.eh.recoverfp 2019-01-16 00:37:13 +00:00
no-globals.ll
odr-check-ignore.ll [asan] Restore ODR-violation detection on vtables 2018-12-18 22:23:30 +00:00
ps4.ll
scale-offset.ll
stack_dynamic_alloca.ll IR: Support parsing numeric block ids, and emit them in textual output. 2019-03-22 18:27:13 +00:00
stack_layout.ll
stack-poisoning-and-lifetime-be.ll IR: Support parsing numeric block ids, and emit them in textual output. 2019-03-22 18:27:13 +00:00
stack-poisoning-and-lifetime.ll Asan use-after-scope: don't poison allocas if there were untraced lifetime intrinsics in the function (PR41481) 2019-04-16 07:54:20 +00:00
stack-poisoning-byval-args.ll
stack-poisoning.ll
str-nobuiltin.ll
test64.ll
twice.ll
ubsan.ll
version-mismatch-check.ll [ASan] Version mismatch check follow-up 2019-08-29 20:20:05 +00:00
win-sorted-sections.ll
win-string-literal.ll [asan] Undo special treatment of linkonce_odr and weak_odr 2018-12-20 00:30:27 +00:00
with-ifunc.ll