[PATCH] mm: make unmap_vmas() handle non-page-aligned boundary addresses

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Hugh Dickins <hugh@...>
Cc: Rafael J. Wysocki <rjw@...>, Linux Kernel Mailing List <linux-kernel@...>, Kernel Testers List <kernel-testers@...>, Randy Dunlap <randy.dunlap@...>
Date: Saturday, August 16, 2008 - 9:06 pm

zap_pte_range() overruns the page tables if the distance between the
start and end is not a multiple of the pagesize.  Because then,
`start' will never be equal to `end' and we will keep looping.

To fix this, round the boundary addresses to exclude partial pages from
the range completely, we must not unmap them anyway.

Signed-off-by: Johannes Weiner <hannes@saeurebad.de>
---

Hugh Dickins <hugh@veritas.com> writes:


I think this patch fixes it.  exit_mmap() even calls unmap_vmas() with
an ending address of -1UL which is not page-aligned in my book and on my
architecture :)

It is a similar problem to what we had with gup some weeks ago.

diff --git a/mm/memory.c b/mm/memory.c
index 1002f47..483c5d0 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -896,11 +896,17 @@ unsigned long unmap_vmas(struct mmu_gather **tlbp,
 	long zap_work = ZAP_BLOCK_SIZE;
 	unsigned long tlb_start = 0;	/* For tlb_finish_mmu */
 	int tlb_start_valid = 0;
-	unsigned long start = start_addr;
+	unsigned long start;
 	spinlock_t *i_mmap_lock = details? details->i_mmap_lock: NULL;
 	int fullmm = (*tlbp)->fullmm;
 	struct mm_struct *mm = vma->vm_mm;
 
+	/* Preserve partial pages */
+	start_addr = PAGE_ALIGN(start_addr);
+	end_addr &= PAGE_MASK;
+
+	start = start_addr;
+
 	mmu_notifier_invalidate_range_start(mm, start_addr, end_addr);
 	for ( ; vma && vma->vm_start < end_addr; vma = vma->vm_next) {
 		unsigned long end;
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
2.6.27-rc3-git3: Reported regressions from 2.6.26, Rafael J. Wysocki, (Sat Aug 16, 3:00 pm)
Re: 2.6.27-rc3-git3: Reported regressions from 2.6.26, Theodore Tso, (Sun Aug 17, 9:51 am)
Re: 2.6.27-rc3-git3: Reported regressions from 2.6.26, Rafael J. Wysocki, (Sun Aug 17, 12:33 pm)
[Bug #11356] Linux 2.6.27-rc3 - build failure: undefined ref..., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11355] Regression in 2.6.27-rc2 when cross-building th..., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
Re: [Bug #11355] Regression in 2.6.27-rc2 when cross-buildin..., Rafael J. Wysocki, (Sun Aug 17, 8:39 am)
[Bug #11341] 2.6.27-rc1 - ext4 e2fsck false prompting for fi..., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11354] AMD Elan regression with 2.6.27-rc3, Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11346] kernel BUG at arch/x86/mm/pat.c:233!, Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
Re: [Bug #11346] kernel BUG at arch/x86/mm/pat.c:233!, Jean Delvare, (Sat Aug 16, 4:45 pm)
Re: [Bug #11346] kernel BUG at arch/x86/mm/pat.c:233!, Rafael J. Wysocki, (Sun Aug 17, 8:35 am)
Re: [Bug #11346] kernel BUG at arch/x86/mm/pat.c:233!, Ingo Molnar, (Sun Aug 17, 8:46 am)
[Bug #11344] lockdep link failed, Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11343] SATA Cold Boot Problems with 2.6.27-rc[23] on n..., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11340] LTP overnight run resulted in unusable box, Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11339] Only one of my cpus seems to powered down by cp..., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11337] Warning in during hotplug on 2.6.27-rc2-git5, Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11338] ia64 allmodconfig on current mainline, Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11336] 2.6.27-rc2:stall while mounting root fs, Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11333] Rewrite SSB DMA API breaks compilation on ARM, Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
Re: [Bug #11333] Rewrite SSB DMA API breaks compilation on ARM, Rafael J. Wysocki, (Sun Aug 17, 8:43 am)
[Bug #11335] 2.6.27-rc2-git5 BUG: unable to handle kernel pa..., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[PATCH] mm: make unmap_vmas() handle non-page-aligned bounda..., Johannes Weiner, (Sat Aug 16, 9:06 pm)
[Bug #11334] myri10ge: use ioremap_wc: compilation failure o..., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
Re: [Bug #11334] myri10ge: use ioremap_wc: compilation failu..., Rafael J. Wysocki, (Sun Aug 17, 8:35 am)
[Bug #11330] int3: 0000 in tsc_read_refs when using powernow..., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
Re: [Bug #11330] int3: 0000 in tsc_read_refs when using powe..., Rafael J. Wysocki, (Tue Aug 19, 1:02 pm)
[Bug #11323] /proc/diskstats does not contain all disk devices, Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11316] severe performance regression for iptables nat ..., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11313] Plugging HDMI causes "unable to handle kernel p..., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
Re: [Bug #11313] Plugging HDMI causes "unable to handle kern..., Jeremy Fitzhardinge, (Tue Aug 19, 7:53 pm)
Re: [Bug #11313] Plugging HDMI causes "unable to handle kern..., Jeremy Fitzhardinge, (Wed Aug 20, 12:00 pm)
Re: [Bug #11313] Plugging HDMI causes "unable to handle kern..., Jeremy Fitzhardinge, (Thu Aug 21, 2:13 pm)
Re: [Bug #11313] Plugging HDMI causes "unable to handle kern..., Jeremy Fitzhardinge, (Thu Aug 21, 2:59 pm)
Re: [Bug #11313] Plugging HDMI causes "unable to handle kern..., Rafael J. Wysocki, (Thu Aug 21, 2:34 pm)
Re: [Bug #11313] Plugging HDMI causes "unable to handle kern..., Jeremy Fitzhardinge, (Wed Aug 20, 4:46 pm)
Re: [Bug #11313] Plugging HDMI causes "unable to handle kern..., Jeremy Fitzhardinge, (Tue Aug 19, 5:31 pm)
Re: [Bug #11313] Plugging HDMI causes "unable to handle kern..., Rafael J. Wysocki, (Sun Aug 17, 3:35 pm)
[Bug #11308] tbench regression on each kernel release from ..., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11296] 2.6.27-rc2-git4: suspend and power off fails on..., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11293] 2.6.27-rc2: suspend regression on EeePC, Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11279] 2.6.27-rc0 Power Bugs with HP/Compaq Laptops, Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11278] 2.6.27-rc2: Very odd top: '5124095h kthreadd' d..., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
Re: [Bug #11278] 2.6.27-rc2: Very odd top: '5124095h kthread..., Rafael J. Wysocki, (Sun Aug 17, 8:22 am)
[Bug #11282] Please fix x86 defconfig regression, Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11272] BUG: parport_serial in 2.6.27-rc1 for NetMos Te..., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11276] build error: CONFIG_OPTIMIZE_INLINING=y causes ..., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11263] Re: 2.6.27-rc2: uvcvideo WARNING after suspend ..., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11264] Invalid op opcode in kernel/workqueue, Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11271] BUG: fealnx in 2.6.27-rc1, Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11260] Regression: USB memory stick triggers several U..., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
Re: [Bug #11260] Regression: USB memory stick triggers sever..., Rafael J. Wysocki, (Sun Aug 17, 8:18 am)
[Bug #11254] KVM: fix userspace ABI breakage, Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
Re: [Bug #11254] KVM: fix userspace ABI breakage, Adrian Bunk, (Sun Aug 17, 2:45 pm)
[Bug #11245] acpi error on 2.6.27-rc1+ (ACPI Error (dsobject..., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11237] corrupt PMD after resume, Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
Re: [Bug #11237] corrupt PMD after resume, Hugh Dickins, (Sat Aug 16, 7:36 pm)
Re: [Bug #11237] corrupt PMD after resume, Rafael J. Wysocki, (Sun Aug 17, 8:18 am)
[Bug #11215] INFO: possible recursive locking detected ps2_c..., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11220] Heavy suspend and io problems in 2.6.27-rc1-001..., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11219] KVM modules break emergency reboot, Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11230] Kconfig no longer outputs a .config with freshl..., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11224] Only three cores found on quad-core machine., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11228] p54usb broken by commit b19fa1f, Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
Re: [Bug #11228] p54usb broken by commit b19fa1f, Larry Finger, (Sun Aug 17, 5:25 pm)
[Bug #11210] libata badness, Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11209] 2.6.27-rc1 process time accounting, Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
Re: [Bug #11209] 2.6.27-rc1 process time accounting, Peter Zijlstra, (Sun Aug 17, 4:07 am)
Re: [Bug #11209] 2.6.27-rc1 process time accounting, Rafael J. Wysocki, (Sun Aug 17, 8:19 am)
[Bug #11205] x86: 2.6.27-rc1 does not build with gcc-3.2.3 a..., Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
Re: [Bug #11205] x86: 2.6.27-rc1 does not build with gcc-3.2..., Mikael Pettersson, (Sun Aug 17, 5:12 am)
Re: [Bug #11205] x86: 2.6.27-rc1 does not build with gcc-3.2..., Rafael J. Wysocki, (Sun Aug 17, 6:27 am)
[Bug #11189] sky2 WOL broken, Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11191] 2.6.26-git8: spinlock lockup in c1e_idle(), Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
Re: [Bug #11191] 2.6.26-git8: spinlock lockup in c1e_idle(), Mikhail Kshevetskiy, (Mon Aug 18, 5:45 pm)
Re: [Bug #11191] 2.6.26-git8: spinlock lockup in c1e_idle(), Rafael J. Wysocki, (Mon Aug 18, 5:54 pm)
[Bug #11207] VolanoMark regression with 2.6.27-rc1, Rafael J. Wysocki, (Sat Aug 16, 3:02 pm)
[Bug #11141] no battery or DC status - Dell i1501, Rafael J. Wysocki, (Sat Aug 16, 3:00 pm)