http://llvm.org/bugs/show_bug.cgi?id=15749

            Bug ID: 15749
           Summary: llvm::sys::Memory not thread-safe
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Support Libraries
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Memory::allocateMappedMemory() has a block-scope static that caches the size of
a page (in both Posix and Windows versions).  When LLVM is built by a pre-C++11
compiler (note 1), multiple threads may race on examining and setting the
hidden boolean.  In the case of MS Visual Studio this is disastrous because it
sets the flag before setting the value, which results in other threads using
the not-yet-set value.

  static const size_t PageSize = Process::GetPageSize();
  const size_t NumPages = (NumBytes+PageSize-1)/PageSize;

(1) C++11 says concurrent access must be serialized, previous Standards did
not.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to