Re: tracing a kernel stack corruption

Fabien Klein (fabklein@hotmail.com)
Wed, 24 Mar 1999 07:29:43 PST


Hi

>
>> Does anyone knows how to trace a kernel stack corruption error??
>
>yes, you can use the IKD ('Integrated Kernel Debugging') patch, but
maybe
>the solution is simpler than that:

I use the gdbstub to debug kernel code, but can mail me the IKD patch
or tell me where I can find it

>
>One important kernel programming rule, at most ~7K should be used as
stack
>variables. (~4k on 2.0, thus a good guideline is to never allocate more
>than 3k). Most probably the problem is that you allocate some big
>structure on the kernel stack:
>
>myioctl ()
>{
> char buff [10000];
>
> ....
>}

and if I do this

struct _MY_DUMMY_STRUCT{
int blabla;
char huge_buff[1000000];
...}

ThisDummyStruct = (struct _MY_DUMMY_STRUCT*)v(k)malloc(sizeof(struct
_MY_DUMMY_STRUCT),)
????
is there a crash risk?

I also do something like this

on the user side

ioctl(fd,MY_IOCTL,ThisCode) where Thiscode is a pointer to a 400k buffer

and here the kernel code

case MY_IOCTL:

memcpy_fromfs((void *)ThisDummyStruct->huge_buff,(void *)arg,(SIZEOF
400K_Buffer));

is it dangerous ? deadly?

Thanks

Fabien

Get Your Private, Free Email at http://www.hotmail.com

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