title: Is it legal to change __stack_chk_guard inside of C function?
body: <p>I have a function which changes the value of the stack check guard.
  This function is compiled with <code>-fstack-protector-all</code>.
  This means that stack check operations will be generated inside of this function. This added code will save the stack check value at the beginning into the stack and will check saved value at the end of the function. But we're changing the value. That is why, I expect stack smashing will be generated.</p>
  
  <pre><code>unsigned long __stack_chk_guard = 0;
  
  void change___stack_chk_guard()
  {
      __stack_chk_guard = 1234;
  }
  
  int main()
  {
      change___stack_chk_guard();
      return 0;
  }
  </code></pre>
  
  <p>So, can I do initialization of <code>__stack_chk_guard</code> like this?</p>