memcpy_fromfs causes insidious problems

Fabien Klein (fabklein@hotmail.com)
Fri, 26 Mar 1999 03:23:58 PST


HI

After doing several ioctls to an experimental code, my system becomes
very unstable (emacs gcc more ... reply Fatal error)

Actually here is what I do

USER side

Buffer is an 80 int array

void test_proc(int fd,int * Buffer)
{
ioctl(fd,NASTY_IOCTL,Buffer)
}

Buffer is at 0x0804d880
sizeof Buffer is 320

the IOCTL def

#define NASTY_IOCTL _IOWR(_MY_IOC_MAGIC,1, int BUFER_SIZE)

KERNEL side

ioctl_proc(....)
..
case NASTY_IOCTL:
Image_Buffer=(int*)kmalloc(80*sizeof(int),GFP_KERNEL)
error_code=verify_area(VERIFY_READ,(void*)arg,80*sizeof(int))
if (error_code)
return -EPERM
memcpy_from_fs(Image_Buffer,void* arg,80*sizeof(int))
kfree(Image_Buffer)
break;
...

In general the problems occurs after 20 or more IOCTL calls
There are no oops, no visible problems but in fact it s impossible to
lauch emacs or gcc..and rapidly things go weird

so I reboot the machine again and again ...and sometimes I see explicit
crashes
This message is also repeated very often

free_one_pmd: bad directory entry 0xxxxxx with several adresses and
among theses adresses I see 0x0804d880 wich is the beginning of the
buffer

If I remove the memcpy_fromfs all is OK...

So please help..

Perhaps the user programs release the buffer to quickly (before the
memcpy_fromfs has finished it's copy ?? ...)

Fabien

free_one_pmd: bad directory entry ,
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/