large copy_to_user fills only one page?

Emmanuel Michon (emmanuel_michon@realmagic.fr)
30 May 2002 16:36:22 +0200


Hi,

I'm working with linux-2.4.18, and writing some
trivial code to get from kernel a grabbed image working this way:

#define IMSIZE 350000

user mode runs:
u_p=malloc(IMSIZE);
ioctl(grabberfd,DOGRAB,u_p);
write *u_p to disk
free(u_p);

kernelmode runs:
case DOGRAB:
char *u_p,*k_p;
copy_from_user(u_p,arg,sizeof(char *));
k_p=vmalloc(IMSIZE);
kernelgrabs(k_p);
copy_to_user(u_p,k_p,IMSIZE);
vfree(k_p);
break;

What I get actually is only 4K filled in userland, but copy_to_user
returns IMSIZE!

If I memset the memory area *u_p to any value, the grab happens
properly.

I guess memset'ing faults the good pages in, I'm quite surprised
this does not happen smoothly by itself ;-(

Any clue?

Sincerely yours,

-- 
Emmanuel Michon
Chef de projet
REALmagic France SAS
Mobile: 0614372733 GPGkeyID: D2997E42  
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/