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

Fix AVX detection #121

Merged
merged 1 commit into from Nov 6, 2023
Merged

Fix AVX detection #121

merged 1 commit into from Nov 6, 2023

Conversation

hardfalcon
Copy link
Contributor

The old/faulty code would try to use AVX/AVX2 if either the SSE bit or the AVX bit were set in XCR0, but did not check if both bits were set.

In most cases, this still worked, but on some machines, enabling linux kernel mitigations for the "gather data sampling" vulnerability results in only the SSE bit but not the AVX bit being set, thus resulting in an illegal instruction and crashing the application.

Fix this by checking that both bits are set.

Fixes: 4bbb590 ("Proper check of CPU's AVX2 feature support (with MSVC support)")

The old/faulty code would try to use AVX/AVX2 if either the SSE bit or
the AVX bit were set in XCR0, but did not check if both bits were set.

In most cases, this still worked, but on some machines, enabling linux
kernel mitigations for the "gather data sampling" vulnerability results
in only the SSE bit but not the AVX bit being set, thus resulting in an
illegal instruction and crashing the application.

Fix this by checking that both bits are set.

Fixes: 4bbb590 ("Proper check of CPU's AVX2 feature support (with MSVC support)")
Signed-off-by: Pascal Ernster <git@hardfalcon.net>
@hardfalcon
Copy link
Contributor Author

By the way, this issue also affects node.js, and projects that use node.js, like electron or lightdm-webkit2-greeter.

@aklomp
Copy link
Owner

aklomp commented Nov 6, 2023

Merged, thanks for the contribution!

@hardfalcon
Copy link
Contributor Author

You're welcome, thanks for merging so quickly :)

@bnoordhuis
Copy link

@aklomp would it be possible to do a v0.5.1 release? That would help node and electron.

@aklomp aklomp mentioned this pull request Nov 8, 2023
@aklomp
Copy link
Owner

aklomp commented Nov 8, 2023

@bnoordhuis Indeed, it's time. I created #122 and will get on it right now.

@aklomp
Copy link
Owner

aklomp commented Nov 8, 2023

Alright, released v0.5.1.

@bnoordhuis
Copy link

Excellent, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants