[llvm-bugs] [Bug 41095] New: interceptors for __pthread_mutex_(un)lock should wrap __pthread_mutex_lock but actually call pthread_mutex_lock

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Mar 16 04:27:23 PDT 2019


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

            Bug ID: 41095
           Summary: interceptors for __pthread_mutex_(un)lock should wrap
                    __pthread_mutex_lock but actually call
                    pthread_mutex_lock
           Product: compiler-rt
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: asan
          Assignee: unassignedbugs at nondot.org
          Reporter: roc at ocallahan.org
                CC: llvm-bugs at lists.llvm.org

https://github.com/llvm-project/llvm-project-20170507/commit/0a6efb6b61cba4040646e634c89c81ce38512d4d#diff-84c56a2db2415e80a9250fcf8679f462R4057

  #if SANITIZER_INTERCEPT___PTHREAD_MUTEX
  INTERCEPTOR(int, __pthread_mutex_lock, void *m) {
    return WRAP(pthread_mutex_lock)(m);
  }

This doesn't look right to me. I think it should call
WRAP(__pthread_mutex_lock).

This matters in practice because rr wraps pthread_mutex_lock to modify mutex
state and then call __pthread_mutex_lock. When recording an ASAN application,
ASAN intercepts __pthread_mutex_lock to delegate to pthread_mutex_lock, which
ends up back at rr's override. So we're in an infinite loop.

-- 
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/20190316/efe06958/attachment.html>


More information about the llvm-bugs mailing list