[PATCH] D114421: [asan] Add support for disable_sanitizer_instrumentation attribute

Alexander Potapenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 7 07:14:49 PST 2021


glider added a comment.

> Should we have in AddressSanitizer.cpp the following for consistency with other sanitizers?

Good catch, without that disable_sanitizer_instrumentation could not override sanitize_address.
I fixed this and added a test.



================
Comment at: clang/test/CodeGen/asan-globals.cpp:62
 // CHECK: ![[ATTR_GLOBAL]] = !{{{.*}}, null, null, i1 false, i1 true}
+// CHECK: ![[DISABLE_INSTR_GLOBAL]] = !{{{.*}}, null, null, i1 false, i1 true}
 // CHECK: ![[BLACKLISTED_GLOBAL]] = !{{{.*}}, null, null, i1 false, i1 true}
----------------
eugenis wrote:
> Does this test rely on the metadata being in the same order as the global declarations in the source?  Feels brittle and hard to understand - could you check if the regexps could be made more precise?
`llvm.asan.globals` above actually look as follows: `!llvm.asan.globals = !{!0, !2, !4, !6, !7, !8, !9, !11, !13, !15}`

, so the placeholder variables (e.g. `ATTR_GLOBAL` and `DISABLE_INSTR_GLOBAL`) actually match just the metadata node numbers.
I replaced the `{{.*}}` with variable/file names where applicable, but we'll still depend on the order of globals.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114421



More information about the cfe-commits mailing list