unicorn icon indicating copy to clipboard operation
unicorn copied to clipboard

Compatibility with MSVC's /CETCOMPACT + on Windows 11 with CET (Control-flow Enforcement Technology) enabled

Open hzqst opened this issue 2 years ago • 0 comments

Requirements to repro the issue

Windows 11 with CET (Control-flow Enforcement Technology) enabled

Visual Studio 2022

Description

Though this might be a won-fix or low-priority issue, I wrote this just in case someone else get into this and waste their life on debugging.

This issue occurs only when you get your .exe linked with linker flag /CETCOMPACT which was introduced in Visual Studio 2022, and you are running your .exe on Windows 11 with Control-flow Enforcement Technology enabled.

You will get a STATUS_STACK_BUFFER_OVERRUN exception at the last instruction of helper_**_***_mmu_x86_64

.text:00000001402F0C29                 mov     r14, [rsp+88h+arg_10]
.text:00000001402F0C31                 add     rsp, 50h
.text:00000001402F0C35                 pop     r15
.text:00000001402F0C37                 pop     r13
.text:00000001402F0C39                 pop     r12
.text:00000001402F0C3B                 pop     rdi
.text:00000001402F0C3C                 pop     rsi
.text:00000001402F0C3D                 pop     rbp
.text:00000001402F0C3E                 pop     rbx
.text:00000001402F0C3F                 retn                                     <------ exception here
.text:00000001402F0C3F helper_le_stw_mmu_x86_64 endp

1

The actual return address seems to be some generated code from tcg.

2

Version

1.0.0 ~ 1.0.3, and 2.0.0 (others are not tested)

hzqst avatar Oct 16 '23 16:10 hzqst