title: Why does this memory address %fs:0x28 ( fs[0x28] ) have a random value?
body: <p>I've written a piece of C code and I've disassembled it as well as read the registers to understand how the program works in assembly.</p>
  
  <pre><code>int test(char *this){
      char sum_buf[6];
      strncpy(sum_buf,this,32);
      return 0;
  }
  </code></pre>
  
  <p>The piece of my code that I've been examining is the test function. When I disassemble the output my test function I get ...</p>
  
  <pre><code>   0x00000000004005c0 &lt;+12&gt;:        mov    %fs:0x28,%rax
  =&gt; 0x00000000004005c9 &lt;+21&gt;:        mov    %rax,-0x8(%rbp)
  ... stuff ..
     0x00000000004005f0 &lt;+60&gt;:        xor    %fs:0x28,%rdx
     0x00000000004005f9 &lt;+69&gt;:        je     0x400600 &lt;test+76&gt;
     0x00000000004005fb &lt;+71&gt;:        callq  0x4004a0 &lt;__stack_chk_fail@plt&gt;
     0x0000000000400600 &lt;+76&gt;:        leaveq 
     0x0000000000400601 &lt;+77&gt;:        retq 
  </code></pre>
  
  <p>What I would like to know is what <code>mov %fs:0x28,%rax</code> is really doing?</p>