s390/mm: Fix crst upgrade of mmap with MAP_FIXED
authorHendrik Brueckner <brueckner@linux.vnet.ibm.com>
Mon, 11 Feb 2013 13:29:49 +0000 (14:29 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Thu, 14 Feb 2013 14:55:22 +0000 (15:55 +0100)
Right now the page table upgrade does not happen if the end address
of a fixed mapping is greater than TASK_SIZE.
Enhance s390_mmap_check() to handle MAP_FIXED mappings correctly.

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/mman.h
arch/s390/mm/mmap.c

index 0e47a576d666b92ce1fb88f46daae16e736cbfc9..9977e08df5bd9590d31a4c32ccdb0073fbe761ff 100644 (file)
@@ -9,7 +9,7 @@
 #include <uapi/asm/mman.h>
 
 #if !defined(__ASSEMBLY__) && defined(CONFIG_64BIT)
-int s390_mmap_check(unsigned long addr, unsigned long len);
-#define arch_mmap_check(addr,len,flags)        s390_mmap_check(addr,len)
+int s390_mmap_check(unsigned long addr, unsigned long len, unsigned long flags);
+#define arch_mmap_check(addr, len, flags) s390_mmap_check(addr, len, flags)
 #endif
 #endif /* __S390_MMAN_H__ */
index c59a5efa58b1ee701f93b4f980397e539265805a..06bafec00278c654d616c731a2711a0b7b5beced 100644 (file)
@@ -101,12 +101,15 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
 
 #else
 
-int s390_mmap_check(unsigned long addr, unsigned long len)
+int s390_mmap_check(unsigned long addr, unsigned long len, unsigned long flags)
 {
        int rc;
 
-       if (!is_compat_task() &&
-           len >= TASK_SIZE && TASK_SIZE < (1UL << 53)) {
+       if (is_compat_task() || (TASK_SIZE >= (1UL << 53)))
+               return 0;
+       if (!(flags & MAP_FIXED))
+               addr = 0;
+       if ((addr + len) >= TASK_SIZE) {
                rc = crst_table_upgrade(current->mm, 1UL << 53);
                if (rc)
                        return rc;