[all-commits] [llvm/llvm-project] e3cc8f: [asan] Fix shadow load alignment for unaligned 128...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Wed Jun 14 13:17:03 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e3cc8f344012f10b519be262c73f4eb5bfbbde86
https://github.com/llvm/llvm-project/commit/e3cc8f344012f10b519be262c73f4eb5bfbbde86
Author: Fangrui Song <i at maskray.me>
Date: 2023-06-14 (Wed, 14 Jun 2023)
Changed paths:
M llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
M llvm/test/Instrumentation/AddressSanitizer/basic.ll
M llvm/test/Instrumentation/AddressSanitizer/vector-load-store.ll
Log Message:
-----------
[asan] Fix shadow load alignment for unaligned 128-bit load/store
When a 128-bit load/store is aligned by 8, we incorrectly emit `load i16, ptr ..., align 2`
while the shadow memory address may not be aligned by 2.
This manifests as possibly-misaligned shadow memory load with `-mstrict-align`,
e.g. `clang --target=aarch64-linux -O2 -mstrict-align -fsanitize=address`
```
__attribute__((noinline)) void foo(unsigned long *ptr) {
ptr[0] = 3;
ptr[1] = 3;
}
// ldrh w8, [x9, x8] // the shadow memory load may not be aligned by 2
```
Infer the shadow memory alignment from the load/store alignment to set the
correct alignment. The generated code now uses two ldrb and one orr.
Fix https://github.com/llvm/llvm-project/issues/63258
Differential Revision: https://reviews.llvm.org/D152663
More information about the All-commits
mailing list