linux/include
Hugh Dickins 68589bc353 [PATCH] hugetlb: prepare_hugepage_range check offset too
(David:)

If hugetlbfs_file_mmap() returns a failure to do_mmap_pgoff() - for example,
because the given file offset is not hugepage aligned - then do_mmap_pgoff
will go to the unmap_and_free_vma backout path.

But at this stage the vma hasn't been marked as hugepage, and the backout path
will call unmap_region() on it.  That will eventually call down to the
non-hugepage version of unmap_page_range().  On ppc64, at least, that will
cause serious problems if there are any existing hugepage pagetable entries in
the vicinity - for example if there are any other hugepage mappings under the
same PUD.  unmap_page_range() will trigger a bad_pud() on the hugepage pud
entries.  I suspect this will also cause bad problems on ia64, though I don't
have a machine to test it on.

(Hugh:)

prepare_hugepage_range() should check file offset alignment when it checks
virtual address and length, to stop MAP_FIXED with a bad huge offset from
unmapping before it fails further down.  PowerPC should apply the same
prepare_hugepage_range alignment checks as ia64 and all the others do.

Then none of the alignment checks in hugetlbfs_file_mmap are required (nor
is the check for too small a mapping); but even so, move up setting of
VM_HUGETLB and add a comment to warn of what David Gibson discovered - if
hugetlbfs_file_mmap fails before setting it, do_mmap_pgoff's unmap_region
when unwinding from error will go the non-huge way, which may cause bad
behaviour on architectures (powerpc and ia64) which segregate their huge
mappings into a separate region of the address space.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: "David S. Miller" <davem@davemloft.net>
Acked-by: Adam Litke <agl@us.ibm.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-11-14 09:09:27 -08:00
..
acpi ACPI: Processor native C-states using MWAIT 2006-10-14 00:35:39 -04:00
asm-alpha [PATCH] Consolidate check_signature 2006-10-11 11:14:23 -07:00
asm-arm [ARM] 3919/1: Fixed definition of some PXA270 CIF related registers 2006-11-03 19:52:52 +00:00
asm-arm26 fix file specification in comments 2006-10-03 23:01:26 +02:00
asm-avr32 AVR32: Wire up sys_epoll_pwait 2006-11-06 14:07:15 +01:00
asm-cris
asm-frv [PATCH] FRV: Use the correct preemption primitives in kmap_atomic() and co 2006-10-16 08:32:29 -07:00
asm-generic [PATCH] drivers: wait for threaded probes between initcall levels 2006-10-27 15:34:51 -07:00
asm-h8300
asm-i386 i386: clean up io-apic accesses 2006-11-01 09:11:00 -08:00
asm-ia64 [PATCH] mspec driver build fix 2006-11-13 07:40:42 -08:00
asm-m32r [PATCH] Consolidate check_signature 2006-10-11 11:14:23 -07:00
asm-m68k [PATCH] sun3_ioremap() prototype 2006-10-15 11:00:58 -07:00
asm-m68knommu [PATCH] m68knommu: sync syscalls with m68k 2006-10-13 08:35:39 -07:00
asm-mips [MIPS] Make irq number allocator generally available for fixing EV64120. 2006-11-06 20:55:38 +00:00
asm-parisc [PARISC] pdc_init no longer exists 2006-10-07 05:22:30 -06:00
asm-powerpc [PATCH] powerpc: wire up sys_migrate_pages 2006-11-03 12:27:59 -08:00
asm-ppc [PATCH] Consolidate check_signature 2006-10-11 11:14:23 -07:00
asm-s390 [S390] Fix pte type checking. 2006-10-18 18:30:51 +02:00
asm-sh sh: Fix IPR-IRQ's for IRQ-chip change breakage. 2006-10-31 12:53:28 +09:00
asm-sh64 [PATCH] Consolidate check_signature 2006-10-11 11:14:23 -07:00
asm-sparc [SPARC]: Fix robust futex syscalls and wire up migrate_pages. 2006-11-05 16:51:03 -08:00
asm-sparc64 [SPARC]: Fix robust futex syscalls and wire up migrate_pages. 2006-11-05 16:51:03 -08:00
asm-um [PATCH] uml: add INITCALLS 2006-10-31 08:07:00 -08:00
asm-v850
asm-x86_64 x86-64: clean up io-apic accesses 2006-11-08 10:23:03 -08:00
asm-xtensa fix file specification in comments 2006-10-03 23:01:26 +02:00
crypto
keys
linux [PATCH] hugetlb: prepare_hugepage_range check offset too 2006-11-14 09:09:27 -08:00
math-emu
media V4L/DVB (4666): Ensure the WM8775 driver is loaded generically for any board. 2006-10-03 15:13:48 -03:00
mtd
net [IPVS]: Compile fix for annotations in userland. 2006-11-09 20:00:55 -08:00
pcmcia
rdma RDMA/addr: Use client registration to fix module unload race 2006-11-02 14:26:04 -08:00
rxrpc
scsi [SCSI] replace u8 and u32 with __u8 and __u32 in scsi.h for user space 2006-10-25 15:14:34 -07:00
sound [ALSA] version 1.0.13 2006-10-22 10:56:24 +02:00
video fix file specification in comments 2006-10-03 23:01:26 +02:00
Kbuild