All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: get_user_pages vs mmap MAP_FIXED bug
Date: Tue, 08 May 2007 17:41:54 +1000	[thread overview]
Message-ID: <464029C2.1020003@yahoo.com.au> (raw)
In-Reply-To: <20070506202225.ba6476b6.akpm@linux-foundation.org>

[-- Attachment #1: Type: text/plain, Size: 841 bytes --]

Andrew Morton wrote:
> On Mon, 07 May 2007 11:26:44 +1000 Rusty Russell <rusty@rustcorp.com.au> wrote:
> 
> 
>>On Sun, 2007-05-06 at 17:01 +1000, Rusty Russell wrote:
>>
>>>This bug is in 2.6.21-rc7-mm2, but not 2.6.21.  Haven't tested
>>>2.6.21-mm1 yet.
>>
>>OK, 2.6.21-mm1 fails too.  2.6.21-git6 ... is fine.
>>
>>Here's a standalone test using ptrace.  No kernel module req'd.
>>
>>	rusty@debussy:~/linux-2.6.21-mm1$ ../examiner 
>>	ptrace says 0, child says 0x464c457f
> 
> 
> thanks.
> 
> 
>>Any clues Andrew?  Or should I take your patches and do a binary search?
> 
> 
> I've been assuming that Nick's vm_operations.fault changes have broken
> get_user_pages()'s manual faulting.  The next step is to wait for Nick to
> turn up.

Fancy that! Thanks for catching it Rusty, does the following work for
you?

-- 
SUSE Labs, Novell Inc.

[-- Attachment #2: mm-fix-for-fault.patch --]
[-- Type: text/plain, Size: 1485 bytes --]

Fix a couple of places that should be testing fault as well as nopage.

Signed-off-by: Nick Piggin <npiggin@suse.de>

Index: linux-2.6/mm/memory.c
===================================================================
--- linux-2.6.orig/mm/memory.c	2007-04-24 15:02:51.000000000 +1000
+++ linux-2.6/mm/memory.c	2007-05-08 15:23:55.000000000 +1000
@@ -1049,7 +1049,8 @@
 		if (pages)
 			foll_flags |= FOLL_GET;
 		if (!write && !(vma->vm_flags & VM_LOCKED) &&
-		    (!vma->vm_ops || !vma->vm_ops->nopage))
+		    (!vma->vm_ops || (!vma->vm_ops->nopage &&
+					!vma->vm_ops->fault)))
 			foll_flags |= FOLL_ANON;
 
 		do {
Index: linux-2.6/mm/rmap.c
===================================================================
--- linux-2.6.orig/mm/rmap.c	2007-04-24 08:53:50.000000000 +1000
+++ linux-2.6/mm/rmap.c	2007-05-08 15:24:27.000000000 +1000
@@ -640,8 +640,10 @@
 			printk (KERN_EMERG "  page->count = %x\n", page_count(page));
 			printk (KERN_EMERG "  page->mapping = %p\n", page->mapping);
 			print_symbol (KERN_EMERG "  vma->vm_ops = %s\n", (unsigned long)vma->vm_ops);
-			if (vma->vm_ops)
+			if (vma->vm_ops) {
 				print_symbol (KERN_EMERG "  vma->vm_ops->nopage = %s\n", (unsigned long)vma->vm_ops->nopage);
+				print_symbol (KERN_EMERG "  vma->vm_ops->fault = %s\n", (unsigned long)vma->vm_ops->fault);
+			}
 			if (vma->vm_file && vma->vm_file->f_op)
 				print_symbol (KERN_EMERG "  vma->vm_file->f_op->mmap = %s\n", (unsigned long)vma->vm_file->f_op->mmap);
 			BUG();

  reply	other threads:[~2007-05-08  7:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-06  7:01 get_user_pages vs mmap MAP_FIXED bug Rusty Russell
2007-05-07  1:26 ` Rusty Russell
2007-05-07  3:22   ` Andrew Morton
2007-05-08  7:41     ` Nick Piggin [this message]
2007-05-08 23:34       ` Rusty Russell
2007-05-09  0:08         ` 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=464029C2.1020003@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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.