hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/x86/kernel/sys_x86_64.c
....@@ -21,8 +21,6 @@
2121
2222 #include <asm/elf.h>
2323 #include <asm/ia32.h>
24
-#include <asm/syscalls.h>
25
-#include <asm/mpx.h>
2624
2725 /*
2826 * Align a virtual address to avoid aliasing in the I$ on AMD F15h.
....@@ -70,9 +68,6 @@
7068 if (*str == 0)
7169 return 1;
7270
73
- if (*str == '=')
74
- str++;
75
-
7671 if (!strcmp(str, "32"))
7772 va_align.flags = ALIGN_VA_32;
7873 else if (!strcmp(str, "64"))
....@@ -82,11 +77,11 @@
8277 else if (!strcmp(str, "on"))
8378 va_align.flags = ALIGN_VA_32 | ALIGN_VA_64;
8479 else
85
- return 0;
80
+ pr_warn("invalid option value: 'align_va_addr=%s'\n", str);
8681
8782 return 1;
8883 }
89
-__setup("align_va_addr", control_va_addr_alignment);
84
+__setup("align_va_addr=", control_va_addr_alignment);
9085
9186 SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
9287 unsigned long, prot, unsigned long, flags,
....@@ -105,7 +100,7 @@
105100 static void find_start_end(unsigned long addr, unsigned long flags,
106101 unsigned long *begin, unsigned long *end)
107102 {
108
- if (!in_compat_syscall() && (flags & MAP_32BIT)) {
103
+ if (!in_32bit_syscall() && (flags & MAP_32BIT)) {
109104 /* This is usually used needed to map code in small
110105 model, so it needs to be in the first 31bit. Limit
111106 it to that. This means we need to move the
....@@ -122,7 +117,7 @@
122117 }
123118
124119 *begin = get_mmap_base(1);
125
- if (in_compat_syscall())
120
+ if (in_32bit_syscall())
126121 *end = task_size_32bit();
127122 else
128123 *end = task_size_64bit(addr > DEFAULT_MAP_WINDOW);
....@@ -136,10 +131,6 @@
136131 struct vm_area_struct *vma;
137132 struct vm_unmapped_area_info info;
138133 unsigned long begin, end;
139
-
140
- addr = mpx_unmapped_area_check(addr, len, flags);
141
- if (IS_ERR_VALUE(addr))
142
- return addr;
143134
144135 if (flags & MAP_FIXED)
145136 return addr;
....@@ -180,10 +171,6 @@
180171 unsigned long addr = addr0;
181172 struct vm_unmapped_area_info info;
182173
183
- addr = mpx_unmapped_area_check(addr, len, flags);
184
- if (IS_ERR_VALUE(addr))
185
- return addr;
186
-
187174 /* requested length too big for entire address space */
188175 if (len > TASK_SIZE)
189176 return -ENOMEM;
....@@ -193,7 +180,7 @@
193180 return addr;
194181
195182 /* for MAP_32BIT mappings we force the legacy mmap base */
196
- if (!in_compat_syscall() && (flags & MAP_32BIT))
183
+ if (!in_32bit_syscall() && (flags & MAP_32BIT))
197184 goto bottomup;
198185
199186 /* requesting a specific address */
....@@ -217,9 +204,10 @@
217204 * If hint address is above DEFAULT_MAP_WINDOW, look for unmapped area
218205 * in the full address space.
219206 *
220
- * !in_compat_syscall() check to avoid high addresses for x32.
207
+ * !in_32bit_syscall() check to avoid high addresses for x32
208
+ * (and make it no op on native i386).
221209 */
222
- if (addr > DEFAULT_MAP_WINDOW && !in_compat_syscall())
210
+ if (addr > DEFAULT_MAP_WINDOW && !in_32bit_syscall())
223211 info.high_limit += TASK_SIZE_MAX - DEFAULT_MAP_WINDOW;
224212
225213 info.align_mask = 0;