History log of /llvm-project/compiler-rt/lib/interception/tests/interception_win_test.cpp (Results 1 – 21 of 21)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init
# bbf37706 27-Jan-2025 bernhardu <bernhardu@mailbox.org>

[win/asan] GetInstructionSize: Support some more 7 or 8 byte instructions. (#124011)

This patch adds several instructions seen when trying to run a
executable built with ASan with llvm-mingw.
(x86

[win/asan] GetInstructionSize: Support some more 7 or 8 byte instructions. (#124011)

This patch adds several instructions seen when trying to run a
executable built with ASan with llvm-mingw.
(x86 and x86_64, using the git tip in llvm-project).

Also includes instructions collected by
Roman Pišl and Eric Pouech in the Wine bug reports below.

```
Related: https://github.com/llvm/llvm-project/issues/96270

Co-authored-by: Roman Pišl <rpisl@seznam.cz>
https://bugs.winehq.org/show_bug.cgi?id=50993
https://bugs.winehq.org/attachment.cgi?id=70233
Co-authored-by: Eric Pouech <eric.pouech@gmail.com>
https://bugs.winehq.org/show_bug.cgi?id=52386
https://bugs.winehq.org/attachment.cgi?id=71626
```

show more ...


# 351ee305 27-Jan-2025 bernhardu <bernhardu@mailbox.org>

[win/asan] GetInstructionSize: Support some more 6 byte instructions. (#124006)

This patch adds several instructions seen when trying to run a
executable built with ASan with llvm-mingw.
(x86 and

[win/asan] GetInstructionSize: Support some more 6 byte instructions. (#124006)

This patch adds several instructions seen when trying to run a
executable built with ASan with llvm-mingw.
(x86 and x86_64, using the git tip in llvm-project).

Also includes instructions collected by
Roman Pišl and Eric Pouech in the Wine bug reports below.

```
Related: https://github.com/llvm/llvm-project/issues/96270

Co-authored-by: Roman Pišl <rpisl@seznam.cz>
https://bugs.winehq.org/show_bug.cgi?id=50993
https://bugs.winehq.org/attachment.cgi?id=70233
Co-authored-by: Eric Pouech <eric.pouech@gmail.com>
https://bugs.winehq.org/show_bug.cgi?id=52386
https://bugs.winehq.org/attachment.cgi?id=71626
```

show more ...


# 56592a81 22-Jan-2025 bernhardu <bernhardu@mailbox.org>

[win/asan] GetInstructionSize: Support some more 4 byte instructions. (#123709)

This patch adds several instructions seen when trying to run a
executable built with ASan with llvm-mingw.
(x86 and

[win/asan] GetInstructionSize: Support some more 4 byte instructions. (#123709)

This patch adds several instructions seen when trying to run a
executable built with ASan with llvm-mingw.
(x86 and x86_64, using the git tip in llvm-project).

Also includes instructions collected by
Roman Pišl and Eric Pouech in the Wine bug reports below.

```
Related: https://github.com/llvm/llvm-project/issues/96270

Co-authored-by: Roman Pišl <rpisl@seznam.cz>
https://bugs.winehq.org/show_bug.cgi?id=50993
https://bugs.winehq.org/attachment.cgi?id=70233
Co-authored-by: Eric Pouech <eric.pouech@gmail.com>
https://bugs.winehq.org/show_bug.cgi?id=52386
https://bugs.winehq.org/attachment.cgi?id=71626
```

show more ...


# 5f405707 22-Jan-2025 bernhardu <bernhardu@mailbox.org>

[win/asan] GetInstructionSize: Support some more 5 byte instructions. (#123844)

This patch adds several instructions seen when trying to run a
executable built with ASan with llvm-mingw.
(x86 and

[win/asan] GetInstructionSize: Support some more 5 byte instructions. (#123844)

This patch adds several instructions seen when trying to run a
executable built with ASan with llvm-mingw.
(x86 and x86_64, using the git tip in llvm-project).

Also includes instructions collected by
Roman Pišl and Eric Pouech in the Wine bug reports below.
```
Related: https://github.com/llvm/llvm-project/issues/96270

Co-authored-by: Roman Pišl <rpisl@seznam.cz>
https://bugs.winehq.org/show_bug.cgi?id=50993
https://bugs.winehq.org/attachment.cgi?id=70233
Co-authored-by: Eric Pouech <eric.pouech@gmail.com>
https://bugs.winehq.org/show_bug.cgi?id=52386
https://bugs.winehq.org/attachment.cgi?id=71626
```

show more ...


# 57466db7 20-Jan-2025 bernhardu <bernhardu@mailbox.org>

[win/asan] GetInstructionSize: Support some more 3 byte instructions. (#120474)

This patch adds several instructions seen when trying to run a
executable built with ASan with llvm-mingw.
(x86 and

[win/asan] GetInstructionSize: Support some more 3 byte instructions. (#120474)

This patch adds several instructions seen when trying to run a
executable built with ASan with llvm-mingw.
(x86 and x86_64, using the git tip in llvm-project).

Also includes instructions collected by
Roman Pišl and Eric Pouech in the Wine bug reports below.

```
Related: https://github.com/llvm/llvm-project/issues/96270

Co-authored-by: Roman Pišl <rpisl@seznam.cz>
https://bugs.winehq.org/show_bug.cgi?id=50993
https://bugs.winehq.org/attachment.cgi?id=70233
Co-authored-by: Eric Pouech <eric.pouech@gmail.com>
https://bugs.winehq.org/show_bug.cgi?id=52386
https://bugs.winehq.org/attachment.cgi?id=71626
```

show more ...


Revision tags: llvmorg-19.1.7
# 99612a3a 13-Jan-2025 bernhardu <bernhardu@mailbox.org>

[win/asan] GetInstructionSize: Support some more 2 byte instructions. (#120235)

This patch adds several instructions seen when trying to run a
executable built with ASan with llvm-mingw.
(x86 and

[win/asan] GetInstructionSize: Support some more 2 byte instructions. (#120235)

This patch adds several instructions seen when trying to run a
executable built with ASan with llvm-mingw.
(x86 and x86_64, using the git tip in llvm-project).

Also includes instructions collected by
Roman Pišl and Eric Pouech in the Wine bug reports below.

```
Related: https://github.com/llvm/llvm-project/issues/96270

Co-authored-by: Roman Pišl <rpisl@seznam.cz>
https://bugs.winehq.org/show_bug.cgi?id=50993
https://bugs.winehq.org/attachment.cgi?id=70233
Co-authored-by: Eric Pouech <eric.pouech@gmail.com>
https://bugs.winehq.org/show_bug.cgi?id=52386
https://bugs.winehq.org/attachment.cgi?id=71626
```

CC: @zmodem

show more ...


# 9a9e41ca 11-Jan-2025 bernhardu <bernhardu@mailbox.org>

[win/asan] GetInstructionSize: Add test for `8D A4 24 ...`. (#119794)

This adds a test line and updates a comment.


Revision tags: llvmorg-19.1.6
# f85579fb 12-Dec-2024 bernhardu <bernhardu@mailbox.org>

[win/asan] GetInstructionSize: Fix `83 E4 XX` to return 3. (#119644)

This consolidates the two different lines for x86 and x86_64 into a
single line for both architectures.
And adds a test line.

[win/asan] GetInstructionSize: Fix `83 E4 XX` to return 3. (#119644)

This consolidates the two different lines for x86 and x86_64 into a
single line for both architectures.
And adds a test line.

CC: @zmodem

show more ...


# 854ea0cf 11-Dec-2024 bernhardu <bernhardu@mailbox.org>

[win/asan] GetInstructionSize: Make `83 EC XX` a generic entry. (#119537)

This consolidates the two different lines for x86 and x86_64 into a
single line for both architectures.
And adds a test li

[win/asan] GetInstructionSize: Make `83 EC XX` a generic entry. (#119537)

This consolidates the two different lines for x86 and x86_64 into a
single line for both architectures.
And adds a test line.

CC: @zmodem

show more ...


# bf6f1ca2 09-Dec-2024 bernhardu <bernhardu@mailbox.org>

[win/asan] GetInstructionSize: Make `F6 C1 XX` a generic entry. (#118144)


# 213c90d3 09-Dec-2024 bernhardu <bernhardu@mailbox.org>

[win/asan] GetInstructionSize: Fix `41 81 7c ...` to return 9. (#117828)

Trying to populate the recently added test for GetInstructionSize I
stumbled over this.
gdb and bddisasm have the opinion t

[win/asan] GetInstructionSize: Fix `41 81 7c ...` to return 9. (#117828)

Trying to populate the recently added test for GetInstructionSize I
stumbled over this.
gdb and bddisasm have the opinion this instruction is 9 bytes.
Also lldb shows this:
```
(lldb) disassemble --bytes --start-address 0x0000555555556004 --end-address 0x0000555555556024
0x555555556004: 41 81 7b 73 74 75 76 77 cmpl $0x77767574, 0x73(%r11) ; imm = 0x77767574
0x55555555600c: 41 81 7c 73 74 75 76 77 78 cmpl $0x78777675, 0x74(%r11,%rsi,2) ; imm = 0x78777675
0x555555556015: 41 81 7d 73 74 75 76 77 cmpl $0x77767574, 0x73(%r13) ; imm = 0x77767574
0x55555555601d: 00 00 addb %al, (%rax)
```

There is also a handy tool in llvm to directly feed in the byte sequence
- `41 81 7c` also uses 9 bytes here:
```
$ echo -n -e "0x41, 0x81, 0x7b, 0x73, 0x74, 0x75, 0x76, 0x77, 0x90" | ./llvm/build/bin/llvm-mc --disassemble --show-encoding
.text
cmpl $2004252020, 115(%r11) # encoding: [0x41,0x81,0x7b,0x73,0x74,0x75,0x76,0x77]
# imm = 0x77767574
nop # encoding: [0x90]
$ echo -n -e "0x41, 0x81, 0x7c, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x90" | ./llvm/build/bin/llvm-mc --disassemble --show-encoding
.text
cmpl $2021095029, 116(%r11,%rsi,2) # encoding: [0x41,0x81,0x7c,0x73,0x74,0x75,0x76,0x77,0x78]
# imm = 0x78777675
nop # encoding: [0x90]
```

show more ...


# b8d857ef 04-Dec-2024 bernhardu <bernhardu@mailbox.org>

[win/asan] Populate test for function GetInstructionSize. (#118204)

This puts the content of GetInstructionSize into a test.
There are 5 cases missing, which I have already or would like to propose

[win/asan] Populate test for function GetInstructionSize. (#118204)

This puts the content of GetInstructionSize into a test.
There are 5 cases missing, which I have already or would like to propose
a fix later.

show more ...


Revision tags: llvmorg-19.1.5
# 36b1811d 26-Nov-2024 bernhardu <bernhardu@mailbox.org>

[win/asan] Add a test skeleton for function GetInstructionSize. (#116948)

Was first part of PR #113085.


# b89e7746 21-Nov-2024 bernhardu <bernhardu@mailbox.org>

[win/asan] Avoid warnings in compiling interception_win_test.cpp. (#116887)

Example:
warning: unused variable 'kPatchableCode12' [-Wunused-const-variable]


Revision tags: llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6
# d79aee9f 27-Nov-2023 Farzon Lotfi <1802579+farzonl@users.noreply.github.com>

Changes to support running tests for Windows arm64 asan (#66973)

1. Differentiate SANITIZER_WINDOWS64 for x64 and arm64
2. turn off interception tests that expect x86 assembly

---------

Co-au

Changes to support running tests for Windows arm64 asan (#66973)

1. Differentiate SANITIZER_WINDOWS64 for x64 and arm64
2. turn off interception tests that expect x86 assembly

---------

Co-authored-by: Farzon Lotfi <farzon@farzon.com>

show more ...


Revision tags: llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3
# 0716888d 29-Apr-2023 Alvin Wong <alvin@alvinhc.com>

[compiler-rt][interception][asan][win] Improve error reporting

Add a callback from interception to allow asan on Windows to produce
better error messages. If an unrecoverable error occured when
inte

[compiler-rt][interception][asan][win] Improve error reporting

Add a callback from interception to allow asan on Windows to produce
better error messages. If an unrecoverable error occured when
intercepting functions, print a message before terminating.

Additionally, when encountering unknown instructions, a more helpful
message containing the address and the bytes of the unknown instruction
is now printed to help identify the issue and make it easier to propose
a fix.

Depends on D149549

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

show more ...


# 7b5571f3 22-Apr-2023 Alvin Wong <alvin@alvinhc.com>

[compiler-rt][interception][win] Don't crash on unknown instructions

Do not treat unknown instructions as a fatal error. In most cases,
failure to intercept a function is reported by the caller, tho

[compiler-rt][interception][win] Don't crash on unknown instructions

Do not treat unknown instructions as a fatal error. In most cases,
failure to intercept a function is reported by the caller, though
requires setting verbosity to 1 or higher to be visible.

Better error message reporting for asan will be added in a separate
patch.

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

show more ...


# ca40985e 22-Apr-2023 Alvin Wong <alvin@alvinhc.com>

[compiler-rt][interception][win] Add more assembly patterns

These assembly patterns are needed to intercept some libc++ and
libunwind functions built by Clang for i686-w64-windows-gnu target.

Diffe

[compiler-rt][interception][win] Add more assembly patterns

These assembly patterns are needed to intercept some libc++ and
libunwind functions built by Clang for i686-w64-windows-gnu target.

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

show more ...


Revision tags: llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7
# 78c033b5 12-Dec-2022 Markus Böck <markus.boeck02@gmail.com>

[sanitizers][windows] Correctly override functions with backward jmps

To reproduce: Download and run the latest Firefox ASAN build (https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/gecko

[sanitizers][windows] Correctly override functions with backward jmps

To reproduce: Download and run the latest Firefox ASAN build (https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/gecko.v2.mozilla-central.latest.firefox.win64-asan-opt/artifacts/public/build/target.zip) on Windows 11 (version 10.0.22621 Build 22621); it will crash on launch. Note that this doesn't seem to crash on another Windows 11 VM I've tried, so I'm not sure how reproducible it is across machines, but it reproduces on my machine every time.

The problem seems to be that when overriding the memset function in OverrideFunctionWithRedirectJump(), the relative_offset is stored as a uptr. Per the Intel x64 instruction set reference (https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf - warning: large PDF), on page 646 the jmp instruction (specifically the near jump flavors that start with E9, which are the ones the OverrideFunctionWithRedirectJump() considers) treats the offset as a signed displacement. This causes an incorrect value to be stored for REAL(memset) which points to uninitialized memory, and a crash the next time that gets called.

The fix is to simply treat that offset as signed. I have also added a test case.

Fixes https://github.com/llvm/llvm-project/issues/58846

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

show more ...


Revision tags: llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1, llvmorg-13.0.0, llvmorg-13.0.0-rc4
# 22ea0cea 21-Sep-2021 Toshihito Kikuchi <leamovret@gmail.com>

[compiler-rt] [windows] Add more assembly patterns for interception

To intercept the functions in Win11's ntdll.dll, we need to use the trampoline
technique because there are bytes other than 0x90 o

[compiler-rt] [windows] Add more assembly patterns for interception

To intercept the functions in Win11's ntdll.dll, we need to use the trampoline
technique because there are bytes other than 0x90 or 0xcc in the gaps between
exported functions. This patch adds more patterns that appear in ntdll's
functions.

Bug: https://bugs.llvm.org/show_bug.cgi?id=51721

Reviewed By: rnk

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

show more ...


Revision tags: llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2, llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1, llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4, llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1, llvmorg-11.0.1, llvmorg-11.0.1-rc2, llvmorg-11.0.1-rc1, llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3, llvmorg-11.0.0-rc2, llvmorg-11.0.0-rc1, llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4, llvmorg-10.0.1-rc3, llvmorg-10.0.1-rc2, llvmorg-10.0.1-rc1, llvmorg-10.0.0, llvmorg-10.0.0-rc6, llvmorg-10.0.0-rc5, llvmorg-10.0.0-rc4, llvmorg-10.0.0-rc3, llvmorg-10.0.0-rc2, llvmorg-10.0.0-rc1, llvmorg-11-init, llvmorg-9.0.1, llvmorg-9.0.1-rc3, llvmorg-9.0.1-rc2, llvmorg-9.0.1-rc1, llvmorg-9.0.0, llvmorg-9.0.0-rc6, llvmorg-9.0.0-rc5, llvmorg-9.0.0-rc4, llvmorg-9.0.0-rc3, llvmorg-9.0.0-rc2
# 9642e337 01-Aug-2019 Nico Weber <nicolasweber@gmx.de>

compiler-rt: Rename .cc file in lib/{interception/tests,safestack} to .cpp

Like r367463, but for interception/tests and safestack.

llvm-svn: 367560