ramosian-glider / sanitizers

0 stars 0 forks source link

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

Open ramosian-glider opened 9 years ago

ramosian-glider commented 9 years ago

Originally reported on Google Code with ID 131

subj

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

ramosian-glider commented 9 years ago
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 commented 9 years ago
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 commented 9 years ago
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

ramosian-glider commented 9 years ago
I've temporarily disabled the new/delete implementations on OSX

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

ramosian-glider commented 9 years ago

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

ramosian-glider commented 9 years ago
Fixed as of r174628.

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

ramosian-glider commented 9 years ago
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

ramosian-glider commented 9 years ago
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 commented 9 years ago
Forget it, won't work.

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

ramosian-glider commented 9 years ago

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

ramosian-glider commented 9 years ago
Adding Project:AddressSanitizer as part of GitHub migration.

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