Re: stack overflow

From: Breno
Date: Fri Sep 12 2003 - 18:17:56 EST


I think that size limit of user stack is 8mb

Breno
----- Original Message -----
From: "Andreas Dilger" <adilger@xxxxxxxxxxxxx>
To: "Breno" <brenosp@xxxxxxxxxxxxxxxx>
Cc: "Kernel List" <linux-kernel@xxxxxxxxxxxxxxx>
Sent: Friday, September 12, 2003 11:50 PM
Subject: Re: stack overflow


> On Sep 12, 2003 18:53 +0100, Breno wrote:
> > 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))
>
> Well, with the exception of the fact that STACK_LIMIT is 8MB, and kernel
> stacks are only 8kB (on i386)...
>
> Also, see "do_IRQ()" (i386) for CONFIG_DEBUG_STACKOVERFLOW to see this
already.
>
> Cheers, Andreas
> --
> Andreas Dilger
> http://sourceforge.net/projects/ext2resize/
> http://www-mddsp.enel.ucalgary.ca/People/adilger/
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/