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

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 5 12:22:53 PDT 2020


pcc added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:1859
+    // array elements
+    if (Section.startswith("link_set")) {
+      LLVM_DEBUG(dbgs() << "Ignoring global in sorted section "
----------------
krytarowski wrote:
> mgorny wrote:
> > pcc wrote:
> > > What do the names of these sections look like? From the test I presume that they have C identifier names and are enumerated via `__start_`/`__stop_`. In that case we should exclude all C identifier named sections from instrumentation (not just `link_set*`) in order to fix similar bugs involving those sections.
> > They are created via the following macro:
> > 
> > ```
> > #define	__link_set_make_entry(set, sym)					\
> > 	static void const * const __link_set_##set##_sym_##sym		\
> > 	    __section("link_set_" #set) __used = (const void *)&sym
> > ```
> > 
> > So the `link_set_` name is enforced on our end. Of course, people can do any crazy things they like, so can't tell if anyone else has a similar use case.
> @pcc can you suggest how to implement a generalized version of this patch that disables instrumentation of user-defined sections?
Something like:
```
if (ELF) {
  for (char C : Section) {
    if (!((C >= 'A' && C <= 'Z') || (C >= 'a' && C <= 'a') || (C >= '0' && C <= '9') || C == '_')))
      return false;
  }
}
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76665/new/

https://reviews.llvm.org/D76665





More information about the llvm-commits mailing list