[PATCH] D69208: [asan] Provide an interface to update an allocation stack trace.

Kostya Serebryany via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 12:49:14 PDT 2019


kcc added inline comments.


================
Comment at: compiler-rt/include/sanitizer/asan_interface.h:320
+/// trace. Returns 1 if successfull, 0 if not.
+int __asan_update_allocation(void* addr);
+
----------------
eugenis wrote:
> kcc wrote:
> > Add some explanation of when it is going to be successful. 
> > Also, what about threads? 
> > This API is racey
> Racey, as in someone could be deallocating this memory on another thread?
> This API should be used in a situation when this is possible, of course.
> It's exactly the same as malloc_usable_size().
> 
malloc_usable_size() only reads the data. 
__asan_update_allocation writes the data, so if two threads try to simultaneously call this function, we'll have a race on alloc_context_id

BTW, the name "__asan_update_allocation" doesn't seem to reflect the action. 
Maybe "__asan_update_allocation_context"?



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69208/new/

https://reviews.llvm.org/D69208





More information about the llvm-commits mailing list