From: Hugh Dickins <hugh@veritas.com>
To: "Michael S. Tsirkin" <mst@mellanox.co.il>
Cc: Roland Dreier <roland@topspin.com>,
openib-general@openib.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH repost] PROT_DONTCOPY: ifiniband uverbs fork support
Date: Tue, 26 Jul 2005 13:30:32 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.61.0507261312460.16985@goblin.wat.veritas.com> (raw)
In-Reply-To: <20050725171928.GC12206@mellanox.co.il>
On Mon, 25 Jul 2005, Michael S. Tsirkin wrote:
>
> This patch adds PROT_DONTCOPY to mmap and mprotect, to set VM_DONTCOPY on vma.
> This is needed for infiniband userspace i/o, where we need to protect against
> - the child process accessing the parent hardware page
> - the parent registered address (on which the driver did get_user_pages)
> getting remapped to another page by COW
> One can imagine other uses, e.g. combined with mlock for real-time or security.
I don't much like it, but it does solve a real problem in an efficient way.
Partly I don't like it because of "PROT_DONTCOPY" itself: I'm queasy
about protection flags which are not protection flags, though I find
you're not the first to go down that road.
Is the patch tested? I've not tried, but suspect the newflags shift
and mask won't work for it. And I don't look forward to your adding
VM_MAYDONTCOPY - ugh!
> @@ -246,7 +246,7 @@ sys_mprotect(unsigned long start, size_t
> goto out;
> }
>
> - newflags = vm_flags | (vma->vm_flags & ~(VM_READ | VM_WRITE | VM_EXEC));
> + newflags = vm_flags | (vma->vm_flags & ~(VM_READ | VM_WRITE | VM_EXEC | VM_DONTCOPY));
>
> if ((newflags & ~(newflags >> 4)) & 0xf) {
> error = -EACCES;
I rather think it would all be more cleanly handled by dropping the mmap
and mprotect changes, adding an madvise instead. Though you may object
that madvise is for optional behaviours, and this should be mandatory.
The other reason I dislike the patch is that the problem it fixes is
an old one, and I'd much rather have get_user_pages fix it for itself,
than ask the developer to do some additional magic to get around it.
But I've failed to work out a simple efficient alternative, which won't
burden the vast majority of get_user_pages usages which never hit the
issue. So your way is probably appropriate, but I'd prefer madvise.
(Sorry, I won't be able to discuss further for a couple of days.)
Hugh
next prev parent reply other threads:[~2005-07-26 12:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-19 16:55 [PATCH] " Michael S. Tsirkin
2005-07-25 17:19 ` [PATCH repost] PROT_DONTCOPY: ifiniband uverbs " Michael S. Tsirkin
2005-07-26 12:30 ` Hugh Dickins [this message]
2005-07-26 13:35 ` Michael S. Tsirkin
2005-08-09 18:13 ` Hugh Dickins
2005-08-10 8:30 ` Michael S. Tsirkin
2005-08-10 8:39 ` [openib-general] " Gleb Natapov
2005-08-10 13:22 ` Hugh Dickins
2005-08-10 13:26 ` Gleb Natapov
2005-08-10 15:27 ` Hugh Dickins
2005-08-11 8:02 ` Gleb Natapov
2005-08-11 14:04 ` Hugh Dickins
2005-08-11 14:07 ` Gleb Natapov
2005-08-11 14:17 ` Hugh Dickins
2005-08-11 14:11 ` Michael S. Tsirkin
2005-08-15 16:37 ` Bill Jordan
2005-08-16 7:52 ` Gleb Natapov
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=Pine.LNX.4.61.0507261312460.16985@goblin.wat.veritas.com \
--to=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@mellanox.co.il \
--cc=openib-general@openib.org \
--cc=roland@topspin.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
all inboxes | Powered by JetHome®