[LLVMbugs] [Bug 15749] New: llvm::sys::Memory not thread-safe

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 15 08:49:36 PDT 2013


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: unassignedbugs at nondot.org
          Reporter: jim.kearney at oracle.com
                CC: llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130415/a2e554c0/attachment.html>


More information about the llvm-bugs mailing list