From: Wei Liu <liuw@liuw.name>
To: Eric Camachat <eric.camachat@gmail.com>
Cc: xen-devel@lists.xensource.com
Subject: Re: mmap in PV xen-4.0.1
Date: Thu, 11 Aug 2011 09:21:09 +0800 [thread overview]
Message-ID: <20110811012109.GA1889@limbo> (raw)
In-Reply-To: <CACeEFf6HoD10k5PUP7gNBNteyY=Wh3XTJCOZEmvs+Us+WfahNw@mail.gmail.com>
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.
next prev parent reply other threads:[~2011-08-11 1:21 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CACeEFf77eOLLNgsJwEYdzeiuxm+qDcO2zs09FK-Waas0sxcwLQ@mail.gmail.com>
2011-08-10 6:29 ` mmap in PV xen-4.0.1 Eric Camachat
2011-08-10 9:12 ` Wei Liu
2011-08-10 17:14 ` Ranjith Ravi
2011-08-10 17:50 ` Konrad Rzeszutek Wilk
2011-08-10 18:31 ` Eric Camachat
2011-08-10 19:25 ` Konrad Rzeszutek Wilk
2011-08-10 19:42 ` Ian Campbell
2011-08-10 19:45 ` Eric Camachat
2011-08-10 20:59 ` BUG: soft lockup - CPU#0 stuck for 61s! [swapper:0] Mark Schneider
2011-08-13 15:15 ` Konrad Rzeszutek Wilk
2011-08-10 19:45 ` mmap in PV xen-4.0.1 Eric Camachat
2011-08-11 1:31 ` Wei Liu
2011-08-11 3:10 ` Eric Camachat
2011-08-11 17:11 ` Eric Camachat
2011-08-12 4:26 ` Wei Liu
2011-08-12 17:20 ` Eric Camachat
2011-08-16 3:13 ` Ranjith Ravi
2011-08-16 5:06 ` Konrad Rzeszutek Wilk
2011-08-16 18:27 ` Ranjith Ravi
2011-08-17 2:20 ` Konrad Rzeszutek Wilk
2011-08-11 0:33 ` Eric Camachat
2011-08-11 1:21 ` Wei Liu [this message]
2011-08-11 1:29 ` Eric Camachat
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110811012109.GA1889@limbo \
--to=liuw@liuw.name \
--cc=eric.camachat@gmail.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).