Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'work.uaccess2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull uaccess.h prepwork from Al Viro:
"Preparations to tree-wide switch to use of linux/uaccess.h (which,
obviously, will allow to start unifying stuff for real). The last step
there, ie

PATT='^[[:blank:]]*#[[:blank:]]*include[[:blank:]]*<asm/uaccess.h>'
sed -i -e "s!$PATT!#include <linux/uaccess.h>!" \
`git grep -l "$PATT"|grep -v ^include/linux/uaccess.h`

is not taken here - I would prefer to do it once just before or just
after -rc1. However, everything should be ready for it"

* 'work.uaccess2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
remove a stray reference to asm/uaccess.h in docs
sparc64: separate extable_64.h, switch elf_64.h to it
score: separate extable.h, switch module.h to it
mips: separate extable.h, switch module.h to it
x86: separate extable.h, switch sections.h to it
remove stray include of asm/uaccess.h from cacheflush.h
mn10300: remove a bogus processor.h->uaccess.h include
xtensa: split uaccess.h into C and asm sides
bonding: quit messing with IOCTL
kill __kernel_ds_p off
mn10300: finish verify_area() off
frv: move HAVE_ARCH_UNMAPPED_AREA to pgtable.h
exceptions: detritus removal

+262 -270
+1 -1
Documentation/DocBook/kernel-hacking.tmpl
··· 483 483 <function>get_user()</function> 484 484 / 485 485 <function>put_user()</function> 486 - <filename class="headerfile">include/asm/uaccess.h</filename> 486 + <filename class="headerfile">include/linux/uaccess.h</filename> 487 487 </title> 488 488 489 489 <para>
-1
arch/arm/mm/fault.h
··· 23 23 #endif 24 24 25 25 void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs); 26 - unsigned long search_exception_table(unsigned long addr); 27 26 void early_abt_enable(void); 28 27 29 28 #endif /* __ARCH_ARM_FAULT_H */
+1
arch/frv/include/asm/pgtable.h
··· 522 522 #ifndef __ASSEMBLY__ 523 523 extern void __init paging_init(void); 524 524 #endif /* !__ASSEMBLY__ */ 525 + #define HAVE_ARCH_UNMAPPED_AREA 525 526 526 527 #endif /* _ASM_PGTABLE_H */
-1
arch/frv/include/asm/segment.h
··· 32 32 #define get_ds() (KERNEL_DS) 33 33 #define get_fs() (__current_thread_info->addr_limit) 34 34 #define segment_eq(a, b) ((a).seg == (b).seg) 35 - #define __kernel_ds_p() segment_eq(get_fs(), KERNEL_DS) 36 35 #define get_addr_limit() (get_fs().seg) 37 36 38 37 #define set_fs(_x) \
-2
arch/frv/include/asm/uaccess.h
··· 20 20 #include <asm/segment.h> 21 21 #include <asm/sections.h> 22 22 23 - #define HAVE_ARCH_UNMAPPED_AREA /* we decide where to put mmaps */ 24 - 25 23 #define __ptr(x) ((unsigned long __force *)(x)) 26 24 27 25 #define VERIFY_READ 0
-3
arch/m68k/include/asm/uaccess_no.h
··· 44 44 unsigned long insn, fixup; 45 45 }; 46 46 47 - /* Returns 0 if exception not found and fixup otherwise. */ 48 - extern unsigned long search_exception_table(unsigned long); 49 - 50 47 51 48 /* 52 49 * These are the main single-value transfer routines. They automatically
-3
arch/microblaze/include/asm/uaccess.h
··· 71 71 unsigned long insn, fixup; 72 72 }; 73 73 74 - /* Returns 0 if exception not found and fixup otherwise. */ 75 - extern unsigned long search_exception_table(unsigned long); 76 - 77 74 #ifndef CONFIG_MMU 78 75 79 76 /* Check against bounds of physical memory */
+13
arch/mips/include/asm/extable.h
··· 1 + #ifndef _ASM_EXTABLE_H 2 + #define _ASM_EXTABLE_H 3 + 4 + struct exception_table_entry 5 + { 6 + unsigned long insn; 7 + unsigned long nextinsn; 8 + }; 9 + 10 + struct pt_regs; 11 + extern int fixup_exception(struct pt_regs *regs); 12 + 13 + #endif
+1 -1
arch/mips/include/asm/module.h
··· 3 3 4 4 #include <linux/list.h> 5 5 #include <linux/elf.h> 6 - #include <asm/uaccess.h> 6 + #include <asm/extable.h> 7 7 8 8 struct mod_arch_specific { 9 9 /* Data Bus Error exception tables */
+1 -8
arch/mips/include/asm/uaccess.h
··· 16 16 #include <linux/thread_info.h> 17 17 #include <linux/string.h> 18 18 #include <asm/asm-eva.h> 19 + #include <asm/extable.h> 19 20 20 21 /* 21 22 * The fs value determines whether argument validity checking should be ··· 1485 1484 1486 1485 return res; 1487 1486 } 1488 - 1489 - struct exception_table_entry 1490 - { 1491 - unsigned long insn; 1492 - unsigned long nextinsn; 1493 - }; 1494 - 1495 - extern int fixup_exception(struct pt_regs *regs); 1496 1487 1497 1488 #endif /* _ASM_UACCESS_H */
+1
arch/mips/lasat/picvue_proc.c
··· 16 16 17 17 #include <linux/timer.h> 18 18 #include <linux/mutex.h> 19 + #include <linux/uaccess.h> 19 20 20 21 #include "picvue.h" 21 22
-1
arch/mn10300/include/asm/processor.h
··· 18 18 #include <asm/page.h> 19 19 #include <asm/ptrace.h> 20 20 #include <asm/cpu-regs.h> 21 - #include <asm/uaccess.h> 22 21 #include <asm/current.h> 23 22 24 23 /* Forward declaration, a strange C thing */
-7
arch/mn10300/include/asm/uaccess.h
··· 38 38 #define get_ds() (KERNEL_DS) 39 39 #define get_fs() (current_thread_info()->addr_limit) 40 40 #define set_fs(x) (current_thread_info()->addr_limit = (x)) 41 - #define __kernel_ds_p() (current_thread_info()->addr_limit.seg == 0x9FFFFFFF) 42 41 43 42 #define segment_eq(a, b) ((a).seg == (b).seg) 44 43 ··· 70 71 71 72 #define access_ok(type, addr, size) (__range_ok((addr), (size)) == 0) 72 73 #define __access_ok(addr, size) (__range_ok((addr), (size)) == 0) 73 - 74 - static inline int verify_area(int type, const void *addr, unsigned long size) 75 - { 76 - return access_ok(type, addr, size) ? 0 : -EFAULT; 77 - } 78 - 79 74 80 75 /* 81 76 * The exception table consists of pairs of addresses: the first is the
+3 -3
arch/mn10300/kernel/signal.c
··· 75 75 struct fpucontext *buf; 76 76 err |= __get_user(buf, &sc->fpucontext); 77 77 if (buf) { 78 - if (verify_area(VERIFY_READ, buf, sizeof(*buf))) 78 + if (!access_ok(VERIFY_READ, buf, sizeof(*buf))) 79 79 goto badframe; 80 80 err |= fpu_restore_sigcontext(buf); 81 81 } ··· 98 98 long d0; 99 99 100 100 frame = (struct sigframe __user *) current_frame()->sp; 101 - if (verify_area(VERIFY_READ, frame, sizeof(*frame))) 101 + if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 102 102 goto badframe; 103 103 if (__get_user(set.sig[0], &frame->sc.oldmask)) 104 104 goto badframe; ··· 130 130 long d0; 131 131 132 132 frame = (struct rt_sigframe __user *) current_frame()->sp; 133 - if (verify_area(VERIFY_READ, frame, sizeof(*frame))) 133 + if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 134 134 goto badframe; 135 135 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 136 136 goto badframe;
-4
arch/openrisc/include/asm/uaccess.h
··· 82 82 unsigned long insn, fixup; 83 83 }; 84 84 85 - /* Returns 0 if exception not found and fixup otherwise. */ 86 - extern unsigned long search_exception_table(unsigned long); 87 - extern void sort_exception_table(void); 88 - 89 85 /* 90 86 * These are the main single-value transfer routines. They automatically 91 87 * use the right size if we just have the right pointer type.
+11
arch/score/include/asm/extable.h
··· 1 + #ifndef _ASM_SCORE_EXTABLE_H 2 + #define _ASM_SCORE_EXTABLE_H 3 + 4 + struct exception_table_entry { 5 + unsigned long insn; 6 + unsigned long fixup; 7 + }; 8 + 9 + struct pt_regs; 10 + extern int fixup_exception(struct pt_regs *regs); 11 + #endif
+1 -1
arch/score/include/asm/module.h
··· 2 2 #define _ASM_SCORE_MODULE_H 3 3 4 4 #include <linux/list.h> 5 - #include <asm/uaccess.h> 5 + #include <asm/extable.h> 6 6 #include <asm-generic/module.h> 7 7 8 8 struct mod_arch_specific {
+1 -7
arch/score/include/asm/uaccess.h
··· 4 4 #include <linux/kernel.h> 5 5 #include <linux/errno.h> 6 6 #include <linux/thread_info.h> 7 + #include <asm/extable.h> 7 8 8 9 #define VERIFY_READ 0 9 10 #define VERIFY_WRITE 1 ··· 420 419 else 421 420 return __strnlen_user(str, len); 422 421 } 423 - 424 - struct exception_table_entry { 425 - unsigned long insn; 426 - unsigned long fixup; 427 - }; 428 - 429 - extern int fixup_exception(struct pt_regs *regs); 430 422 431 423 #endif /* __SCORE_UACCESS_H */ 432 424
-2
arch/sh/include/asm/uaccess.h
··· 192 192 #endif 193 193 194 194 int fixup_exception(struct pt_regs *regs); 195 - /* Returns 0 if exception not found and fixup.unit otherwise. */ 196 - unsigned long search_exception_table(unsigned long addr); 197 195 const struct exception_table_entry *search_exception_tables(unsigned long addr); 198 196 199 197 extern void *set_exception_table_vec(unsigned int vec, void *handler);
+1 -1
arch/sparc/include/asm/elf_64.h
··· 7 7 8 8 #include <asm/ptrace.h> 9 9 #include <asm/processor.h> 10 - #include <asm/uaccess.h> 10 + #include <asm/extable_64.h> 11 11 #include <asm/spitfire.h> 12 12 13 13 /*
+20
arch/sparc/include/asm/extable_64.h
··· 1 + #ifndef __ASM_EXTABLE64_H 2 + #define __ASM_EXTABLE64_H 3 + /* 4 + * The exception table consists of pairs of addresses: the first is the 5 + * address of an instruction that is allowed to fault, and the second is 6 + * the address at which the program should continue. No registers are 7 + * modified, so it is entirely up to the continuation code to figure out 8 + * what to do. 9 + * 10 + * All the routines below use bits of fixup code that are out of line 11 + * with the main instruction path. This means when everything is well, 12 + * we don't even have to jump over them. Further, they do not intrude 13 + * on our cache or tlb entries. 14 + */ 15 + 16 + struct exception_table_entry { 17 + unsigned int insn, fixup; 18 + }; 19 + 20 + #endif
+1 -17
arch/sparc/include/asm/uaccess_64.h
··· 13 13 #include <asm/asi.h> 14 14 #include <asm/spitfire.h> 15 15 #include <asm-generic/uaccess-unaligned.h> 16 + #include <asm/extable_64.h> 16 17 #endif 17 18 18 19 #ifndef __ASSEMBLY__ ··· 81 80 { 82 81 return 1; 83 82 } 84 - 85 - /* 86 - * The exception table consists of pairs of addresses: the first is the 87 - * address of an instruction that is allowed to fault, and the second is 88 - * the address at which the program should continue. No registers are 89 - * modified, so it is entirely up to the continuation code to figure out 90 - * what to do. 91 - * 92 - * All the routines below use bits of fixup code that are out of line 93 - * with the main instruction path. This means when everything is well, 94 - * we don't even have to jump over them. Further, they do not intrude 95 - * on our cache or tlb entries. 96 - */ 97 - 98 - struct exception_table_entry { 99 - unsigned int insn, fixup; 100 - }; 101 83 102 84 void __ret_efault(void); 103 85 void __retl_efault(void);
-1
arch/x86/include/asm/cacheflush.h
··· 4 4 /* Caches aren't brain-dead on the intel. */ 5 5 #include <asm-generic/cacheflush.h> 6 6 #include <asm/special_insns.h> 7 - #include <asm/uaccess.h> 8 7 9 8 /* 10 9 * The set_memory_* API can be used to change various attributes of a virtual
+35
arch/x86/include/asm/extable.h
··· 1 + #ifndef _ASM_X86_EXTABLE_H 2 + #define _ASM_X86_EXTABLE_H 3 + /* 4 + * The exception table consists of triples of addresses relative to the 5 + * exception table entry itself. The first address is of an instruction 6 + * that is allowed to fault, the second is the target at which the program 7 + * should continue. The third is a handler function to deal with the fault 8 + * caused by the instruction in the first field. 9 + * 10 + * All the routines below use bits of fixup code that are out of line 11 + * with the main instruction path. This means when everything is well, 12 + * we don't even have to jump over them. Further, they do not intrude 13 + * on our cache or tlb entries. 14 + */ 15 + 16 + struct exception_table_entry { 17 + int insn, fixup, handler; 18 + }; 19 + struct pt_regs; 20 + 21 + #define ARCH_HAS_RELATIVE_EXTABLE 22 + 23 + #define swap_ex_entry_fixup(a, b, tmp, delta) \ 24 + do { \ 25 + (a)->fixup = (b)->fixup + (delta); \ 26 + (b)->fixup = (tmp).fixup - (delta); \ 27 + (a)->handler = (b)->handler + (delta); \ 28 + (b)->handler = (tmp).handler - (delta); \ 29 + } while (0) 30 + 31 + extern int fixup_exception(struct pt_regs *regs, int trapnr); 32 + extern bool ex_has_fault_handler(unsigned long ip); 33 + extern void early_fixup_exception(struct pt_regs *regs, int trapnr); 34 + 35 + #endif
+1 -1
arch/x86/include/asm/sections.h
··· 2 2 #define _ASM_X86_SECTIONS_H 3 3 4 4 #include <asm-generic/sections.h> 5 - #include <asm/uaccess.h> 5 + #include <asm/extable.h> 6 6 7 7 extern char __brk_base[], __brk_limit[]; 8 8 extern struct exception_table_entry __stop___ex_table[];
+1 -31
arch/x86/include/asm/uaccess.h
··· 11 11 #include <asm/asm.h> 12 12 #include <asm/page.h> 13 13 #include <asm/smap.h> 14 + #include <asm/extable.h> 14 15 15 16 #define VERIFY_READ 0 16 17 #define VERIFY_WRITE 1 ··· 90 89 */ 91 90 #define access_ok(type, addr, size) \ 92 91 likely(!__range_not_ok(addr, size, user_addr_max())) 93 - 94 - /* 95 - * The exception table consists of triples of addresses relative to the 96 - * exception table entry itself. The first address is of an instruction 97 - * that is allowed to fault, the second is the target at which the program 98 - * should continue. The third is a handler function to deal with the fault 99 - * caused by the instruction in the first field. 100 - * 101 - * All the routines below use bits of fixup code that are out of line 102 - * with the main instruction path. This means when everything is well, 103 - * we don't even have to jump over them. Further, they do not intrude 104 - * on our cache or tlb entries. 105 - */ 106 - 107 - struct exception_table_entry { 108 - int insn, fixup, handler; 109 - }; 110 - 111 - #define ARCH_HAS_RELATIVE_EXTABLE 112 - 113 - #define swap_ex_entry_fixup(a, b, tmp, delta) \ 114 - do { \ 115 - (a)->fixup = (b)->fixup + (delta); \ 116 - (b)->fixup = (tmp).fixup - (delta); \ 117 - (a)->handler = (b)->handler + (delta); \ 118 - (b)->handler = (tmp).handler - (delta); \ 119 - } while (0) 120 - 121 - extern int fixup_exception(struct pt_regs *regs, int trapnr); 122 - extern bool ex_has_fault_handler(unsigned long ip); 123 - extern void early_fixup_exception(struct pt_regs *regs, int trapnr); 124 92 125 93 /* 126 94 * These are the main single-value transfer routines. They automatically
+1 -1
arch/x86/mm/fault.c
··· 5 5 */ 6 6 #include <linux/sched.h> /* test_thread_flag(), ... */ 7 7 #include <linux/kdebug.h> /* oops_begin/end, ... */ 8 - #include <linux/extable.h> /* search_exception_table */ 8 + #include <linux/extable.h> /* search_exception_tables */ 9 9 #include <linux/bootmem.h> /* max_low_pfn */ 10 10 #include <linux/kprobes.h> /* NOKPROBE_SYMBOL, ... */ 11 11 #include <linux/mmiotrace.h> /* kmmio_handler, ... */
+160
arch/xtensa/include/asm/asm-uaccess.h
··· 1 + /* 2 + * include/asm-xtensa/uaccess.h 3 + * 4 + * User space memory access functions 5 + * 6 + * These routines provide basic accessing functions to the user memory 7 + * space for the kernel. This header file provides functions such as: 8 + * 9 + * This file is subject to the terms and conditions of the GNU General Public 10 + * License. See the file "COPYING" in the main directory of this archive 11 + * for more details. 12 + * 13 + * Copyright (C) 2001 - 2005 Tensilica Inc. 14 + */ 15 + 16 + #ifndef _XTENSA_ASM_UACCESS_H 17 + #define _XTENSA_ASM_UACCESS_H 18 + 19 + #include <linux/errno.h> 20 + #include <asm/types.h> 21 + 22 + #define VERIFY_READ 0 23 + #define VERIFY_WRITE 1 24 + 25 + #include <asm/current.h> 26 + #include <asm/asm-offsets.h> 27 + #include <asm/processor.h> 28 + 29 + /* 30 + * These assembly macros mirror the C macros in asm/uaccess.h. They 31 + * should always have identical functionality. See 32 + * arch/xtensa/kernel/sys.S for usage. 33 + */ 34 + 35 + #define KERNEL_DS 0 36 + #define USER_DS 1 37 + 38 + #define get_ds (KERNEL_DS) 39 + 40 + /* 41 + * get_fs reads current->thread.current_ds into a register. 42 + * On Entry: 43 + * <ad> anything 44 + * <sp> stack 45 + * On Exit: 46 + * <ad> contains current->thread.current_ds 47 + */ 48 + .macro get_fs ad, sp 49 + GET_CURRENT(\ad,\sp) 50 + #if THREAD_CURRENT_DS > 1020 51 + addi \ad, \ad, TASK_THREAD 52 + l32i \ad, \ad, THREAD_CURRENT_DS - TASK_THREAD 53 + #else 54 + l32i \ad, \ad, THREAD_CURRENT_DS 55 + #endif 56 + .endm 57 + 58 + /* 59 + * set_fs sets current->thread.current_ds to some value. 60 + * On Entry: 61 + * <at> anything (temp register) 62 + * <av> value to write 63 + * <sp> stack 64 + * On Exit: 65 + * <at> destroyed (actually, current) 66 + * <av> preserved, value to write 67 + */ 68 + .macro set_fs at, av, sp 69 + GET_CURRENT(\at,\sp) 70 + s32i \av, \at, THREAD_CURRENT_DS 71 + .endm 72 + 73 + /* 74 + * kernel_ok determines whether we should bypass addr/size checking. 75 + * See the equivalent C-macro version below for clarity. 76 + * On success, kernel_ok branches to a label indicated by parameter 77 + * <success>. This implies that the macro falls through to the next 78 + * insruction on an error. 79 + * 80 + * Note that while this macro can be used independently, we designed 81 + * in for optimal use in the access_ok macro below (i.e., we fall 82 + * through on error). 83 + * 84 + * On Entry: 85 + * <at> anything (temp register) 86 + * <success> label to branch to on success; implies 87 + * fall-through macro on error 88 + * <sp> stack pointer 89 + * On Exit: 90 + * <at> destroyed (actually, current->thread.current_ds) 91 + */ 92 + 93 + #if ((KERNEL_DS != 0) || (USER_DS == 0)) 94 + # error Assembly macro kernel_ok fails 95 + #endif 96 + .macro kernel_ok at, sp, success 97 + get_fs \at, \sp 98 + beqz \at, \success 99 + .endm 100 + 101 + /* 102 + * user_ok determines whether the access to user-space memory is allowed. 103 + * See the equivalent C-macro version below for clarity. 104 + * 105 + * On error, user_ok branches to a label indicated by parameter 106 + * <error>. This implies that the macro falls through to the next 107 + * instruction on success. 108 + * 109 + * Note that while this macro can be used independently, we designed 110 + * in for optimal use in the access_ok macro below (i.e., we fall 111 + * through on success). 112 + * 113 + * On Entry: 114 + * <aa> register containing memory address 115 + * <as> register containing memory size 116 + * <at> temp register 117 + * <error> label to branch to on error; implies fall-through 118 + * macro on success 119 + * On Exit: 120 + * <aa> preserved 121 + * <as> preserved 122 + * <at> destroyed (actually, (TASK_SIZE + 1 - size)) 123 + */ 124 + .macro user_ok aa, as, at, error 125 + movi \at, __XTENSA_UL_CONST(TASK_SIZE) 126 + bgeu \as, \at, \error 127 + sub \at, \at, \as 128 + bgeu \aa, \at, \error 129 + .endm 130 + 131 + /* 132 + * access_ok determines whether a memory access is allowed. See the 133 + * equivalent C-macro version below for clarity. 134 + * 135 + * On error, access_ok branches to a label indicated by parameter 136 + * <error>. This implies that the macro falls through to the next 137 + * instruction on success. 138 + * 139 + * Note that we assume success is the common case, and we optimize the 140 + * branch fall-through case on success. 141 + * 142 + * On Entry: 143 + * <aa> register containing memory address 144 + * <as> register containing memory size 145 + * <at> temp register 146 + * <sp> 147 + * <error> label to branch to on error; implies fall-through 148 + * macro on success 149 + * On Exit: 150 + * <aa> preserved 151 + * <as> preserved 152 + * <at> destroyed 153 + */ 154 + .macro access_ok aa, as, at, sp, error 155 + kernel_ok \at, \sp, .Laccess_ok_\@ 156 + user_ok \aa, \as, \at, \error 157 + .Laccess_ok_\@: 158 + .endm 159 + 160 + #endif /* _XTENSA_ASM_UACCESS_H */
-153
arch/xtensa/include/asm/uaccess.h
··· 17 17 #define _XTENSA_UACCESS_H 18 18 19 19 #include <linux/errno.h> 20 - #ifndef __ASSEMBLY__ 21 20 #include <linux/prefetch.h> 22 - #endif 23 21 #include <asm/types.h> 24 22 25 23 #define VERIFY_READ 0 26 24 #define VERIFY_WRITE 1 27 - 28 - #ifdef __ASSEMBLY__ 29 - 30 - #include <asm/current.h> 31 - #include <asm/asm-offsets.h> 32 - #include <asm/processor.h> 33 - 34 - /* 35 - * These assembly macros mirror the C macros that follow below. They 36 - * should always have identical functionality. See 37 - * arch/xtensa/kernel/sys.S for usage. 38 - */ 39 - 40 - #define KERNEL_DS 0 41 - #define USER_DS 1 42 - 43 - #define get_ds (KERNEL_DS) 44 - 45 - /* 46 - * get_fs reads current->thread.current_ds into a register. 47 - * On Entry: 48 - * <ad> anything 49 - * <sp> stack 50 - * On Exit: 51 - * <ad> contains current->thread.current_ds 52 - */ 53 - .macro get_fs ad, sp 54 - GET_CURRENT(\ad,\sp) 55 - #if THREAD_CURRENT_DS > 1020 56 - addi \ad, \ad, TASK_THREAD 57 - l32i \ad, \ad, THREAD_CURRENT_DS - TASK_THREAD 58 - #else 59 - l32i \ad, \ad, THREAD_CURRENT_DS 60 - #endif 61 - .endm 62 - 63 - /* 64 - * set_fs sets current->thread.current_ds to some value. 65 - * On Entry: 66 - * <at> anything (temp register) 67 - * <av> value to write 68 - * <sp> stack 69 - * On Exit: 70 - * <at> destroyed (actually, current) 71 - * <av> preserved, value to write 72 - */ 73 - .macro set_fs at, av, sp 74 - GET_CURRENT(\at,\sp) 75 - s32i \av, \at, THREAD_CURRENT_DS 76 - .endm 77 - 78 - /* 79 - * kernel_ok determines whether we should bypass addr/size checking. 80 - * See the equivalent C-macro version below for clarity. 81 - * On success, kernel_ok branches to a label indicated by parameter 82 - * <success>. This implies that the macro falls through to the next 83 - * insruction on an error. 84 - * 85 - * Note that while this macro can be used independently, we designed 86 - * in for optimal use in the access_ok macro below (i.e., we fall 87 - * through on error). 88 - * 89 - * On Entry: 90 - * <at> anything (temp register) 91 - * <success> label to branch to on success; implies 92 - * fall-through macro on error 93 - * <sp> stack pointer 94 - * On Exit: 95 - * <at> destroyed (actually, current->thread.current_ds) 96 - */ 97 - 98 - #if ((KERNEL_DS != 0) || (USER_DS == 0)) 99 - # error Assembly macro kernel_ok fails 100 - #endif 101 - .macro kernel_ok at, sp, success 102 - get_fs \at, \sp 103 - beqz \at, \success 104 - .endm 105 - 106 - /* 107 - * user_ok determines whether the access to user-space memory is allowed. 108 - * See the equivalent C-macro version below for clarity. 109 - * 110 - * On error, user_ok branches to a label indicated by parameter 111 - * <error>. This implies that the macro falls through to the next 112 - * instruction on success. 113 - * 114 - * Note that while this macro can be used independently, we designed 115 - * in for optimal use in the access_ok macro below (i.e., we fall 116 - * through on success). 117 - * 118 - * On Entry: 119 - * <aa> register containing memory address 120 - * <as> register containing memory size 121 - * <at> temp register 122 - * <error> label to branch to on error; implies fall-through 123 - * macro on success 124 - * On Exit: 125 - * <aa> preserved 126 - * <as> preserved 127 - * <at> destroyed (actually, (TASK_SIZE + 1 - size)) 128 - */ 129 - .macro user_ok aa, as, at, error 130 - movi \at, __XTENSA_UL_CONST(TASK_SIZE) 131 - bgeu \as, \at, \error 132 - sub \at, \at, \as 133 - bgeu \aa, \at, \error 134 - .endm 135 - 136 - /* 137 - * access_ok determines whether a memory access is allowed. See the 138 - * equivalent C-macro version below for clarity. 139 - * 140 - * On error, access_ok branches to a label indicated by parameter 141 - * <error>. This implies that the macro falls through to the next 142 - * instruction on success. 143 - * 144 - * Note that we assume success is the common case, and we optimize the 145 - * branch fall-through case on success. 146 - * 147 - * On Entry: 148 - * <aa> register containing memory address 149 - * <as> register containing memory size 150 - * <at> temp register 151 - * <sp> 152 - * <error> label to branch to on error; implies fall-through 153 - * macro on success 154 - * On Exit: 155 - * <aa> preserved 156 - * <as> preserved 157 - * <at> destroyed 158 - */ 159 - .macro access_ok aa, as, at, sp, error 160 - kernel_ok \at, \sp, .Laccess_ok_\@ 161 - user_ok \aa, \as, \at, \error 162 - .Laccess_ok_\@: 163 - .endm 164 - 165 - #else /* __ASSEMBLY__ not defined */ 166 25 167 26 #include <linux/sched.h> 168 27 ··· 354 495 unsigned long insn, fixup; 355 496 }; 356 497 357 - /* Returns 0 if exception not found and fixup.unit otherwise. */ 358 - 359 - extern unsigned long search_exception_table(unsigned long addr); 360 - extern void sort_exception_table(void); 361 - 362 - /* Returns the new pc */ 363 - #define fixup_exception(map_reg, fixup_unit, pc) \ 364 - ({ \ 365 - fixup_unit; \ 366 - }) 367 - 368 - #endif /* __ASSEMBLY__ */ 369 498 #endif /* _XTENSA_UACCESS_H */
+1 -1
arch/xtensa/kernel/coprocessor.S
··· 17 17 #include <asm/processor.h> 18 18 #include <asm/coprocessor.h> 19 19 #include <asm/thread_info.h> 20 - #include <asm/uaccess.h> 20 + #include <asm/asm-uaccess.h> 21 21 #include <asm/unistd.h> 22 22 #include <asm/ptrace.h> 23 23 #include <asm/current.h>
+1 -1
arch/xtensa/kernel/entry.S
··· 17 17 #include <asm/processor.h> 18 18 #include <asm/coprocessor.h> 19 19 #include <asm/thread_info.h> 20 - #include <asm/uaccess.h> 20 + #include <asm/asm-uaccess.h> 21 21 #include <asm/unistd.h> 22 22 #include <asm/ptrace.h> 23 23 #include <asm/current.h>
+1
drivers/char/tb0219.c
··· 21 21 #include <linux/fs.h> 22 22 #include <linux/init.h> 23 23 #include <linux/module.h> 24 + #include <linux/uaccess.h> 24 25 25 26 #include <asm/io.h> 26 27 #include <asm/reboot.h>
+2 -2
drivers/net/bonding/bond_main.c
··· 471 471 /* Yes, the mii is overlaid on the ifreq.ifr_ifru */ 472 472 strncpy(ifr.ifr_name, slave_dev->name, IFNAMSIZ); 473 473 mii = if_mii(&ifr); 474 - if (IOCTL(slave_dev, &ifr, SIOCGMIIPHY) == 0) { 474 + if (ioctl(slave_dev, &ifr, SIOCGMIIPHY) == 0) { 475 475 mii->reg_num = MII_BMSR; 476 - if (IOCTL(slave_dev, &ifr, SIOCGMIIREG) == 0) 476 + if (ioctl(slave_dev, &ifr, SIOCGMIIREG) == 0) 477 477 return mii->val_out & BMSR_LSTATUS; 478 478 } 479 479 }
+1
drivers/platform/x86/dell-smo8800.c
··· 24 24 #include <linux/acpi.h> 25 25 #include <linux/interrupt.h> 26 26 #include <linux/miscdevice.h> 27 + #include <linux/uaccess.h> 27 28 28 29 struct smo8800_device { 29 30 u32 irq; /* acpi device irq */
+1
drivers/video/fbdev/au1200fb.c
··· 43 43 #include <linux/ctype.h> 44 44 #include <linux/dma-mapping.h> 45 45 #include <linux/slab.h> 46 + #include <linux/uaccess.h> 46 47 47 48 #include <asm/mach-au1x00/au1000.h> 48 49 #include <asm/mach-au1x00/au1200fb.h> /* platform_data */
+1
drivers/watchdog/ath79_wdt.c
··· 35 35 #include <linux/err.h> 36 36 #include <linux/of.h> 37 37 #include <linux/of_platform.h> 38 + #include <linux/uaccess.h> 38 39 39 40 #define DRIVER_NAME "ath79-wdt" 40 41
-4
include/asm-generic/uaccess.h
··· 69 69 unsigned long insn, fixup; 70 70 }; 71 71 72 - /* Returns 0 if exception not found and fixup otherwise. */ 73 - extern unsigned long search_exception_table(unsigned long); 74 - 75 - 76 72 /* 77 73 * architectures with an MMU should override these two 78 74 */
-12
include/net/bonding.h
··· 37 37 #ifndef __long_aligned 38 38 #define __long_aligned __attribute__((aligned((sizeof(long))))) 39 39 #endif 40 - /* 41 - * Less bad way to call ioctl from within the kernel; this needs to be 42 - * done some other way to get the call out of interrupt context. 43 - * Needs "ioctl" variable to be supplied by calling context. 44 - */ 45 - #define IOCTL(dev, arg, cmd) ({ \ 46 - int res = 0; \ 47 - mm_segment_t fs = get_fs(); \ 48 - set_fs(get_ds()); \ 49 - res = ioctl(dev, arg, cmd); \ 50 - set_fs(fs); \ 51 - res; }) 52 40 53 41 #define BOND_MODE(bond) ((bond)->params.mode) 54 42