linux/arch/ia64
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
..
configs [IA64] update sn2_defconfig 2006-10-17 14:55:45 -07:00
dig [PATCH] tty: Remove include of screen_info.h from tty.h 2006-07-10 13:24:16 -07:00
hp [PATCH] ia64/hp NULL noise removal 2006-10-10 15:37:22 -07:00
ia32 [PATCH] VFS: Make filldir_t and struct kstat deal in 64-bit inode numbers 2006-10-03 08:03:40 -07:00
kernel Merge branch 'release' of master.kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6 2006-10-31 17:03:50 -08:00
lib [PATCH] Fix RAID5 + IA64 compile 2006-08-03 10:04:27 -07:00
mm [PATCH] hugetlb: prepare_hugepage_range check offset too 2006-11-14 09:09:27 -08:00
oprofile Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
pci PCI: fix pci_fixup_video as it blows up on sparc64 2006-10-27 11:20:33 -07:00
scripts Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sn [IA64] remove unused acpi_kbd_controller_present, acpi_legacy_devices 2006-10-17 14:57:33 -07:00
Kconfig [PATCH] mspec driver build fix 2006-11-13 07:40:42 -08:00
Kconfig.debug [PATCH] Move Kprobes and Oprofile to "Instrumentation Support" menu 2005-11-07 07:53:35 -08:00
Makefile [IA64] add vmlinuz target 2006-06-21 14:31:07 -07:00
defconfig [PATCH] sgiioc4: Always share IRQ 2006-07-31 13:28:40 -07:00
install.sh Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
module.lds Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00