|
@@ -28,6 +28,7 @@
|
|
|
#include <linux/mm.h>
|
|
|
#include <linux/module.h>
|
|
|
#include <asm/pgalloc.h>
|
|
|
+#include <asm/compat.h>
|
|
|
|
|
|
/*
|
|
|
* Top of mmap area (just below the process stack).
|
|
@@ -55,7 +56,7 @@ static inline int mmap_is_legacy(void)
|
|
|
/*
|
|
|
* Force standard allocation for 64 bit programs.
|
|
|
*/
|
|
|
- if (!test_thread_flag(TIF_31BIT))
|
|
|
+ if (!is_compat_task())
|
|
|
return 1;
|
|
|
#endif
|
|
|
return sysctl_legacy_va_layout ||
|
|
@@ -91,7 +92,7 @@ EXPORT_SYMBOL_GPL(arch_pick_mmap_layout);
|
|
|
|
|
|
int s390_mmap_check(unsigned long addr, unsigned long len)
|
|
|
{
|
|
|
- if (!test_thread_flag(TIF_31BIT) &&
|
|
|
+ if (!is_compat_task() &&
|
|
|
len >= TASK_SIZE && TASK_SIZE < (1UL << 53))
|
|
|
return crst_table_upgrade(current->mm, 1UL << 53);
|
|
|
return 0;
|
|
@@ -108,8 +109,7 @@ s390_get_unmapped_area(struct file *filp, unsigned long addr,
|
|
|
area = arch_get_unmapped_area(filp, addr, len, pgoff, flags);
|
|
|
if (!(area & ~PAGE_MASK))
|
|
|
return area;
|
|
|
- if (area == -ENOMEM &&
|
|
|
- !test_thread_flag(TIF_31BIT) && TASK_SIZE < (1UL << 53)) {
|
|
|
+ if (area == -ENOMEM && !is_compat_task() && TASK_SIZE < (1UL << 53)) {
|
|
|
/* Upgrade the page table to 4 levels and retry. */
|
|
|
rc = crst_table_upgrade(mm, 1UL << 53);
|
|
|
if (rc)
|
|
@@ -131,8 +131,7 @@ s390_get_unmapped_area_topdown(struct file *filp, const unsigned long addr,
|
|
|
area = arch_get_unmapped_area_topdown(filp, addr, len, pgoff, flags);
|
|
|
if (!(area & ~PAGE_MASK))
|
|
|
return area;
|
|
|
- if (area == -ENOMEM &&
|
|
|
- !test_thread_flag(TIF_31BIT) && TASK_SIZE < (1UL << 53)) {
|
|
|
+ if (area == -ENOMEM && !is_compat_task() && TASK_SIZE < (1UL << 53)) {
|
|
|
/* Upgrade the page table to 4 levels and retry. */
|
|
|
rc = crst_table_upgrade(mm, 1UL << 53);
|
|
|
if (rc)
|