hc
2024-10-16 50a212ec906f7524620675f0c57357691c26c81f
kernel/arch/mips/kernel/vdso.c
....@@ -1,11 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (C) 2015 Imagination Technologies
34 * 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.
95 */
106
117 #include <linux/binfmts.h>
....@@ -75,10 +71,12 @@
7571
7672 static unsigned long vdso_base(void)
7773 {
78
- unsigned long base;
74
+ unsigned long base = STACK_TOP;
7975
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
+ }
8280
8381 if (current->flags & PF_RANDOMIZE) {
8482 base += get_random_int() & (VDSO_RANDOMIZE_SIZE - 1);
....@@ -96,17 +94,19 @@
9694 struct vm_area_struct *vma;
9795 int ret;
9896
99
- if (down_write_killable(&mm->mmap_sem))
97
+ if (mmap_write_lock_killable(mm))
10098 return -EINTR;
10199
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
+ }
110110 }
111111
112112 /*
....@@ -187,6 +187,6 @@
187187 ret = 0;
188188
189189 out:
190
- up_write(&mm->mmap_sem);
190
+ mmap_write_unlock(mm);
191191 return ret;
192192 }