title: cause of: AddressSanitizer: SEGV on unknown address (null pointer)
body: <p>I need some advice how to identify the source of the segfault.</p>
  
  <p>compiled with ASAN:</p>
  
  <pre><code>==21093==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f09d744d882 bp 0x000000001000 sp 0x62100001c538 T0)
  ASAN:DEADLYSIGNAL
  AddressSanitizer: nested bug in the same thread, aborting.
  </code></pre>
  
  <p>started with gdb:</p>
  
  <pre><code>Program received signal SIGSEGV, Segmentation fault.    
  0x00007ffff5eeb882 in __memset_avx2_erms () from /usr/lib/libc.so.6
  (gdb) bt
  #0  0x00007ffff5eeb882 in __memset_avx2_erms () from /usr/lib/libc.so.6
  #1  0xbebebebebebebebe in ?? ()
  #2  0xbebebebebebebebe in ?? ()
  ...
  </code></pre>
  
  <p><strong>1. Edit:</strong></p>
  
  <p>the output above was compiled for 64bit (x86_64), on 32bit following output is generated:</p>
  
  <pre><code>==8361==ERROR: AddressSanitizer failed to allocate 0x200000 (2097152) bytes of SizeClassAllocator32 (error code: 12)
  ==8361==Process memory map follows:
      0x00200000-0x00300000
      0x00400000-0x00500000
  ...
      0xf7791000-0xf7792000   /lib32/ld-2.24.so
      0xf7800000-0xffd00000
      0xffe34000-0xffe55000   [stack]
  ==8361==End of process memory map.
  ==8361==AddressSanitizer CHECK failed: ../../../../../src/libsanitizer/sanitizer_common/sanitizer_common.cc:180 "((0 &amp;&amp; "unable to mmap")) != (0)" (0x0, 0x0)
  ERROR: Failed to mmap
  </code></pre>
  
  <p><strong>2. EDIT:</strong></p>
  
  <pre><code>Program received signal SIGSEGV, Segmentation fault.
  0x00007ffff5eeb882 in __memset_avx2_erms () from /usr/lib/libc.so.6
  (gdb) bt
  #0  0x00007ffff5eeb882 in __memset_avx2_erms () from /usr/lib/libc.so.6
  #1  0xbebebebebebebebe in ?? ()
  #2  0xbebebebebebebebe in ?? ()
  #3  0xbebebebebebebebe in ?? ()
  #4  0xbebebebebebebebe in ?? ()
  ...
  (gdb) record instruction-history
  17798      0x00007ffff5eeb8b6 &lt;__memset_avx2_unaligned_erms+22&gt;:    cmp    $0x40,%rdx
  17799      0x00007ffff5eeb8ba &lt;__memset_avx2_unaligned_erms+26&gt;:    ja     0x7ffff5eeb8ca &lt;__memset_avx2_unaligned_erms+42&gt;
  17800      0x00007ffff5eeb8ca &lt;__memset_avx2_unaligned_erms+42&gt;:    cmp    $0x800,%rdx
  17801      0x00007ffff5eeb8d1 &lt;__memset_avx2_unaligned_erms+49&gt;:    ja     0x7ffff5eeb870 &lt;__memset_avx2_erms&gt;
  17802      0x00007ffff5eeb870 &lt;__memset_avx2_erms+0&gt;:   vzeroupper 
  17803      0x00007ffff5eeb873 &lt;__memset_avx2_erms+3&gt;:   mov    %rdx,%rcx
  17804      0x00007ffff5eeb876 &lt;__memset_avx2_erms+6&gt;:   movzbl %sil,%eax
  17805      0x00007ffff5eeb87a &lt;__memset_avx2_erms+10&gt;:  mov    %rdi,%rdx
  17806      0x00007ffff5eeb87d &lt;__memset_avx2_erms+13&gt;:  rep stos %al,%es:(%rdi)
  17807      0x00007ffff5eeb87f &lt;__memset_avx2_erms+15&gt;:  mov    %rdx,%rax
  </code></pre>
  
  <p>not sure what that means/why this causes a segfault?</p>