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

asan should check malloc/delete or new/free mismatch #131

Closed
ramosian-glider opened this issue Aug 31, 2015 · 13 comments
Closed

asan should check malloc/delete or new/free mismatch #131

ramosian-glider opened this issue Aug 31, 2015 · 13 comments

Comments

@ramosian-glider
Copy link
Member

Originally reported on Google Code with ID 131

subj

Reported by konstantin.s.serebryany on 2012-12-03 12:06:12

@ramosian-glider
Copy link
Member Author

LLVM r170869:
[asan] add a flag alloc_dealloc_mismatch (off by default for now) which finds malloc/delete,
new/free, new/delete[], etc mismatches

Reported by konstantin.s.serebryany on 2012-12-21 08:55:44

@ramosian-glider
Copy link
Member Author

FTR, I'll also need to add OS X interceptors in order for this to work.

Reported by ramosian.glider on 2012-12-21 09:41:50

@ramosian-glider
Copy link
Member Author

This feature is now enabled by default on Linux, but not on Mac. 

Reported by konstantin.s.serebryany on 2013-01-14 14:05:45

  • Labels added: OpSys-OSX

@ramosian-glider
Copy link
Member Author

I've temporarily disabled the new/delete implementations on OSX

Reported by ramosian.glider on 2013-01-22 11:39:23

@ramosian-glider
Copy link
Member Author

Reported by glider@chromium.org on 2013-01-28 15:19:54

  • Blocking: #172614

@ramosian-glider
Copy link
Member Author

Fixed as of r174628.

Reported by ramosian.glider on 2013-02-07 16:03:26

  • Status changed: Fixed

@ramosian-glider
Copy link
Member Author

This is still broken. Citing myself from http://llvm.org/bugs/show_bug.cgi?id=15544:

"""
The current ASan implementation of custom new()/delete() does not work reliably
on Mac (it may occasionally, but that's fake safety). Because the ASan runtime
library is a DSO, we end up having the main executable depend on two DSOs
(libstdc++ and libclang_rt.asan_osx_dynamic) each having their own new/delete
implementation. It's not determined which of them is picked at startup (I saw
both versions already).
Until we decide how to make ASan reliably intercept new/delete on OS X we just
need to disable our custom interceptors - that should fix the new_handler
issue.
"""

I've disabled alloc_dealloc_mismatch and the corresponding tests on OS X for now.

Reported by ramosian.glider on 2013-04-23 12:16:26

  • Status changed: Accepted

@ramosian-glider
Copy link
Member Author

A crazy idea follows.
What if we add a weak undefined symbol to asan runtime that can be resolved by libstdc++?
This way asan runtime will depend on libstdc++ (if it is linked to the executable at
all). This will force the lookup order.

Reported by eugenis@chromium.org on 2013-04-23 12:28:17

@ramosian-glider
Copy link
Member Author

Forget it, won't work.

Reported by eugenis@google.com on 2013-04-23 12:47:32

@ramosian-glider
Copy link
Member Author

Reported by ramosian.glider on 2015-07-30 09:05:31

  • Labels added: ProjectAddressSanitizer

@ramosian-glider
Copy link
Member Author

Adding Project:AddressSanitizer as part of GitHub migration.

Reported by ramosian.glider on 2015-07-30 09:06:55

@kcc
Copy link
Contributor

kcc commented Dec 1, 2015

This works on Linux and seems to be hard on Mac. Not going to work on it any time soon.

@bhaller
Copy link

bhaller commented Sep 23, 2020

This continues not to work on Mac, five years later, as far as I can tell. @mdtrent not sure whether I can tag you on GitHub or not, but I'll try. :-> Since this seems to be an issue with dynamic linking or some such, I thought it might interest you – or you might even have a fix for these guys!

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

No branches or pull requests

3 participants