Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2248)

Issue 5848068: [ASan]: get rid of CoreFoundation header in interceptors on Mac (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 1 month ago by samsonov
Modified:
12 years, 1 month ago
CC:
llvm-commits_cs.uiuc.edu
Base URL:
https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/asan/
Visibility:
Public.

Description

[ASan]: get rid of CoreFoundation header in interceptors on Mac

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+20 lines, -12 lines) Patch
M asan_interceptors.cc View 1 chunk +1 line, -7 lines 0 comments Download
M asan_mac.h View 3 chunks +4 lines, -5 lines 0 comments Download
M asan_mac.cc View 3 chunks +15 lines, -0 lines 0 comments Download

Messages

Total messages: 7
samsonov
12 years, 1 month ago (2012-03-20 12:47:44 UTC) #1
glider
I see no sense in removing Mac-specific headers from asan_mac.h On Tue, Mar 20, 2012 ...
12 years, 1 month ago (2012-03-20 12:52:49 UTC) #2
samsonov
On Tue, Mar 20, 2012 at 4:52 PM, Alexander Potapenko <glider@google.com>wrote: > I see no ...
12 years, 1 month ago (2012-03-20 12:54:41 UTC) #3
kcc1
On Tue, Mar 20, 2012 at 5:54 AM, Alexey Samsonov <samsonov@google.com>wrote: > On Tue, Mar ...
12 years, 1 month ago (2012-03-20 16:27:21 UTC) #4
glider
Then we might be doing the wrong thing. asan_mac.h should contain interfaces provided by asan_mac.cc ...
12 years, 1 month ago (2012-03-20 16:35:55 UTC) #5
kcc1
On Tue, Mar 20, 2012 at 9:35 AM, Alexander Potapenko <glider@google.com>wrote: > Then we might ...
12 years, 1 month ago (2012-03-20 16:41:15 UTC) #6
samsonov
12 years, 1 month ago (2012-03-21 06:00:13 UTC) #7
On 2012/03/20 16:35:55, glider wrote:
> Then we might be doing the wrong thing.
> asan_mac.h should contain interfaces provided by asan_mac.cc that are
> to be used by other modules. Common interfaces should be in other,
> common .h files.
> Maybe we just do not want asan_interfaces to include asan_mac.h?

Currently it is the only inclusion of this header (except asan_mac.cc), and this

header barely contains any interfaces.

> On Tue, Mar 20, 2012 at 8:27 PM, Kostya Serebryany <mailto:kcc@google.com>
wrote:
> >
> >
> > On Tue, Mar 20, 2012 at 5:54 AM, Alexey Samsonov
<mailto:samsonov@google.com>
> > wrote:
> >>
> >> On Tue, Mar 20, 2012 at 4:52 PM, Alexander Potapenko
<mailto:glider@google.com>
> >> wrote:
> >>>
> >>> I see no sense in removing Mac-specific headers from asan_mac.h
> >>
> >>
> >> asan_mac.h is included in asan_interceptors.h, I think we may want to get
> >> rid of it completely.
> >
> >
> > agree. We may keep mac-specific headers in *_mac.cc, but should not use them
> > in any of the header files included into non-mac .cc files.
> >
> >>
> >>
> >>>
> >>>
> >>> On Tue, Mar 20, 2012 at 3:47 PM, mailto: <samsonov@google.com> wrote:
> >>> > Reviewers: ramosian.glider, kcc,
> >>> >
> >>> > Description:
> >>> > [ASan]: get rid of CoreFoundation header in interceptors on Mac
> >>> >
> >>> > Please review this at http://codereview.appspot.com/5848068/
> >>> >
> >>> > Affected files:
> >>> > &nbsp; M &nbsp; &nbsp; asan_interceptors.cc
> >>> > &nbsp; M &nbsp; &nbsp; asan_mac.cc
> >>> > &nbsp; M &nbsp; &nbsp; asan_mac.h
> >>> >
> >>> >
> >>> > Index: asan_mac.h
> >>> > ===================================================================
> >>> > --- asan_mac.h &nbsp;(revision 153085)
> >>> > +++ asan_mac.h &nbsp;(working copy)
> >>> > @@ -18,8 +18,6 @@
> >>> >
> >>> > &nbsp;#include "asan_interceptors.h"
> >>> >
> >>> > -#include <CoreFoundation/CFString.h>
> >>> > -
> >>> > &nbsp;typedef void* pthread_workqueue_t;
> >>> > &nbsp;typedef void* pthread_workitem_handle_t;
> >>> >
> >>> > @@ -29,6 +27,10 @@
> >>> > &nbsp;typedef void (*dispatch_function_t)(void *block);
> >>> > &nbsp;typedef void* (*worker_t)(void *block);
> >>> >
> >>> > +namespace __asan {
> >>> > +void PatchCFStringCreateCopy();
> >>> > +} &nbsp;// namespace __asan
> >>> > +
> >>> > &nbsp;DECLARE_REAL_AND_INTERCEPTOR(void, dispatch_async_f,
dispatch_queue_t
> >>> > dq,
> >>> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void *ctxt,
> >>> >
> >>> > dispatch_function_t
> >>> > func);
> >>> > @@ -54,9 +56,6 @@
> >>> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;void * workitem_arg,
> >>> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pthread_workitem_handle_t
*
> >>> > itemhandlep,
> >>> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;unsigned int *gencountp);
> >>> > -DECLARE_REAL_AND_INTERCEPTOR(CFStringRef, CFStringCreateCopy,
> >>> > - &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;CFAllocatorRef alloc,
> >>> > - &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;CFStringRef str);
> >>> >
> >>> > &nbsp;// A wrapper for the ObjC blocks used to support libdispatch.
> >>> > &nbsp;typedef struct {
> >>> > Index: asan_interceptors.cc
> >>> > ===================================================================
> >>> > --- asan_interceptors.cc &nbsp; &nbsp; &nbsp; &nbsp;(revision 153085)
> >>> > +++ asan_interceptors.cc &nbsp; &nbsp; &nbsp; &nbsp;(working copy)
> >>> > @@ -720,14 +720,8 @@
> >>> > &nbsp; &nbsp;CHECK(INTERCEPT_FUNCTION(dispatch_barrier_async_f));
> >>> > &nbsp; &nbsp;CHECK(INTERCEPT_FUNCTION(dispatch_group_async_f));
> >>> >
> >>> > - &nbsp;// Normally CFStringCreateCopy should not copy constant CF
strings.
> >>> > - &nbsp;// Replacing the default CFAllocator causes constant strings to
be
> >>> > copied
> >>> > - &nbsp;// rather than just returned, which leads to bugs in big
> >>> > applications
> >>> > like
> >>> > - &nbsp;// Chromium and WebKit, see
> >>> > &nbsp; &nbsp;//
http://code.google.com/p/address-sanitizer/issues/detail?id=10
> >>> > - &nbsp;// Until this problem is fixed we need to check that the string
is
> >>> > - &nbsp;// non-constant before calling CFStringCreateCopy.
> >>> > - &nbsp;CHECK(INTERCEPT_FUNCTION(CFStringCreateCopy));
> >>> > + &nbsp;PatchCFStringCreateCopy();
> >>> > &nbsp;#endif
> >>> >
> >>> > &nbsp; &nbsp;if (FLAG_v > 0) {
> >>> > Index: asan_mac.cc
> >>> > ===================================================================
> >>> > --- asan_mac.cc (revision 153084)
> >>> > +++ asan_mac.cc (working copy)
> >>> > @@ -16,6 +16,7 @@
> >>> >
> >>> > &nbsp;#include "asan_mac.h"
> >>> >
> >>> > +#include "asan_interceptors.h"
> >>> > &nbsp;#include "asan_internal.h"
> >>> > &nbsp;#include "asan_mapping.h"
> >>> > &nbsp;#include "asan_procmaps.h"
> >>> > @@ -34,6 +35,7 @@
> >>> > &nbsp;#include <fcntl.h>
> >>> > &nbsp;#include <unistd.h>
> >>> > &nbsp;#include <libkern/OSAtomic.h>
> >>> > +#include <CoreFoundation/CFString.h>
> >>> >
> >>> > &nbsp;namespace __asan {
> >>> >
> >>> > @@ -610,4 +612,17 @@
> >>> > &nbsp; &nbsp;}
> >>> > &nbsp;}
> >>> >
> >>> > +namespace __asan {
> >>> > +void PatchCFStringCreateCopy() {
> >>> > + &nbsp;// Normally CFStringCreateCopy should not copy constant CF
strings.
> >>> > + &nbsp;// Replacing the default CFAllocator causes constant strings to
be
> >>> > copied
> >>> > + &nbsp;// rather than just returned, which leads to bugs in big
> >>> > applications
> >>> > like
> >>> > + &nbsp;// Chromium and WebKit, see
> >>> > + &nbsp;//
http://code.google.com/p/address-sanitizer/issues/detail?id=10
> >>> > + &nbsp;// Until this problem is fixed we need to check that the string
is
> >>> > + &nbsp;// non-constant before calling CFStringCreateCopy.
> >>> > + &nbsp;CHECK(INTERCEPT_FUNCTION(CFStringCreateCopy));
> >>> > +}
> >>> > +} &nbsp;// namespace __asan
> >>> > +
> >>> > &nbsp;#endif &nbsp;// __APPLE__
> >>> >
> >>> >
> >>> > _______________________________________________
> >>> > llvm-commits mailing list
> >>> > mailto:llvm-commits@cs.uiuc.edu
> >>> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >>>
> >>>
> >>>
> >>> --
> >>> Alexander Potapenko
> >>> Software Engineer
> >>> Google Moscow
> >>
> >>
> >>
> >>
> >> --
> >> Alexey Samsonov
> >> Software Engineer, Moscow
> >> mailto:samsonov@google.com
> >>
> >>
> >> _______________________________________________
> >> llvm-commits mailing list
> >> mailto:llvm-commits@cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >>
> >
> 
> 
> 
> -- 
> Alexander Potapenko
> Software Engineer
> Google Moscow
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b