[all-commits] [llvm/llvm-project] 29e849: [asan] Optimize initialization order checking (#10...

Vitaly Buka via All-commits all-commits at lists.llvm.org
Wed Aug 7 23:17:35 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 29e849bfd35782b24c80db23267937b888b4aa36
      https://github.com/llvm/llvm-project/commit/29e849bfd35782b24c80db23267937b888b4aa36
  Author: Vitaly Buka <vitalybuka at google.com>
  Date:   2024-08-07 (Wed, 07 Aug 2024)

  Changed paths:
    M compiler-rt/lib/asan/asan_globals.cpp
    A compiler-rt/test/asan/TestCases/Linux/initialization-nobug-lld.cpp
    M compiler-rt/test/asan/TestCases/initialization-nobug.cpp

  Log Message:
  -----------
  [asan] Optimize initialization order checking (#101837)

The pair `__asan_before_dynamic_init` and `__asan_after_dynamic_init` is
executed for each TU. `__asan_after_dynamic_init` unpoisons all globals,
which
makes the time complexity O(N^2), where N is the maximum of the global
count and
the TU count. This is expensive for large binaries.

This patch decreases the time complexity to O(N), when lld and static
runtime is
used on SANITIZER_CAN_USE_PREINIT_ARRAY platforms. This requires:

Enabling incremental poisoning (`__asan_before_dynamic_init` since
https://github.com/llvm/llvm-project/pull/101597). Making most
`__asan_after_dynamic_init` calls do nothing.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list