title: Do threads have access to stack of other threads of same process?
body: <p>I am aware that the threads of a process share the address space (all the segments) except the stack. Each thread has it's own stack. I have also read that being in same address space, threads can have access to the memory location belonging to the stack of other thread (<a href="https://stackoverflow.com/questions/18880016/access-local-stack-of-linux-threads-pthreads">here</a> and <a href="https://stackoverflow.com/questions/9698801/how-is-a-stack-belonging-to-a-thread-different-from-a-stack-of-a-process">here</a>). </p>
  
  <p>If above statements are correct, I've this question: what happens when OS sees such address from a thread? What if threads write something in other's stack and corrupt them? why OS doesn't generate some sort of permission denied error?</p>
  
  <p>If answer for this question depends on operating systems, please consider Linux.</p>