[PATCH] D76665: [asan] Stop instrumenting NetBSD-specific link_set sections

Kamil Rytarowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 23 20:41:26 PDT 2020


krytarowski created this revision.
krytarowski added reviewers: joerg, mgorny, vitalybuka, kcc, lebedev.ri.
krytarowski added a project: Sanitizers.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

Do not instrument NetBSD and NetBSD-derived (such as rumpkernel) code
sections dedicated for the __link_set API that expects consecutive
array elements.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76665

Files:
  llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp


Index: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -1862,6 +1862,15 @@
       return false;
     }
 
+    // Do not instrument NetBSD and NetBSD-derived (such as rumpkernel) code
+    // sections dedicated for the __link_set API that expects consecutive
+    // array elements
+    if (Section.startswith("link_set")) {
+      LLVM_DEBUG(dbgs() << "Ignoring global in sorted section "
+                        << "(starts with 'link_set'): " << *G << "\n");
+      return false;
+    }
+
     // On COFF, if the section name contains '$', it is highly likely that the
     // user is using section sorting to create an array of globals similar to
     // the way initialization callbacks are registered in .init_array and


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76665.252210.patch
Type: text/x-patch
Size: 928 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200324/10398aa1/attachment.bin>


More information about the llvm-commits mailing list