From: Andrew Morton <akpm@osdl.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: vrajesh@umich.edu, linux-kernel@vger.kernel.org, Linux-MM@kvack.org
Subject: Re: [PATCH] mremap NULL pointer dereference fix
Date: Mon, 16 Feb 2004 22:00:31 -0800 [thread overview]
Message-ID: <20040216220031.16a2c0c7.akpm@osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.58.0402162144510.30742@home.osdl.org>
Linus Torvalds <torvalds@osdl.org> wrote:
>
> Hmm.. Looking a bit more at it, does this alternate patch work? It's
> _slightly_ less ugly, and it also removes the nonsensical TLB invalidate
> instead of moving it around together with the comment that says that it
> shouldn't exist.
>
> The TLB is (properly) invalidated by "copy_one_pte()" if the mapping
> actually changes.
>
> Did I miss anything?
This saves a goto. It works, but I wasn't able to trigger
the oops without it either.
diff -puN mm/mremap.c~mremap-oops-fix mm/mremap.c
--- 25/mm/mremap.c~mremap-oops-fix 2004-02-16 20:53:25.000000000 -0800
+++ 25-akpm/mm/mremap.c 2004-02-16 21:00:05.000000000 -0800
@@ -135,15 +135,17 @@ move_one_page(struct vm_area_struct *vma
dst = alloc_one_pte_map(mm, new_addr);
if (src == NULL)
src = get_one_pte_map_nested(mm, old_addr);
- error = copy_one_pte(vma, old_addr, src, dst, &pte_chain);
- pte_unmap_nested(src);
- pte_unmap(dst);
- } else
/*
- * Why do we need this flush ? If there is no pte for
- * old_addr, then there must not be a pte for it as well.
+ * Since alloc_one_pte_map can drop and re-acquire
+ * page_table_lock, we should re-check the src entry...
*/
- flush_tlb_page(vma, old_addr);
+ if (src) {
+ error = copy_one_pte(vma, old_addr, src,
+ dst, &pte_chain);
+ pte_unmap_nested(src);
+ }
+ pte_unmap(dst);
+ }
spin_unlock(&mm->page_table_lock);
pte_chain_free(pte_chain);
out:
_
--
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:"aart@kvack.org"> aart@kvack.org </a>
next prev parent reply other threads:[~2004-02-17 6:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-17 4:41 Rajesh Venkatasubramanian
2004-02-17 5:31 ` Andrew Morton
2004-02-17 5:38 ` Linus Torvalds
2004-02-17 5:49 ` Linus Torvalds
2004-02-17 6:00 ` Andrew Morton [this message]
2004-02-17 6:06 ` Linus Torvalds
2004-02-17 13:23 ` Rajesh Venkatasubramanian
2004-02-17 21:33 ` Rajesh Venkatasubramanian
2004-02-19 14:29 ` [PATCH] orphaned ptes -- mremap vs. truncate race Rajesh Venkatasubramanian
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=20040216220031.16a2c0c7.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=Linux-MM@kvack.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
--cc=vrajesh@umich.edu \
/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