From: Nick Piggin <npiggin@suse.de>
To: Johannes Weiner <hannes@saeurebad.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
shaggy@austin.ibm.com, jens.axboe@oracle.com,
torvalds@linux-foundation.org, linux-mm@kvack.org,
linux-arch@vger.kernel.org, apw@shadowen.org
Subject: Re: [patch 2/2] lockless get_user_pages
Date: Mon, 26 May 2008 03:40:49 +0200 [thread overview]
Message-ID: <20080526014049.GC30840@wotan.suse.de> (raw)
In-Reply-To: <87fxs6xpyp.fsf@saeurebad.de>
On Sun, May 25, 2008 at 07:18:06PM +0200, Johannes Weiner wrote:
> Hi Nick,
>
> Nick Piggin <npiggin@suse.de> writes:
>
> > +static noinline int gup_pte_range(pmd_t pmd, unsigned long addr,
> > + unsigned long end, int write, struct page **pages, int *nr)
> > +{
> > + unsigned long mask;
> > + pte_t *ptep;
> > +
> > + mask = _PAGE_PRESENT|_PAGE_USER;
> > + if (write)
> > + mask |= _PAGE_RW;
> > +
> > + ptep = pte_offset_map(&pmd, addr);
> > + do {
> > + pte_t pte = gup_get_pte(ptep);
> > + struct page *page;
> > +
> > + if ((pte_val(pte) & (mask | _PAGE_SPECIAL)) != mask)
> > + return 0;
>
> Don't you leak the possbile high mapping here?
Hi Johannes,
Right you are. Good spotting.
--
Index: linux-2.6/arch/x86/mm/gup.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/gup.c
+++ linux-2.6/arch/x86/mm/gup.c
@@ -80,8 +80,10 @@ static noinline int gup_pte_range(pmd_t
pte_t pte = gup_get_pte(ptep);
struct page *page;
- if ((pte_val(pte) & (mask | _PAGE_SPECIAL)) != mask)
+ if ((pte_val(pte) & (mask | _PAGE_SPECIAL)) != mask) {
+ pte_unmap(ptep);
return 0;
+ }
VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
page = pte_page(pte);
get_page(page);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2008-05-26 1:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-25 14:48 [patch 1/2] x86: implement pte_special Nick Piggin
2008-05-25 14:52 ` [patch 2/2] lockless get_user_pages Nick Piggin
2008-05-25 17:18 ` Johannes Weiner
2008-05-26 1:40 ` Nick Piggin [this message]
2008-05-26 15:02 ` Johannes Weiner
2008-05-27 0:57 ` KOSAKI Motohiro
2008-05-27 2:28 ` Nick Piggin
2008-05-27 2:46 ` KOSAKI Motohiro
2008-05-27 2:57 ` Nick Piggin
2008-05-29 3:43 ` Nick Piggin
2008-05-28 11:39 ` Andy Whitcroft
2008-05-28 12:28 ` Nick Piggin
2008-05-28 14:32 ` Nick Piggin
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=20080526014049.GC30840@wotan.suse.de \
--to=npiggin@suse.de \
--cc=akpm@linux-foundation.org \
--cc=apw@shadowen.org \
--cc=hannes@saeurebad.de \
--cc=jens.axboe@oracle.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shaggy@austin.ibm.com \
--cc=torvalds@linux-foundation.org \
/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).