[PATCH] D25946: [compiler-rt][asan] Add support for desallocation of unhandled pointers

Filipe Cabecinhas via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 14 15:09:27 PST 2017


Shouldn't the implementation of `PlatformIsValidAddress` Be
`UNIMEMENTED();` on non-Wibdows? That way we're sure we don't call it by
mistake.

Thank you,

 Filipe

On Tue, 14 Feb 2017 at 18:18, Etienne Bergeron via Phabricator via
llvm-commits <llvm-commits at lists.llvm.org> wrote:

> etienneb added inline comments.
>
>
> ================
> Comment at: lib/asan/asan_win.cc:282
> +  MEMORY_BASIC_INFORMATION mem_info = {};
> +  if (::VirtualQuery((LPVOID)addr, &mem_info, sizeof(mem_info)) == 0 ||
> +      mem_info.State == MEM_FREE) {
> ----------------
> rnk wrote:
> > etienneb wrote:
> > > rnk wrote:
> > > > This is too broad. This will suppress invalid free checks on any
> pointer from VirtualAlloc. Why not use HeapValidate? It appears to support
> checking a single block efficiently:
> https://msdn.microsoft.com/en-us/library/windows/desktop/aa366708(v=vs.85).aspx
> > > Are we assuming?
> > >  1) no custom memory management (direct access to virtual-alloc/free)?
> > >  2) no other heap (only the default process heap
> > >
> > > And I'm not sure |lpMem| can be any arbitrary pointer within the
> memory chunk. I suspect it must be the begining of the block.
> > We only come here when someone calls `free` in the CRT. That means they
> must be using the system heap. ASan assumes it's the only code hotpatching
> the system heap. We only want to suppress invalid free reports on pointers
> to blocks of memory allocated on the system heap from before ASan
> initialized. Any other pointer should generate an invalid free report.
> You're right, this is for Free(...).
> I'm gonna add a comment to  |IsSystemHeapAddress |.
>
>
> https://reviews.llvm.org/D25946
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170214/57884edc/attachment-0001.html>


More information about the llvm-commits mailing list