From: Andrea Arcangeli <andrea@qumranet.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: kvm-devel@lists.sourceforge.net,
Ben-Ami Yassour <benami@il.ibm.com>,
Avi Kivity <avi@qumranet.com>
Subject: Re: [PATCH] Handle vma regions with no backing page
Date: Tue, 29 Apr 2008 16:54:29 +0200 [thread overview]
Message-ID: <20080429145429.GD8315@duo.random> (raw)
In-Reply-To: <1209479529-24622-1-git-send-email-aliguori@us.ibm.com>
On Tue, Apr 29, 2008 at 09:32:09AM -0500, Anthony Liguori wrote:
> + vma = find_vma(current->mm, addr);
> + if (vma == NULL) {
> + get_page(bad_page);
> + return page_to_pfn(bad_page);
> + }
Here you must check vm_start address, find_vma only checks addr <
vm_end but there's no guarantee addr >= vm_start yet.
> +
> + BUG_ON(!(vma->vm_flags & VM_IO));
For consistency we should return bad_page and not bug on, VM_IO and
VM_PFNMAP can theoretically not be set at the same time, otherwise
get_user_pages would be buggy checking against VM_PFNMAP|VM_IO. I
doubt anybody isn't setting VM_IO before calling remap_pfn_range but
anyway...
Secondly the really correct check is against VM_PFNMAP. This is
because PFNMAP is set at the same time of vm_pgoff = pfn. VM_IO is not
even if in theory if a driver uses ->fault instead of remap_pfn_range,
shouldn't set VM_IO and it should only set VM_RESERVED. VM_IO is about
keeping gdb/coredump out as they could mess with the hardware if they
read, PFNMAP is about remap_pfn_range having been called and pgoff
pointing to the first pfn mapped at vm_start address.
Patch is in the right direction, way to go!
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
next prev parent reply other threads:[~2008-04-29 14:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-29 14:32 [PATCH] Handle vma regions with no backing page Anthony Liguori
2008-04-29 14:54 ` Andrea Arcangeli [this message]
2008-04-29 15:14 ` Anthony Liguori
-- strict thread matches above, loose matches on Subject: below --
2008-06-03 11:17 Ben-Ami Yassour
2008-06-03 11:39 ` Andrea Arcangeli
2008-06-04 15:09 ` Ben-Ami Yassour
2008-06-04 16:17 ` Muli Ben-Yehuda
2008-06-04 19:34 ` Andrea Arcangeli
2008-06-04 19:41 ` Anthony Liguori
2008-06-04 19:51 ` Andrea Arcangeli
2008-06-04 19:59 ` Dave Hansen
2008-06-04 9:48 ` Avi Kivity
2008-06-04 16:48 ` Anthony Liguori
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=20080429145429.GD8315@duo.random \
--to=andrea@qumranet.com \
--cc=aliguori@us.ibm.com \
--cc=avi@qumranet.com \
--cc=benami@il.ibm.com \
--cc=kvm-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.