[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.