RE: kernel stack overflow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I believe the stack size is 2 pages (8k on x86).

As I understand it the task structure is located at the bottom of the stack.
So if you already had just over 1k on your stack and you put another 7k on
there then your going to be overwritting your task structure.

If you put 8k on then perhaps your overwritting some other vital kernel
structure that is cause a different (but equally nasty) behaviour.

Either way you should consider allocating dynamically ( using vmalloc(),
kmalloc(), etc.) rather then statically.

HTH
dom 



-----Original Message-----
From: kernelnewbies-bounce@nl.linux.org
[mailto:kernelnewbies-bounce@nl.linux.org] On Behalf Of pankaj chauhan
Sent: Sunday, December 21, 2003 6:59 AM
To: kernelnewbies@nl.linux.org
Subject: kernel stack overflow


hi all , 

i was just trying to overflow the kernel stack of a
process , so i tried to initialize a large arraay in
init function of a module , and i got two different
behaviours for two different sizes :

1.  char array[ 8 * 1024 ] = {0} - machine freezes ,
when i insmod the module . ultimately i have to press
reset .

2.  char array[ 7 * 1024 ] = {0} - machine reboots , 
everytime i insmod the module . 

i am not understanding the reason difference in the
behaviours . plz explain the cause of two different
behaviours .

thanx

rgds ,
pankaj chauhan 

________________________________________________________________________
Yahoo! India Mobile: Download the latest polyphonic ringtones. Go to
http://in.mobile.yahoo.com
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux