| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2015 Imagination Technologies |
|---|
| 3 | 4 | * Author: Alex Smith <alex.smith@imgtec.com> |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 6 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 7 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 8 | | - * option) any later version. |
|---|
| 9 | 5 | */ |
|---|
| 10 | 6 | |
|---|
| 11 | 7 | #include <linux/binfmts.h> |
|---|
| .. | .. |
|---|
| 75 | 71 | |
|---|
| 76 | 72 | static unsigned long vdso_base(void) |
|---|
| 77 | 73 | { |
|---|
| 78 | | - unsigned long base; |
|---|
| 74 | + unsigned long base = STACK_TOP; |
|---|
| 79 | 75 | |
|---|
| 80 | | - /* Skip the delay slot emulation page */ |
|---|
| 81 | | - base = STACK_TOP + PAGE_SIZE; |
|---|
| 76 | + if (IS_ENABLED(CONFIG_MIPS_FP_SUPPORT)) { |
|---|
| 77 | + /* Skip the delay slot emulation page */ |
|---|
| 78 | + base += PAGE_SIZE; |
|---|
| 79 | + } |
|---|
| 82 | 80 | |
|---|
| 83 | 81 | if (current->flags & PF_RANDOMIZE) { |
|---|
| 84 | 82 | base += get_random_int() & (VDSO_RANDOMIZE_SIZE - 1); |
|---|
| .. | .. |
|---|
| 96 | 94 | struct vm_area_struct *vma; |
|---|
| 97 | 95 | int ret; |
|---|
| 98 | 96 | |
|---|
| 99 | | - if (down_write_killable(&mm->mmap_sem)) |
|---|
| 97 | + if (mmap_write_lock_killable(mm)) |
|---|
| 100 | 98 | return -EINTR; |
|---|
| 101 | 99 | |
|---|
| 102 | | - /* Map delay slot emulation page */ |
|---|
| 103 | | - base = mmap_region(NULL, STACK_TOP, PAGE_SIZE, |
|---|
| 104 | | - VM_READ | VM_EXEC | |
|---|
| 105 | | - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC, |
|---|
| 106 | | - 0, NULL); |
|---|
| 107 | | - if (IS_ERR_VALUE(base)) { |
|---|
| 108 | | - ret = base; |
|---|
| 109 | | - goto out; |
|---|
| 100 | + if (IS_ENABLED(CONFIG_MIPS_FP_SUPPORT)) { |
|---|
| 101 | + /* Map delay slot emulation page */ |
|---|
| 102 | + base = mmap_region(NULL, STACK_TOP, PAGE_SIZE, |
|---|
| 103 | + VM_READ | VM_EXEC | |
|---|
| 104 | + VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC, |
|---|
| 105 | + 0, NULL); |
|---|
| 106 | + if (IS_ERR_VALUE(base)) { |
|---|
| 107 | + ret = base; |
|---|
| 108 | + goto out; |
|---|
| 109 | + } |
|---|
| 110 | 110 | } |
|---|
| 111 | 111 | |
|---|
| 112 | 112 | /* |
|---|
| .. | .. |
|---|
| 187 | 187 | ret = 0; |
|---|
| 188 | 188 | |
|---|
| 189 | 189 | out: |
|---|
| 190 | | - up_write(&mm->mmap_sem); |
|---|
| 190 | + mmap_write_unlock(mm); |
|---|
| 191 | 191 | return ret; |
|---|
| 192 | 192 | } |
|---|