[RFC] mm: Allow 64-bit mmap syscalls to access higher addresses.
From: Derek Lesho
Date: Fri Sep 25 2020 - 11:54:15 EST
For those curious about my usecase, I'm working on running some windows 64-bit driver code in context of any given process. I accomplish this by mapping some of the fake kernel
bits in the target process, and running the code in a dedicated thread.
---
mm/mmap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/mmap.c b/mm/mmap.c
index 40248d84ad5f..3a6940ef6128 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2240,7 +2240,7 @@ get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
if (IS_ERR_VALUE(addr))
return addr;
- if (addr > TASK_SIZE - len)
+ if (addr > TASK_SIZE_MAX - len)
return -ENOMEM;
if (offset_in_page(addr))
return -EINVAL;
@@ -2767,7 +2767,7 @@ int __do_munmap(struct mm_struct *mm, unsigned long start, size_t len,
unsigned long end;
struct vm_area_struct *vma, *prev, *last;
- if ((offset_in_page(start)) || start > TASK_SIZE || len > TASK_SIZE-start)
+ if ((offset_in_page(start)) || start > TASK_SIZE_MAX || len > TASK_SIZE_MAX-start)
return -EINVAL;
len = PAGE_ALIGN(len);
--
2.28.0