public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Stack overflow
@ 2003-01-24  7:08 Madhavi
  2003-01-24  7:53 ` Linux Geek
  0 siblings, 1 reply; 13+ messages in thread
From: Madhavi @ 2003-01-24  7:08 UTC (permalink / raw)
  To: linux-kernel


Hi

I am testing a PCI network device driver on linux-2.4.19.

I have observed a peculiar problem during testing.

I have a functionality which works well if the code whcih performs this
function is embedded in the required function. If this functionality is
implemented as a separate function, and this function is called at the
required place, the system crashes. I have used KDB for debugging. But,
KDB also fails when this system crash occurs.

Could this be because of any function stack overflow? I am new to this
field. Could someone through some light on this.

Thanks in advacne.

regards
Madhavi.


^ permalink raw reply	[flat|nested] 13+ messages in thread
* stack overflow
@ 2003-09-12 17:53 Breno
  2003-09-12 22:50 ` Andreas Dilger
  0 siblings, 1 reply; 13+ messages in thread
From: Breno @ 2003-09-12 17:53 UTC (permalink / raw)
  To: Kernel List

Hi ... this is my idea to check a stack overflow. What do you think ?


#define STACK_LIMIT (1024*8192)/PAGE_SIZE

int check_stack_overflow(struct task_struct *tsk)
{

    unsigned long stack_size,stack_addr,stack_ptr;
    int i;

         if(tsk->mm != NULL)
         {
                  stack_addr = tsk->mm->start_stack;

                  stack_ptr = tsk->thread.esp;

                  for(i=0; i < stack_ptr; i++)
                  stack_addr++;

                  stack_size = (stack_addr - stack_ptr)/PAGE_SIZE;

                  if(stack_size > ( STACK_LIMIT - 1))
                  {
                               printk(KERN_CRIT"Process %s : pid %d -
                                Can cause stack
overflow\n",tsk->comm,tsk->pid);
                               return 0;
                  }
         }
return 0;
}

att,
Breno



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2003-09-12 23:26 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-24  7:08 Stack overflow Madhavi
2003-01-24  7:53 ` Linux Geek
2003-01-24 15:32   ` GrandMasterLee
2003-01-24 15:41     ` Madhavi
2003-01-24 16:42       ` Richard B. Johnson
2003-01-24 16:52       ` Gianni Tedesco
  -- strict thread matches above, loose matches on Subject: below --
2003-09-12 17:53 stack overflow Breno
2003-09-12 22:50 ` Andreas Dilger
2003-09-12 19:14   ` Breno
2003-09-12 23:06   ` William Lee Irwin III
2003-09-12 19:23     ` Breno
2003-09-12 23:18     ` Alan Cox
2003-09-12 23:25       ` William Lee Irwin III

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox