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 · 12 comments

Comments

Projects
None yet
3 participants
@ramosian-glider
Copy link
Member

ramosian-glider commented Aug 31, 2015

Originally reported on Google Code with ID 131

subj

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

@ramosian-glider

This comment has been minimized.

Copy link
Member Author

ramosian-glider commented Aug 31, 2015

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

This comment has been minimized.

Copy link
Member Author

ramosian-glider commented Aug 31, 2015

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

This comment has been minimized.

Copy link
Member Author

ramosian-glider commented Aug 31, 2015

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

This comment has been minimized.

Copy link
Member Author

ramosian-glider commented Aug 31, 2015

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

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

@ramosian-glider

This comment has been minimized.

Copy link
Member Author

ramosian-glider commented Aug 31, 2015

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

  • Blocking: #172614
@ramosian-glider

This comment has been minimized.

Copy link
Member Author

ramosian-glider commented Aug 31, 2015

Fixed as of r174628.

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

  • Status changed: Fixed
@ramosian-glider

This comment has been minimized.

Copy link
Member Author

ramosian-glider commented Aug 31, 2015

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

This comment has been minimized.

Copy link
Member Author

ramosian-glider commented Aug 31, 2015

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

This comment has been minimized.

Copy link
Member Author

ramosian-glider commented Aug 31, 2015

Forget it, won't work.

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

@ramosian-glider

This comment has been minimized.

Copy link
Member Author

ramosian-glider commented Aug 31, 2015

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

  • Labels added: ProjectAddressSanitizer
@ramosian-glider

This comment has been minimized.

Copy link
Member Author

ramosian-glider commented Aug 31, 2015

Adding Project:AddressSanitizer as part of GitHub migration.

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

@kcc

This comment has been minimized.

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.

@kcc kcc closed this Dec 1, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.