From: Jeff Dike <jdike@addtoit.com>
To: Bryan Parno <parno@cmu.edu>
Cc: user-mode-linux-devel@lists.sourceforge.net
Subject: Re: [uml-devel] Kernel access to user memory in SKAS
Date: Fri, 23 Feb 2007 16:40:58 -0500 [thread overview]
Message-ID: <20070223214058.GB7051@ccure.user-mode-linux.org> (raw)
In-Reply-To: <16D2BFFB-B00F-4C9D-82E4-9194D37FA95D@cmu.edu>
On Fri, Feb 23, 2007 at 01:36:12PM -0500, Bryan Parno wrote:
> I'm interested in mediating accesses by the UML guest kernel to
> memory used by the UML guest processes. At present, I'm looking at a
> scenario using SKAS3, so the kernel has an address space distinct
> from that of the user processes. I guess I'm a bit confused as to
> how the guest kernel actually manages to touch guest process memory
> (e.g., for copying system call arguments). Looking through /arch/um/
> kernel/skas/uaccess.c, it appears that all of these accesses devolve
> to performing a strncpy or memcpy, but I don't see a translation from
> an address in the user's address space to one in the kernel's address
> space. Does this happen somewhere else, or am I misunderstanding
> SKAS?
So far, you're fine. What you're missing is, i.e.:
int copy_from_user_skas(void *to, const void __user *from, int n)
{
if(segment_eq(get_fs(), KERNEL_DS)){
memcpy(to, (__force void*)from, n);
return(0);
}
return(access_ok(VERIFY_READ, from, n) ?
buffer_op((unsigned long) from, n, 0, copy_chunk_from_user, &to):
n);
}
The buffer_op case handles userspace memory. It does the following:
figures out where in kernel physical memory the userspace data is
breaks the operation across pages if necessary
wraps enough state around the operation to be able to handle
page faults and finish it after the page has been faulted in
Jeff
--
Work email - jdike at linux dot intel dot com
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
next prev parent reply other threads:[~2007-02-23 21:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-23 18:36 [uml-devel] Kernel access to user memory in SKAS Bryan Parno
2007-02-23 21:40 ` Jeff Dike [this message]
2007-02-28 21:13 ` Bryan Parno
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=20070223214058.GB7051@ccure.user-mode-linux.org \
--to=jdike@addtoit.com \
--cc=parno@cmu.edu \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/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