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

libasan? (for "built-in" address sanitization) #148

Open
xparq opened this issue Jul 8, 2024 · 5 comments
Open

libasan? (for "built-in" address sanitization) #148

xparq opened this issue Jul 8, 2024 · 5 comments

Comments

@xparq
Copy link

xparq commented Jul 8, 2024

I've never actually used it, just tried to add -fsanitize=address after seeing it do its magic somewhere, but

g++ -g -fsanitize=address test.cpp

resulted in

ld.exe: cannot find -lasan: No such file or directory                                                                   

So, then I realized it's not actually built-in after all.

But could it be bundled in a future release?

@skeeto
Copy link
Owner

skeeto commented Jul 8, 2024 via email

@xparq
Copy link
Author

xparq commented Jul 8, 2024

Thanks a lot for the tips, and the prompt answer!

(Alas, information in READMEs is typically a read-once-or-other-low-number-of-times-early-on resource, and as soon as fragments get forgotten, they are usually gone without noticing forever -- or until reinstated in those flaky brain tissues by patient fellows like you. So, thanks also for that!)

@Peter0x44
Copy link
Contributor

(Once you've got the hang of it, this is a better experience than
libubsan anyway!)

Why do you say this? I like the diagnostic and think it's helpful, it is not always obvious what sort of UB you have introduced.

@skeeto
Copy link
Owner

skeeto commented Jul 10, 2024 via email

@Peter0x44
Copy link
Contributor

Peter0x44 commented Jul 12, 2024

Address Sanitizer has not yet been ported to Mingw-w64. While I'd love to include it, I can't until it's ported.

I don't know the specifics of how this works but llvm-mingw claims to support it.

From its README:
https://github.com/mstorsjo/llvm-mingw

Support for Address Sanitizer and Undefined Behaviour Sanitizer

However, it is only documented to only work on UCRT

Address Sanitizer only works properly with UCRT.

So that would probably be an extra hurdle, even if it did work

I'm not sure it's "Address Sanitizer has not yet been ported to mingw-w64" but more some gcc tooling or so hasn't been hooked up. I don't know the specifics...
If there is a bounty for this feature upstream I would happily pay up.

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

3 participants