lkml.org 
[lkml]   [2002]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Subjectlarge copy_to_user fills only one page?
From
Date
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/

\
 
 \ /
  Last update: 2005-03-22 13:26    [W:0.072 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site