Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle ERROR_NOT_SUPPORTED from QueueUserAPC2 #99033

Merged
merged 2 commits into from
Feb 28, 2024

Conversation

filipnavara
Copy link
Member

@filipnavara filipnavara commented Feb 28, 2024

On WOW the QueueUserAPC2 call is not supported and returns ERROR_NOT_SUPPORTED. This was noticed for the win-x86 NativeAOT port , but it may affect x64 emulation on ARM64 as well.

@ghost
Copy link

ghost commented Feb 28, 2024

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Issue Details

On WOW the QueueUserAPC2 call is not supported and returns ERROR_NOT_SUPPORTED. This was noticed for the win-x86 NativeAOT port, but it may affect x64 emulation on ARM64 as well.

Author: filipnavara
Assignees: -
Labels:

area-NativeAOT-coreclr

Milestone: -

@filipnavara
Copy link
Member Author

filipnavara commented Feb 28, 2024

Due to the x64 on ARM64 situation this may warrant a backport to release/8.0.

@jkotas
Copy link
Member

jkotas commented Feb 28, 2024

Regular CoreCLR has QueueUserAPC2 enabled for x64 only:

if (CLR_CMAKE_TARGET_WIN32 AND CLR_CMAKE_TARGET_ARCH_AMD64)
add_definitions(-DFEATURE_SPECIAL_USER_MODE_APC)
endif()

We should fix this by keeping regular CoreCLR and native AOT in sync.

@jkotas
Copy link
Member

jkotas commented Feb 28, 2024

Related to #80087 . cc @VSadov

@filipnavara
Copy link
Member Author

We should fix this by keeping regular CoreCLR and native AOT in sync.

That's what I originally did in e378290. Then I started discussing some issue about ARM64 and the documentation suggested that it's not supported there either. Turns out that x64 emulation on ARM64 actually supports it and the documentation is wrong. There may be some other issue with thread redirection under the emulation but that's unrelated.

I can submit the commit above instead, if you prefer.

@VSadov
Copy link
Member

VSadov commented Feb 28, 2024

I think at the time this was implemented it was basically - Win11 supports the API and Win10 produces ERROR_INVALID_PARAMETER.
It looks like Win10 supports it now and under WoW it returns a different error.

Copy link
Member

@VSadov VSadov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@jkotas
Copy link
Member

jkotas commented Feb 28, 2024

Thanks!

@jkotas jkotas merged commit 0a1d294 into dotnet:main Feb 28, 2024
108 of 110 checks passed
@filipnavara filipnavara deleted the user-apc-last-err branch February 28, 2024 19:58
@github-actions github-actions bot locked and limited conversation to collaborators Mar 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants