<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - memory sanitizer crashes in SDL_Init on __sanitizer::ForEachMappedRegion"
   href="http://llvm.org/bugs/show_bug.cgi?id=20694">20694</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>memory sanitizer crashes in SDL_Init on __sanitizer::ForEachMappedRegion
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.4
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nido@foxserver.be
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>when i compile <a href="http://pastebin.com/BDbd9KRw">http://pastebin.com/BDbd9KRw</a> (basically just calling
SDL_Init(SDL_INIT_VIDEO);) with -fsanitize=memory results in a              
crash/hang on fedora 20.

<a href="http://code.google.com/p/memory-sanitizer/wiki/Running#Running_with_the_dynamic_tool">http://code.google.com/p/memory-sanitizer/wiki/Running#Running_with_the_dynamic_tool</a>
seems to suggest that I may need to compile the SDL library with memory
sanitiser support for this to work properly. If this is the case, it may be
prudent to do a check/warning for this on dlopen; much like how it warns about
running the memory sanitizer in GDB without turning off disabling ASLR.


clang version reports 'clang version 3.4 (tags/RELEASE_34/final)'. 


to reproduce:
1: install fedora20 (optional, though it would probably fail differently on
different distros)
2: put pastebin code in test.cpp
3: run clang++ -fsanitize=memory test.cpp -lSDL2 -I/usr/include/SDL2/ -o test
4: run ./test

result:

- run top and observe 'test' ruinning at 50% cpu usage and 'abrt-hook-ccpp'
(fedora seems to catch segfaults or something) at 100% usage, as opposed to the
program exiting almost instantly when compiled without memory sanitizer.

- Running it in gdb reveals it stops on on 
0x00007f2d18900076 in __sanitizer::ForEachMappedRegion(link_map*, void (*)(void
const*, unsigned long)) () after dlopen()
full gdb trace is at <a href="http://pastebin.com/wbntabtx">http://pastebin.com/wbntabtx</a>




expected result:
- the program runs normally and reports problems with allocated memory.
OR
- The program runs normally up to dlopen, when it informs me that I need to
compile said linked library with memory sanitation as well</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>