title: crash at __kernel_vsyscall() doesn't occur after GCC optimization disabled
body: <p>I had a nasty crash occuring in my application. GDB always backtraced it to <code>__kernel_vsyscall()</code>. I couldn't find anything suspicious in source code after debugging.</p>
  
  <p>But randomly disabling once '-O3' optimisation flag in GCC compiler seemed to resolve the issue. I am not sure if that is the reason of crash or if compiler might have done something nasty during optimisation. Any comment or information will be helpful.</p>
  
  <p>In some backtraces shown below, the only erroneous thing observed in application code is the length of the buffer received from MsgQ (buffLen). But the source code makes sure that maximum size of messages sent and received over MsgQ is 2048 bytes. Couldn't trace why and when the length returned by msgrcv() call could have got corrupted.</p>
  
  <p>CRASH 1:</p>
  
  <ol>
  <li>0x00110416 in __kernel_vsyscall ()</li>
  <li>0x00352391 in send () from /lib/libc.so.6</li>
  <li>0x0034d31c in __vsyslog_chk () from /lib/libc.so.6</li>
  <li>0x0034d5b7 in syslog () from /lib/libc.so.6</li>
  <li>0x0804f08f in procType1Msg(MsgBuff=0xbfc10275)</li>
  <li>0x080498c5 in procRcvdMsQBuf(buffLen=134515184,buff='value optimized out')</li>
  <li>main (argc=3, argv=0xbfc10b24)</li>
  </ol>
  
  <p>CRASH 2:</p>
  
  <ol>
  <li>0x00110416 in __kernel_vsyscall ()</li>
  <li>0x00352391 in send () from /lib/libc.so.6</li>
  <li>0x0034d31c in __vsyslog_chk () from /lib/libc.so.6</li>
  <li>0x0034d5b7 in syslog () from /lib/libc.so.6</li>
  <li>0x0806234b in dumpMsg (buff=0xbfe01832 "U\006\" x,¨n,#®U\027\bI@\024",len=23)</li>
  <li>0x0804e539 in procType1Msg(MsgBuff=0xbfe01815)</li>
  <li>0x0804956d in procRcvdMsQBuf(buffLen=134515040,buff='value optimized out')</li>
  <li>main (argc=3, argv=0xbfe020c4)</li>
  </ol>
  
  <p>CRASH 3:</p>
  
  <ol>
  <li>0x00110416 in __kernel_vsyscall ()</li>
  <li>0x00353e3f in msgrcv () from /lib/libc.so.6</li>
  <li>0x080639b9 in getMsgQBuffer(msg_id=196611, pMsg=0xbfa9d360, lMsgType=0, piErrorNo=0xbfa9d35c)</li>
  <li>0x080497dd in main (argc=Cannot access memory at address 0x30003)</li>
  </ol>