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: [email protected]
          Reporter: [email protected]
                CC: [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to