kernel stack memory

Kshemendra KP kshemendra at
Thu Sep 13 02:59:41 EDT 2012

In user space when you write beyond your address space (if your write
the page boundary alloacted to you), then process is terminated. In the
you are still writinng inside the kernel address space. Your write is not
kernel address space.

Secondly you are corrupting some other data structure. The kernel stack is
of task_struct of the running process, a kmalloc or slab allocator might
provided this memory (task_-struct).  When you write beyond this if the
write modiefies some crucial data structure that may result in hang or a

On Thu, Sep 13, 2012 at 12:15 PM, shubham sharma <shubham20006 at>wrote:

> Hi,
> As far as i know, the size of stack allocated in the kernel space is
> 8Kb for each process. But in case i use more than 8Kb of memory from
> the stack then what will happen? I think that in that case the system
> would crash because i am accessing an illegal memory area. I wrote
> kernel module in which i defined an integer array whose size was 8000.
> But still it did not crash my system. Why?
> The module i wrote was as follows:
> #include <linux/kernel.h>
> #include <linux/module.h>
> int __init init_my_module(void)
> {
>         int arr[8000];
>         printk("%s:%d\tmodule initilized\n", __func__, __LINE__);
>         arr[1] = 1;
>         arr[4000] = 1;
>         arr[7999] = 1;
>         printk("%s:%d\tarr[1]:%d, arr[4000]:%d, arr[7999]:%d\n", __func__,
> __LINE__, arr[1], arr[4000], arr[7999]);
>         return 0;
> }
> void __exit cleanup_my_module(void)
> {
>         printk("exiting\n");
>         return;
> }
> module_init(init_my_module);
> module_exit(cleanup_my_module);
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Kernelnewbies mailing list