[all-commits] [llvm/llvm-project] ed2c3f: [lsan][Darwin] Scan libdispatch and Foundation mem...

Leonard Grey via All-commits all-commits at lists.llvm.org
Wed Sep 14 13:47:21 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ed2c3f46f5a74de9965c424a3a8ca99546b2c939
      https://github.com/llvm/llvm-project/commit/ed2c3f46f5a74de9965c424a3a8ca99546b2c939
  Author: Leonard Grey <lgrey at chromium.org>
  Date:   2022-09-14 (Wed, 14 Sep 2022)

  Changed paths:
    M compiler-rt/lib/lsan/lsan_common_mac.cpp
    A compiler-rt/test/lsan/TestCases/Darwin/dispatch_continuations.mm
    A compiler-rt/test/lsan/TestCases/Darwin/trampoline.mm

  Log Message:
  -----------
  [lsan][Darwin] Scan libdispatch and Foundation memory regions

libdispatch uses its own heap (_dispatch_main_heap) for some allocations, including the dispatch_continuation_t that holds a dispatch source's event handler.
Objective-C block trampolines (creating methods at runtime with a block as the implementations) use the VM_MEMORY_FOUNDATION region (see https://github.com/apple-oss-distributions/objc4/blob/8701d5672d3fd3cd817aeb84db1077aafe1a1604/runtime/objc-block-trampolines.mm#L371).

This change scans both regions to fix false positives. See tests for details; unfortunately I was unable to reduce the trampoline example with imp_implementationWithBlock on a new class, so I'm resorting to something close to the bug as seen in the wild.

Differential Revision: https://reviews.llvm.org/D129385




More information about the All-commits mailing list