[llvm-commits] [cfe-commits] Compiler-rt changes for detecting initialization order problems in Address Sanitizer

Kostya Serebryany kcc at google.com
Mon Jul 2 00:55:31 PDT 2012


bcc: cfe-commits
[asan-rt patches usually go to llvm-commits]

+  PoisonShadow(g->beg, g->size_with_redzone, -1);


-1 should be a constant similar to kAsanStackLeftRedzoneMagic, ideally not
0xff and different from all other constants.
Also, please update switch in  __asan_report_error


+  for (ListOfGlobals *l = list_of_globals; l; l = l->next) {


+    //Poison only globals not defined in this TU


+    if (!IsGlobalInList(globals, n, l->g)){

This is N^2, isn't it?
Even once we get rid of N^2, this will still be not very efficient (due to
linked list traversal).
I can live with this for now, but this will need to be fixed before we
enable the phase.

BTW, asan-rt uses cpplint to check the code. (try "make -f Makefile.old
lint" in asan dir)

Thanks!
--kcc



On Sat, Jun 30, 2012 at 1:35 AM, Reid Watson <reidw at google.com> wrote:

> Hello,
>
> I've attached a patch to add basic support for detecting problems with
> initialization order in C++ to AddressSanitizer.
> This patch relies on changes to the instrumentation pass, and I've
> sent a patch for this to LLVM.
> This is definitely a first draft, and it leans toward false positives
> (function local statics, in particular), but it does detect the most
> basic cases of the "static initialization order fiasco".
> For now, I'd like to get a working baseline/infrastructure committed,
> in order to avoid any monster commits.
>
>
> All the best,
> Reid
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120702/f6e21219/attachment.html>


More information about the llvm-commits mailing list