[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] how to deal with copy_to_user returning non zero
I'm testing out a hypercall that takes in large data (many MB) from the user space and simply copy the data back.Â
For copying in, I call xmalloc_array() for about 4MB at a time and call copy_from_user() successfully for the entire input. The problem is with copy_to_user() which returns non-zero values. I tried to vary the size of the data being copy, but still unable to copy the whole data back. What are the cause of copy_to_user() failure? I checked the source I got quite lost at the code. How could I make sure all data is copy back? Surely it is not a memory limitation problem, because I copy_from_user() succeeds for over 100MB. ****** long do_test_copy(long n, unsigned char *in, unsigned char *out){     unsigned char **tmp;     long ret;     int m = n/(MAX_ALLOC);     tmp = xmalloc_array(unsigned char*,m);     for (int i=0; i<m; i++){         tmp[i] = xmalloc_array(unsigned char, MAX_ALLOC);         copy_from_user(tmp[i],in+i*MAX_ALLOC,MAX_ALLOC);     }    Â     for (int i=0; i<m; i++){         if (tmp[i]){             ret = copy_to_user(out+i*MAX_ALLOC,tmp[i],MAX_ALLOC);        Â             xfree(tmp[i]);         }     }     xfree(tmp);     return 0;   Â } **** _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |