Skip to content

Commit cf122cf

Browse files
author
Al Viro
committed
kill uaccess_try()
finally Signed-off-by: Al Viro <[email protected]>
1 parent b87df65 commit cf122cf

File tree

5 files changed

+0
-90
lines changed

5 files changed

+0
-90
lines changed

Documentation/x86/exception-tables.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,4 @@ pointer which points to one of:
337337
entry->insn. It is used to distinguish page faults from machine
338338
check.
339339

340-
3) ``int ex_handler_ext(const struct exception_table_entry *fixup)``
341-
This case is used for uaccess_err ... we need to set a flag
342-
in the task structure. Before the handler functions existed this
343-
case was handled by adding a large offset to the fixup to tag
344-
it as special.
345-
346340
More functions can easily be added.

arch/x86/include/asm/asm.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,6 @@
138138
# define _ASM_EXTABLE_FAULT(from, to) \
139139
_ASM_EXTABLE_HANDLE(from, to, ex_handler_fault)
140140

141-
# define _ASM_EXTABLE_EX(from, to) \
142-
_ASM_EXTABLE_HANDLE(from, to, ex_handler_ext)
143-
144141
# define _ASM_NOKPROBE(entry) \
145142
.pushsection "_kprobe_blacklist","aw" ; \
146143
_ASM_ALIGN ; \
@@ -166,9 +163,6 @@
166163
# define _ASM_EXTABLE_FAULT(from, to) \
167164
_ASM_EXTABLE_HANDLE(from, to, ex_handler_fault)
168165

169-
# define _ASM_EXTABLE_EX(from, to) \
170-
_ASM_EXTABLE_HANDLE(from, to, ex_handler_ext)
171-
172166
/* For C file, we already have NOKPROBE_SYMBOL macro */
173167
#endif
174168

arch/x86/include/asm/processor.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,6 @@ struct thread_struct {
541541
mm_segment_t addr_limit;
542542

543543
unsigned int sig_on_uaccess_err:1;
544-
unsigned int uaccess_err:1; /* uaccess failed */
545544

546545
/* Floating point and extended processor state */
547546
struct fpu fpu;

arch/x86/include/asm/uaccess.h

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -193,23 +193,12 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
193193
: : "A" (x), "r" (addr) \
194194
: : label)
195195

196-
#define __put_user_asm_ex_u64(x, addr) \
197-
asm volatile("\n" \
198-
"1: movl %%eax,0(%1)\n" \
199-
"2: movl %%edx,4(%1)\n" \
200-
"3:" \
201-
_ASM_EXTABLE_EX(1b, 2b) \
202-
_ASM_EXTABLE_EX(2b, 3b) \
203-
: : "A" (x), "r" (addr))
204-
205196
#define __put_user_x8(x, ptr, __ret_pu) \
206197
asm volatile("call __put_user_8" : "=a" (__ret_pu) \
207198
: "A" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx")
208199
#else
209200
#define __put_user_goto_u64(x, ptr, label) \
210201
__put_user_goto(x, ptr, "q", "", "er", label)
211-
#define __put_user_asm_ex_u64(x, addr) \
212-
__put_user_asm_ex(x, addr, "q", "", "er")
213202
#define __put_user_x8(x, ptr, __ret_pu) __put_user_x(8, x, ptr, __ret_pu)
214203
#endif
215204

@@ -289,31 +278,6 @@ do { \
289278
} \
290279
} while (0)
291280

292-
/*
293-
* This doesn't do __uaccess_begin/end - the exception handling
294-
* around it must do that.
295-
*/
296-
#define __put_user_size_ex(x, ptr, size) \
297-
do { \
298-
__chk_user_ptr(ptr); \
299-
switch (size) { \
300-
case 1: \
301-
__put_user_asm_ex(x, ptr, "b", "b", "iq"); \
302-
break; \
303-
case 2: \
304-
__put_user_asm_ex(x, ptr, "w", "w", "ir"); \
305-
break; \
306-
case 4: \
307-
__put_user_asm_ex(x, ptr, "l", "k", "ir"); \
308-
break; \
309-
case 8: \
310-
__put_user_asm_ex_u64((__typeof__(*ptr))(x), ptr); \
311-
break; \
312-
default: \
313-
__put_user_bad(); \
314-
} \
315-
} while (0)
316-
317281
#ifdef CONFIG_X86_32
318282
#define __get_user_asm_u64(x, ptr, retval, errret) \
319283
({ \
@@ -430,29 +394,6 @@ struct __large_struct { unsigned long buf[100]; };
430394
retval = __put_user_failed(x, addr, itype, rtype, ltype, errret); \
431395
} while (0)
432396

433-
#define __put_user_asm_ex(x, addr, itype, rtype, ltype) \
434-
asm volatile("1: mov"itype" %"rtype"0,%1\n" \
435-
"2:\n" \
436-
_ASM_EXTABLE_EX(1b, 2b) \
437-
: : ltype(x), "m" (__m(addr)))
438-
439-
/*
440-
* uaccess_try and catch
441-
*/
442-
#define uaccess_try do { \
443-
current->thread.uaccess_err = 0; \
444-
__uaccess_begin(); \
445-
barrier();
446-
447-
#define uaccess_try_nospec do { \
448-
current->thread.uaccess_err = 0; \
449-
__uaccess_begin_nospec(); \
450-
451-
#define uaccess_catch(err) \
452-
__uaccess_end(); \
453-
(err) |= (current->thread.uaccess_err ? -EFAULT : 0); \
454-
} while (0)
455-
456397
/**
457398
* __get_user - Get a simple variable from user space, with less checking.
458399
* @x: Variable to store result.
@@ -502,12 +443,6 @@ struct __large_struct { unsigned long buf[100]; };
502443
#define __put_user(x, ptr) \
503444
__put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
504445

505-
#define put_user_try uaccess_try
506-
#define put_user_catch(err) uaccess_catch(err)
507-
508-
#define put_user_ex(x, ptr) \
509-
__put_user_size_ex((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
510-
511446
extern unsigned long
512447
copy_from_user_nmi(void *to, const void __user *from, unsigned long n);
513448
extern __must_check long

arch/x86/mm/extable.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,6 @@ __visible bool ex_handler_uaccess(const struct exception_table_entry *fixup,
8080
}
8181
EXPORT_SYMBOL(ex_handler_uaccess);
8282

83-
__visible bool ex_handler_ext(const struct exception_table_entry *fixup,
84-
struct pt_regs *regs, int trapnr,
85-
unsigned long error_code,
86-
unsigned long fault_addr)
87-
{
88-
/* Special hack for uaccess_err */
89-
current->thread.uaccess_err = 1;
90-
regs->ip = ex_fixup_addr(fixup);
91-
return true;
92-
}
93-
EXPORT_SYMBOL(ex_handler_ext);
94-
9583
__visible bool ex_handler_rdmsr_unsafe(const struct exception_table_entry *fixup,
9684
struct pt_regs *regs, int trapnr,
9785
unsigned long error_code,

0 commit comments

Comments
 (0)