WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] mmap in PV xen-4.0.1

On Wed, Aug 10, 2011 at 11:31:29AM -0700, Eric Camachat wrote:
> >>
> >>        switch(cmd) {
> >>        case MEMTEST_DMA_SIZE:
> >>                size = (uint32_t*)arg;
> >>                *size = _size;
> >
> > Though your output shows that this assignment works, shouldn't this
> > kind of direct assignment across kernel space and user land be
> > avoided? It is bad practice to do direct assignment I think.
> >
> > copy_{from,to}_user should do the job.
> >
> 
> I want share some memory between kernel and user applications, so I am
> trying to use mmap instead of copy_{from,to} multiple times.
> 

I understand. 

But I still insist you use copy_{from,to}_user when doing syscalls,
just to validate the pointer for syscalls. AFAICT, a syscall is not
about sharing things, it is about providing service routines to user
space. If user space application issues syscall with wrong pointer,
your system is likely to get compromised. (well, I major in
Information Security so may be to sensitive on this...)

When you're running your own application, you can choose whatever
method you like to share data between kernel and user land.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>