https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107963

            Bug ID: 107963
           Summary: Support
                    __attribute__((disable_sanitizer_instrumentation))
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: i at maskray dot me
  Target Milestone: ---

Clang introduced the attribute in https://reviews.llvm.org/D108029 (2021-08).
It disables instrumentations for all kinds of sanitizers.
For non-memory sanitizers, it's like the union of all available
no_sanitize("xxx").
For msan, it disables all instrumentations, therefore the following function
does not unpoison the shadow for *a, which may lead to a false positive for a
subsequent function
(https://clang.llvm.org/docs/MemorySanitizer.html#attribute-disable-sanitizer-instrumentation).
That said, such functionality is useful in some scenarios, e.g. `noinstr` in
the Linux kernel
(https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9b448bc25b776daab3215393c3ce6953dd3bb8ad)

__attribute__((disable_sanitizer_instrumentation)) int foo(int *a) {
  *a = 42;
  return *a;
}

Reply via email to