[llvm-bugs] [Bug 45400] New: __attribute__((naked)) doesn't disable sanitizer instrumentation

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 2 03:03:09 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=45400

            Bug ID: 45400
           Summary: __attribute__((naked)) doesn't disable sanitizer
                    instrumentation
           Product: compiler-rt
           Version: 10.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: tsan
          Assignee: unassignedbugs at nondot.org
          Reporter: ant.bikineev at gmail.com
                CC: llvm-bugs at lists.llvm.org

With sanitizers enabled, clang still generates instrumented code for functions
marked with __attribute__((naked)):

extern "C" __attribute__((naked)) 
void PushAllRegistersAndIterateStack() {
    asm("ret");
}

with -fsanitize=thread is compiled into

PushAllRegistersAndIterateStack:        # @PushAllRegistersAndIterateStack
        mov     rdi, qword ptr [rbp + 8]
        call    __tsan_func_entry
        ret

(https://godbolt.org/z/XPstQ1)

The problem is also reproduced at least with ubsan.

I assume that __attribute__((naked)) should entail no_sanitize(*). GCC's
behaviour is as expected (no instrumented code is generated).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200402/572695c4/attachment-0001.html>


More information about the llvm-bugs mailing list