linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, gregkh@suse.de,
	Hugh Dickins <hugh@veritas.com>
Subject: Re: [bugfix] try_to_unmap_cluster() passes out-of-bounds pte to pte_unmap()
Date: Mon, 23 May 2005 19:48:49 -0700	[thread overview]
Message-ID: <20050524024849.GH2057@holomorphy.com> (raw)
In-Reply-To: <20050523171406.483cdf69.akpm@osdl.org>

William Lee Irwin III <wli@holomorphy.com> wrote:
>> --- ./mm/rmap.c.orig	2005-05-20 01:29:14.066467151 -0700
>> +++ ./mm/rmap.c	2005-05-20 01:30:06.620649901 -0700
[...]

On Mon, May 23, 2005 at 05:14:06PM -0700, Andrew Morton wrote:
> I must say that I continue to find this approach a bit queazifying.
> After some reading of the code I'd agree that yes, it's not possible for us
> to get here with `pte' pointing at the first slot of the pte page, but it's
> not 100% obvious and it's possible that someone will come along later and
> will change things in try_to_unmap_cluster() which cause this unmap to
> suddenly do the wrong thing in rare circumstances.
> IOW: I'd sleep better at night if we took a temporary and actually unmapped
> the thing which we we got back from pte_offset_map()..  Am I being silly?

Not at all. I merely attempt to minimize diffsize by default. An
alternative implementation follows (changelog etc. to be taken
from the prior patch) in case it saves the time (however short) needed
to write it yourself.


-- wli

Index: mm2-2.6.12-rc4/mm/rmap.c
===================================================================
--- mm2-2.6.12-rc4.orig/mm/rmap.c	2005-05-20 01:44:18.000000000 -0700
+++ mm2-2.6.12-rc4/mm/rmap.c	2005-05-23 19:13:29.000000000 -0700
@@ -626,7 +626,7 @@
 	pgd_t *pgd;
 	pud_t *pud;
 	pmd_t *pmd;
-	pte_t *pte;
+	pte_t *pte, *original_pte;
 	pte_t pteval;
 	struct page *page;
 	unsigned long address;
@@ -658,7 +658,7 @@
 	if (!pmd_present(*pmd))
 		goto out_unlock;
 
-	for (pte = pte_offset_map(pmd, address);
+	for (original_pte = pte = pte_offset_map(pmd, address);
 			address < end; pte++, address += PAGE_SIZE) {
 
 		if (!pte_present(*pte))
@@ -694,7 +694,7 @@
 		(*mapcount)--;
 	}
 
-	pte_unmap(pte);
+	pte_unmap(original_pte);
 out_unlock:
 	spin_unlock(&mm->page_table_lock);
 }

  reply	other threads:[~2005-05-24  2:49 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-16  9:13 2.6.12-rc4-mm2 Andrew Morton
2005-05-16  9:25 ` 2.6.12-rc4-mm2 Russell King
2005-05-16 10:50 ` 2.6.12-rc4-mm2 Danny ter Haar
2005-05-16 11:17   ` 2.6.12-rc4-mm2 Alexey Dobriyan
2005-05-16 11:38     ` 2.6.12-rc4-mm2 Danny ter Haar
2005-05-16 12:15       ` 2.6.12-rc4-mm2 Alexey Dobriyan
2005-05-16 17:11         ` 2.6.12-rc4-mm2 Danny ter Haar
2005-05-16 17:43           ` 2.6.12-rc4-mm2 Alexey Dobriyan
2005-05-16 19:30             ` 2.6.12-rc4-mm2 Danny ter Haar
2005-05-16 12:30 ` 2.6.12-rc4-mm2 Brice Goglin
2005-05-16 17:46 ` 2.6.12-rc4-mm2, alpha and mips broke Jan Dittmer
2005-05-16 20:09   ` Andrew Morton
2005-05-16 19:18 ` 2.6.12-rc4-mm2: proc-pid-smaps.patch broke nommu Adrian Bunk
2005-05-21  2:19   ` Mauricio Lin
2005-05-21  2:39     ` Mauricio Lin
2005-07-21 15:04     ` Adrian Bunk
2005-05-17  9:06 ` 2.6.12-rc4-mm2 Brice Goglin
2005-05-17 16:38   ` 2.6.12-rc4-mm2 Richard Purdie
2005-05-18 22:45     ` 2.6.12-rc4-mm2 Richard Purdie
2005-05-18  7:14 ` 2.6.12-rc4-mm2 Coywolf Qi Hunt
2005-05-18 20:26 ` 2.6.12-rc4-mm2 Alexander Nyberg
2005-05-19 14:59 ` 2.6.12-rc4-mm2 Brice Goglin
2005-05-22 21:27 ` [bugfix] try_to_unmap_cluster() passes out-of-bounds pte to pte_unmap() William Lee Irwin III
2005-05-22 22:00   ` Andrew Morton
2005-05-24  0:14   ` Andrew Morton
2005-05-24  2:48     ` William Lee Irwin III [this message]
2005-05-24  4:38       ` Hugh Dickins
2005-05-24  8:02         ` Nick Piggin
2007-06-27  0:35 ` Problems with fb console [was Re: 2.6.12-rc4-mm2] J.A. Magallón
2007-06-27  0:54   ` Andrew Morton
2007-06-27 14:21     ` H. Peter Anvin
2007-06-27  7:20   ` DervishD

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=20050524024849.GH2057@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=akpm@osdl.org \
    --cc=gregkh@suse.de \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.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).