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

Error running address sanitizer on basic input #477

Open
caymaynard opened this issue Jan 29, 2025 · 7 comments
Open

Error running address sanitizer on basic input #477

caymaynard opened this issue Jan 29, 2025 · 7 comments

Comments

@caymaynard
Copy link

OS: windows 11
mingw-llvm: 19.1.7 with UCRT

Similar to llvm/llvm-project#82450, I have been encountering an error when running address sanitizer.

main.c:

int main(int argc, char **argv) {}

compiled with clang -fsanitize=address main.c

Unlike the previous issue though, I get a different unhandled instruction

==17396==interception_win: unhandled instruction at 0x7ffb63223a40: 44 0f b6 1a 4c 8b d2 48
==17396==interception_win: unhandled instruction at 0x7ffb63223a40: 44 0f b6 1a 4c 8b d2 48

CMIIW, but it looks like this instruction is supposed to be handled by ASAN in https://github.com/llvm/llvm-project/blob/b8cdc5ea2741c7e4062bb211bac7033189b4d802/compiler-rt/lib/interception/interception_win.cpp#L905

Is there some macro definition which is required to correctly interpret the instruction?

@mati865
Copy link
Contributor

mati865 commented Jan 29, 2025

Interestingly, yesterday there was a similar report at MSYS2 discord: https://discord.com/channels/792780131906617355/792780132398006315/1333809892074590309

I can reproduce neither on Win 11, using the 64-bit UCRT toolchain.

@mstorsjo
Copy link
Owner

mstorsjo commented Jan 29, 2025

A lot of fixes for unhandled instructions have been merged quite recently; do you get the same issues still with e.g. the latest nightly builds? https://github.com/mstorsjo/llvm-mingw/releases/nightly

@mstorsjo
Copy link
Owner

CC @bernhardu

@bernhardu
Copy link

Thanks for the information.

But as far as I see the instruction 44 0f b6 1a got added in this patch to main branch four month ago,
which mentions some relation to "the 24H2 update for Windows 11".

Unfortunately these got not backported to the release/19.x branch where the file compiler-rt/lib/interception/interception_win.cpp got last updated in march.

Backporting llvm/llvm-project@ce4618a and llvm/llvm-project@8417f6af54 to the 19.x branch might be a good thing, as there may more users to be expected getting this updates?

I hope it is ok to CC @zmodem too, as I am new to llvm-project and not sure how backporting in llvm-project is handled.

@mstorsjo
Copy link
Owner

But as far as I see the instruction 44 0f b6 1a got added in this patch to main branch four month ago, which mentions some relation to "the 24H2 update for Windows 11".

Unfortunately these got not backported to the release/19.x branch where the file compiler-rt/lib/interception/interception_win.cpp got last updated in march.

Backporting llvm/llvm-project@ce4618a and llvm/llvm-project@8417f6af54 to the 19.x branch might be a good thing, as there may more users to be expected getting this updates?

The LLVM release process currently is such that there's probably no more releases of 19.x to be expected (and if there are, it's mostly for really critical fixes). But 20.x got branched today, and the first RC will be released by the end of the week, so there'll be a prerelease of llvm-mingw built from that soon thereafter as well.

Outside of the main llvm release process, e.g. msys2 also backport a number of patches to their packages, so there you can sometimes get e.g. a 19.x release build with patches that otherwise would wait to 20.x.

And within llvm-mingw, I make nightly builds that are available at https://github.com/mstorsjo/llvm-mingw/releases/nightly, to make it easy to test things out, whether things have been fixed in the latest git.

@caymaynard
Copy link
Author

Thanks for the details!

I have tested against the nightly build (built from https://github.com/llvm/llvm-project.git 617278e7b0c937fccbf7d67d14f053c3409bc33f) and the address sanitizer works on my machine now.

I only need this for debugging a stack corruption issue I was facing, so I personally am fine with using the nightly builds until 20.x is released.

@akoluthic
Copy link

I can confirm that using a recent nightly build allows me to successfully run programs compiled with -fsanitize=address. The issue appeared after the 24H2 update as mentioned previously in the thread.

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

No branches or pull requests

5 participants