[all-commits] [llvm/llvm-project] b9935b: asan_static x86-64: Support 64-bit ASAN_SHADOW_OFF...

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon Dec 18 13:48:59 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b9935bb02a506e9142ae79b6c58303cb2e1ffb08
      https://github.com/llvm/llvm-project/commit/b9935bb02a506e9142ae79b6c58303cb2e1ffb08
  Author: Fangrui Song <i at maskray.me>
  Date:   2023-12-18 (Mon, 18 Dec 2023)

  Changed paths:
    M compiler-rt/lib/asan/asan_rtl_x86_64.S

  Log Message:
  -----------
  asan_static x86-64: Support 64-bit ASAN_SHADOW_OFFSET_CONST (#75748)

Fix #57086: when ASAN_SHADOW_OFFSET_CONST >= 0x80000000 (FreeBSD,
NetBSD, etc), `movsbl ASAN_SHADOW_OFFSET_CONST(%r10),%r10d` has an
invalid displacement (not representable as a signed 32-bit integer),
which will be diagnosed by GNU assembler.

```
% cat a.s
movsbl 0x80000000(%r10),%r10d
% as a.s
a.s: Assembler messages:
a.s:1: Error: 0x80000000 out of range of signed 32bit displacement
% clang -c a.s
```

The integrated assembler after #75747 will diagnose the invalid
displacement as well.
```
% clang -c a.s
a.s:1:19: error: displacement 2147483648 is not within [-2147483648, 2147483647]
movsbl 0x80000000(%r10),%r10d
                  ^
```

If ASAN_SHADOW_OFFSET_CONST cannot be encoded as a displacement, switch
to `movabsq+movsbl`.




More information about the All-commits mailing list