Commit ee6ee55b authored by Martin Schwidefsky's avatar Martin Schwidefsky Committed by Paolo Bonzini

KVM: s390: fix task size check

The gmap_map_segment function uses PGDIR_SIZE in the check for the
maximum address in the tasks address space. This incorrectly limits
the amount of memory usable for a kvm guest to 4TB. The correct limit
is (1UL << 53). As the TASK_SIZE has different values (4TB vs 8PB)
dependent on the existance of the fourth page table level, create
a new define 'TASK_MAX_SIZE' for (1UL << 53).
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 3eabaee9
...@@ -43,6 +43,7 @@ extern void execve_tail(void); ...@@ -43,6 +43,7 @@ extern void execve_tail(void);
#ifndef CONFIG_64BIT #ifndef CONFIG_64BIT
#define TASK_SIZE (1UL << 31) #define TASK_SIZE (1UL << 31)
#define TASK_MAX_SIZE (1UL << 31)
#define TASK_UNMAPPED_BASE (1UL << 30) #define TASK_UNMAPPED_BASE (1UL << 30)
#else /* CONFIG_64BIT */ #else /* CONFIG_64BIT */
...@@ -51,6 +52,7 @@ extern void execve_tail(void); ...@@ -51,6 +52,7 @@ extern void execve_tail(void);
#define TASK_UNMAPPED_BASE (test_thread_flag(TIF_31BIT) ? \ #define TASK_UNMAPPED_BASE (test_thread_flag(TIF_31BIT) ? \
(1UL << 30) : (1UL << 41)) (1UL << 30) : (1UL << 41))
#define TASK_SIZE TASK_SIZE_OF(current) #define TASK_SIZE TASK_SIZE_OF(current)
#define TASK_MAX_SIZE (1UL << 53)
#endif /* CONFIG_64BIT */ #endif /* CONFIG_64BIT */
......
...@@ -335,7 +335,7 @@ int gmap_map_segment(struct gmap *gmap, unsigned long from, ...@@ -335,7 +335,7 @@ int gmap_map_segment(struct gmap *gmap, unsigned long from,
if ((from | to | len) & (PMD_SIZE - 1)) if ((from | to | len) & (PMD_SIZE - 1))
return -EINVAL; return -EINVAL;
if (len == 0 || from + len > PGDIR_SIZE || if (len == 0 || from + len > TASK_MAX_SIZE ||
from + len < from || to + len < to) from + len < from || to + len < to)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment