<div> </div>
<div>In user space when you write beyond your address space (if your write crosses </div>
<div>the page boundary alloacted to you), then process is terminated. In the kernel</div>
<div>you are still writinng inside the kernel address space. Your write is not beyond</div>
<div>kernel address space.</div>
<div> </div>
<div>Secondly you are corrupting some other data structure. The kernel stack is part</div>
<div>of task_struct of the running process, a kmalloc or slab allocator might have</div>
<div>provided this memory (task_-struct).  When you write beyond this if the </div>
<div>write modiefies some crucial data structure that may result in hang or a crash. </div>
<div> </div>
<div><br><br> </div>
<div class="gmail_quote">On Thu, Sep 13, 2012 at 12:15 PM, shubham sharma <span dir="ltr">&lt;<a href="mailto:shubham20006@gmail.com" target="_blank">shubham20006@gmail.com</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">Hi,<br><br>As far as i know, the size of stack allocated in the kernel space is<br>8Kb for each process. But in case i use more than 8Kb of memory from<br>
the stack then what will happen? I think that in that case the system<br>would crash because i am accessing an illegal memory area. I wrote<br>kernel module in which i defined an integer array whose size was 8000.<br>But still it did not crash my system. Why?<br>
<br>The module i wrote was as follows:<br><br>#include &lt;linux/kernel.h&gt;<br>#include &lt;linux/module.h&gt;<br><br>int __init init_my_module(void)<br>{<br>        int arr[8000];<br>        printk(&quot;%s:%d\tmodule initilized\n&quot;, __func__, __LINE__);<br>
        arr[1] = 1;<br>        arr[4000] = 1;<br>        arr[7999] = 1;<br>        printk(&quot;%s:%d\tarr[1]:%d, arr[4000]:%d, arr[7999]:%d\n&quot;, __func__,<br>__LINE__, arr[1], arr[4000], arr[7999]);<br>        return 0;<br>
}<br><br>void __exit cleanup_my_module(void)<br>{<br>        printk(&quot;exiting\n&quot;);<br>        return;<br>}<br><br>module_init(init_my_module);<br>module_exit(cleanup_my_module);<br><br>MODULE_LICENSE(&quot;GPL&quot;);<br>
<br>_______________________________________________<br>Kernelnewbies mailing list<br><a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br><a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</blockquote></div><br>