提交 c8e2a437 编写于 作者: Y Yang Yingliang 提交者: Xie XiuQi

Revert "mm: Add a flag MAP_VA32BIT for mmap"

ascend inclusion
category: bugfix
bugzilla: NA
CVE: NA

------------

It's specific code for ascend, so remove it.

This reverts commit 25cf3abca447947a56e74ee9393943e9a3adf8a8.
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 b6ea4283
......@@ -70,8 +70,6 @@
#define TASK_SIZE TASK_SIZE_64
#endif /* CONFIG_COMPAT */
#define MMAP_TOP_4G_SIZE (0x100000000UL)
#define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 4))
#define STACK_TOP_MAX TASK_SIZE_64
......
......@@ -215,10 +215,6 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
if (addr) {
addr = ALIGN(addr, huge_page_size(h));
if (!mmap_va32bit_check(addr, len, flags))
return -ENOMEM;
vma = find_vma(mm, addr);
if (TASK_SIZE - len >= addr &&
(!vma || addr + len <= vm_start_gap(vma)))
......@@ -231,9 +227,6 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
info.high_limit = TASK_SIZE;
info.align_mask = PAGE_MASK & ~huge_page_mask(h);
info.align_offset = 0;
mmap_va32bit_set_limit(&info, flags);
return vm_unmapped_area(&info);
}
#endif
......
......@@ -2355,29 +2355,6 @@ struct vm_unmapped_area_info {
unsigned long align_offset;
};
#ifdef CONFIG_ARCH_ASCEND
extern int mmap_va32bit_check(unsigned long addr, unsigned long len,
unsigned long flags);
extern void mmap_va32bit_set_limit(struct vm_unmapped_area_info *info,
unsigned long flags);
#else
static inline int mmap_va32bit_check(unsigned long addr, unsigned long len,
unsigned long flags)
{
return 1;
}
static inline void mmap_va32bit_set_limit(struct vm_unmapped_area_info *info,
unsigned long flags)
{
}
#endif
extern unsigned long unmapped_area(struct vm_unmapped_area_info *info);
extern unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info);
......
......@@ -14,7 +14,6 @@
#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */
#define MAP_HUGETLB 0x40000 /* create a huge page mapping */
#define MAP_SYNC 0x80000 /* perform synchronous page faults for the mapping */
#define MAP_VA32BIT 0x0200
/* Bits [26:31] are reserved, see mman-common.h for MAP_HUGETLB usage */
......
......@@ -1841,38 +1841,6 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
return error;
}
#ifdef CONFIG_ARCH_ASCEND
int mmap_va32bit_check(unsigned long addr, unsigned long len,
unsigned long flags)
{
return !(!(flags & MAP_VA32BIT) &&
((addr + len) > (TASK_SIZE - MMAP_TOP_4G_SIZE)) &&
(addr < TASK_SIZE));
}
void mmap_va32bit_set_limit(struct vm_unmapped_area_info *info,
unsigned long flags)
{
const unsigned long high_limit = TASK_SIZE;
const unsigned long divide = TASK_SIZE - MMAP_TOP_4G_SIZE;
if (info == NULL)
return;
if (flags & MAP_VA32BIT) {
info->low_limit = divide;
info->high_limit = high_limit;
} else {
/* low_limit do not need set */
if (info->high_limit > divide)
info->high_limit = divide;
}
}
#endif
unsigned long unmapped_area(struct vm_unmapped_area_info *info)
{
/*
......@@ -2103,10 +2071,6 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
if (addr) {
addr = PAGE_ALIGN(addr);
if (!mmap_va32bit_check(addr, len, flags))
return -ENOMEM;
vma = find_vma_prev(mm, addr, &prev);
if (TASK_SIZE - len >= addr && addr >= mmap_min_addr &&
(!vma || addr + len <= vm_start_gap(vma)) &&
......@@ -2119,9 +2083,6 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
info.low_limit = mm->mmap_base;
info.high_limit = TASK_SIZE;
info.align_mask = 0;
mmap_va32bit_set_limit(&info, flags);
return vm_unmapped_area(&info);
}
#endif
......@@ -2151,10 +2112,6 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
/* requesting a specific address */
if (addr) {
addr = PAGE_ALIGN(addr);
if (!mmap_va32bit_check(addr, len, flags))
return -ENOMEM;
vma = find_vma_prev(mm, addr, &prev);
if (TASK_SIZE - len >= addr && addr >= mmap_min_addr &&
(!vma || addr + len <= vm_start_gap(vma)) &&
......@@ -2167,9 +2124,6 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
info.low_limit = max(PAGE_SIZE, mmap_min_addr);
info.high_limit = mm->mmap_base;
info.align_mask = 0;
mmap_va32bit_set_limit(&info, flags);
addr = vm_unmapped_area(&info);
/*
......@@ -2183,9 +2137,6 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
info.flags = 0;
info.low_limit = TASK_UNMAPPED_BASE;
info.high_limit = TASK_SIZE;
mmap_va32bit_set_limit(&info, flags);
addr = vm_unmapped_area(&info);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册