Commit 486c0a0bc80d370471b21662bf03f04fbb37cdc6
Committed by
Martin Schwidefsky
1 parent
a4e69245bd
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
s390/mm: Fix crst upgrade of mmap with MAP_FIXED
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>
Showing 2 changed files with 8 additions and 5 deletions Side-by-side Diff
arch/s390/include/asm/mman.h
... | ... | @@ -9,8 +9,8 @@ |
9 | 9 | #include <uapi/asm/mman.h> |
10 | 10 | |
11 | 11 | #if !defined(__ASSEMBLY__) && defined(CONFIG_64BIT) |
12 | -int s390_mmap_check(unsigned long addr, unsigned long len); | |
13 | -#define arch_mmap_check(addr,len,flags) s390_mmap_check(addr,len) | |
12 | +int s390_mmap_check(unsigned long addr, unsigned long len, unsigned long flags); | |
13 | +#define arch_mmap_check(addr, len, flags) s390_mmap_check(addr, len, flags) | |
14 | 14 | #endif |
15 | 15 | #endif /* __S390_MMAN_H__ */ |
arch/s390/mm/mmap.c
... | ... | @@ -101,12 +101,15 @@ |
101 | 101 | |
102 | 102 | #else |
103 | 103 | |
104 | -int s390_mmap_check(unsigned long addr, unsigned long len) | |
104 | +int s390_mmap_check(unsigned long addr, unsigned long len, unsigned long flags) | |
105 | 105 | { |
106 | 106 | int rc; |
107 | 107 | |
108 | - if (!is_compat_task() && | |
109 | - len >= TASK_SIZE && TASK_SIZE < (1UL << 53)) { | |
108 | + if (is_compat_task() || (TASK_SIZE >= (1UL << 53))) | |
109 | + return 0; | |
110 | + if (!(flags & MAP_FIXED)) | |
111 | + addr = 0; | |
112 | + if ((addr + len) >= TASK_SIZE) { | |
110 | 113 | rc = crst_table_upgrade(current->mm, 1UL << 53); |
111 | 114 | if (rc) |
112 | 115 | return rc; |