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
Subject: [bugfix] try_to_unmap_cluster() passes out-of-bounds pte to pte_unmap()
Date: Sun, 22 May 2005 14:27:34 -0700	[thread overview]
Message-ID: <20050522212734.GF2057@holomorphy.com> (raw)
In-Reply-To: <20050516021302.13bd285a.akpm@osdl.org>

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

On Mon, May 16, 2005 at 02:13:02AM -0700, Andrew Morton wrote:
> ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.12-rc4/2.6.12-rc4-mm2/
> - davem has set up a mm-commits mailing list so people can review things
>   which are added to or removed from the -mm tree.  Do
> 	echo subscribe mm-commits | mail majordomo@vger.kernel.org
> - x86_64 architecture update from Andi.
> - Everything up to and including `spurious-interrupt-fix.patch' is planned
>   for 2.6.12 merging.  Plus a few other things in there.
> - Another DVB subsystem update

try_to_unmap_cluster() does:
        for (pte = pte_offset_map(pmd, address);
                        address < end; pte++, address += PAGE_SIZE) {
		...
	}

	pte_unmap(pte);

It may take a little staring to notice, but pte can actually fall off
the end of the pte page in this iteration, which makes life difficult
for kmap_atomic() and the users not expecting it to BUG(). Of course,
we're somewhat lucky in that arithmetic elsewhere in the function
guarantees that at least one iteration is made, lest this force larger
rearrangements to be made. This issue and patch also apply to non-mm
mainline and with trivial adjustments, at least two related kernels.

Discovered during internal testing at Oracle. Sample BUG() message
included along with patch as a MIME attachment.

Signed-off-by: William Irwin <wli@holomorphy.com>


-- wli

[-- Attachment #2: vlm-kunmap-atomic-fix.patch --]
[-- Type: text/plain, Size: 244 bytes --]

--- ./mm/rmap.c.orig	2005-05-20 01:29:14.066467151 -0700
+++ ./mm/rmap.c	2005-05-20 01:30:06.620649901 -0700
@@ -694,7 +694,7 @@
 		(*mapcount)--;
 	}
 
-	pte_unmap(pte);
+	pte_unmap(pte-1);
 out_unlock:
 	spin_unlock(&mm->page_table_lock);
 }

[-- Attachment #3: vlm.oops --]
[-- Type: text/plain, Size: 1890 bytes --]

May 18 23:50:30 palnx1 kernel: ------------[ cut here ]------------
May 18 23:50:30 palnx1 kernel: kernel BUG at arch/i386/mm/highmem.c:96!
May 18 23:50:30 palnx1 kernel: invalid operand: 0000 [#1]
May 18 23:50:30 palnx1 kernel: SMP
May 18 23:50:30 palnx1 kernel: Modules linked in: nfsd exportfs md5 ipv6 parport_pc lp parport autofs4 i2c_dev i2c_core nfs lockd sunrpc dm_mod button battery ac uhci_hcd e1000 e100 mii floppy ext3 jbd qla2300 qla2xxx scsi_transport_fc aic79xx sd_mod scsi_mod
May 18 23:50:30 palnx1 kernel: CPU:    2
May 18 23:50:30 palnx1 kernel: EIP:    0060:[<c011bfc4>]    Not tainted VLI
May 18 23:50:30 palnx1 kernel: EFLAGS: 00010206   (2.6.9-9.ELsmp)
May 18 23:50:30 palnx1 kernel: EIP is at kunmap_atomic+0x2e/0x58
May 18 23:50:30 palnx1 kernel: eax: 00074000   ebx: 00000001   ecx: fff8b000  edx: 0000005e
May 18 23:50:30 palnx1 kernel: esi: fff8c000   edi: d5dac000   ebp: fff8c000  esp: d5daccd0
May 18 23:50:30 palnx1 kernel: ds: 007b   es: 007b   ss: 0068
May 18 23:50:30 palnx1 kernel: Process oracle (pid: 23771, threadinfo=d5dac000 task=f4df4bb0)
May 18 23:50:30 palnx1 kernel: Stack: 00000001 97800000 c402e480 c014e1fa 81724007 00000001 97800000 d6d59c80
May 18 23:50:30 palnx1 kernel:        e3a41c24 d5dacd18 00100000 e3a41c24 f73012fc c1198580 c014e3e4 20000000
May 18 23:50:30 palnx1 kernel:        00100000 00000001 ffffffe1 00000000 00000000 00000000 00000000 f7301318
May 18 23:50:30 palnx1 kernel: Call Trace:
May 18 23:50:30 palnx1 kernel:  [<c014e1fa>] try_to_unmap_cluster+0x1b1/0x1c4
May 18 23:50:30 palnx1 kernel:  [<c014e3e4>] try_to_unmap_file+0x16d/0x21c
May 18 23:50:30 palnx1 kernel:  [<c014e4c9>] try_to_unmap+0x36/0x49
May 18 23:50:30 palnx1 kernel:  [<c01451d6>] shrink_list+0x1ba/0x3ed
May 18 23:50:30 palnx1 kernel:  [<c02c7d6a>] invalidate_interrupt+0x1a/0x20
May 18 23:50:30 palnx1 kernel:  [<c01455e6>] shrink_cache+0x1dd/0x34d

  parent reply	other threads:[~2005-05-22 21:27 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 ` William Lee Irwin III [this message]
2005-05-22 22:00   ` [bugfix] try_to_unmap_cluster() passes out-of-bounds pte to pte_unmap() Andrew Morton
2005-05-24  0:14   ` Andrew Morton
2005-05-24  2:48     ` William Lee Irwin III
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=20050522212734.GF2057@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=akpm@osdl.org \
    --cc=gregkh@suse.de \
    --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).