[PATCH] [UBSan] Allow UBSan location to store frames returned by symbolizer.

Alexey Samsonov vonosmas at gmail.com
Tue Feb 10 18:12:27 PST 2015


Hi rsmith, filcab,

__ubsan::getFunctionLocation() used to issue a call to symbolizer, and
convert the result (SymbolizedStack) to one of UBSan structures:
SourceLocation, ModuleLocation or MemoryLocation. This:
(1) is inefficient: we do an extra allocation/deallocation to copy data,
while we can instead can just pass SymbolizedStack around (which
contains all the necessary data).
(2) leaks memory: strings stored in SourceLocation/MemoryLocation are
never deallocated, and Filipe Cabecinhas suggests this causes crashes
of UBSan-ified programs in the wild.

Instead, let Location store a pointer to SymbolizedStack object, and
make sure it's properly deallocated when UBSan handler exits.

ModuleLocation is made obsolete by this change, and is deleted.

http://reviews.llvm.org/D7548

Files:
  lib/ubsan/ubsan_diag.cc
  lib/ubsan/ubsan_diag.h
  lib/ubsan/ubsan_handlers.cc

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7548.19726.patch
Type: text/x-patch
Size: 7608 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150211/c38c1bff/attachment.bin>


More information about the llvm-commits mailing list