diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-12 02:38:39 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-12 02:38:39 -0400 |
| commit | 4cdf8dbe2d4b3891a9abd9f9ec32acbe58de0cf6 (patch) | |
| tree | 006204597d8aab019a8831da3f38556ca9dcaab1 | |
| parent | 6b25e21fa6f26d0f0d45f161d169029411c84286 (diff) | |
| parent | aa7eb9ad32f84ce91a92f5c0196ae7adb5611ac4 (diff) | |
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
38 files changed, 262 insertions, 270 deletions
diff --git a/Documentation/DocBook/kernel-hacking.tmpl b/Documentation/DocBook/kernel-hacking.tmpl index 589b40cc5eb5..2a272275c81b 100644 --- a/Documentation/DocBook/kernel-hacking.tmpl +++ b/Documentation/DocBook/kernel-hacking.tmpl | |||
| @@ -483,7 +483,7 @@ printk(KERN_INFO "my ip: %pI4\n", &ipaddress); | |||
| 483 | <function>get_user()</function> | 483 | <function>get_user()</function> |
| 484 | / | 484 | / |
| 485 | <function>put_user()</function> | 485 | <function>put_user()</function> |
| 486 | <filename class="headerfile">include/asm/uaccess.h</filename> | 486 | <filename class="headerfile">include/linux/uaccess.h</filename> |
| 487 | </title> | 487 | </title> |
| 488 | 488 | ||
| 489 | <para> | 489 | <para> |
diff --git a/arch/arm/mm/fault.h b/arch/arm/mm/fault.h index 05ec5e0df32d..67532f242271 100644 --- a/arch/arm/mm/fault.h +++ b/arch/arm/mm/fault.h | |||
| @@ -23,7 +23,6 @@ static inline int fsr_fs(unsigned int fsr) | |||
| 23 | #endif | 23 | #endif |
| 24 | 24 | ||
| 25 | void do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs); | 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 | void early_abt_enable(void); | 26 | void early_abt_enable(void); |
| 28 | 27 | ||
| 29 | #endif /* __ARCH_ARM_FAULT_H */ | 28 | #endif /* __ARCH_ARM_FAULT_H */ |
diff --git a/arch/frv/include/asm/pgtable.h b/arch/frv/include/asm/pgtable.h index 07d7a7ef8bd5..a0513d463a1f 100644 --- a/arch/frv/include/asm/pgtable.h +++ b/arch/frv/include/asm/pgtable.h | |||
| @@ -522,5 +522,6 @@ extern void __init pgtable_cache_init(void); | |||
| 522 | #ifndef __ASSEMBLY__ | 522 | #ifndef __ASSEMBLY__ |
| 523 | extern void __init paging_init(void); | 523 | extern void __init paging_init(void); |
| 524 | #endif /* !__ASSEMBLY__ */ | 524 | #endif /* !__ASSEMBLY__ */ |
| 525 | #define HAVE_ARCH_UNMAPPED_AREA | ||
| 525 | 526 | ||
| 526 | #endif /* _ASM_PGTABLE_H */ | 527 | #endif /* _ASM_PGTABLE_H */ |
diff --git a/arch/frv/include/asm/segment.h b/arch/frv/include/asm/segment.h index 4377c89a57f5..2305142d4cf8 100644 --- a/arch/frv/include/asm/segment.h +++ b/arch/frv/include/asm/segment.h | |||
| @@ -32,7 +32,6 @@ typedef struct { | |||
| 32 | #define get_ds() (KERNEL_DS) | 32 | #define get_ds() (KERNEL_DS) |
| 33 | #define get_fs() (__current_thread_info->addr_limit) | 33 | #define get_fs() (__current_thread_info->addr_limit) |
| 34 | #define segment_eq(a, b) ((a).seg == (b).seg) | 34 | #define segment_eq(a, b) ((a).seg == (b).seg) |
| 35 | #define __kernel_ds_p() segment_eq(get_fs(), KERNEL_DS) | ||
| 36 | #define get_addr_limit() (get_fs().seg) | 35 | #define get_addr_limit() (get_fs().seg) |
| 37 | 36 | ||
| 38 | #define set_fs(_x) \ | 37 | #define set_fs(_x) \ |
diff --git a/arch/frv/include/asm/uaccess.h b/arch/frv/include/asm/uaccess.h index 87d9e34c5df8..c0f4057eab60 100644 --- a/arch/frv/include/asm/uaccess.h +++ b/arch/frv/include/asm/uaccess.h | |||
| @@ -20,8 +20,6 @@ | |||
| 20 | #include <asm/segment.h> | 20 | #include <asm/segment.h> |
| 21 | #include <asm/sections.h> | 21 | #include <asm/sections.h> |
| 22 | 22 | ||
| 23 | #define HAVE_ARCH_UNMAPPED_AREA /* we decide where to put mmaps */ | ||
| 24 | |||
| 25 | #define __ptr(x) ((unsigned long __force *)(x)) | 23 | #define __ptr(x) ((unsigned long __force *)(x)) |
| 26 | 24 | ||
| 27 | #define VERIFY_READ 0 | 25 | #define VERIFY_READ 0 |
diff --git a/arch/m68k/include/asm/uaccess_no.h b/arch/m68k/include/asm/uaccess_no.h index 1bdf15263754..36deeb36503b 100644 --- a/arch/m68k/include/asm/uaccess_no.h +++ b/arch/m68k/include/asm/uaccess_no.h | |||
| @@ -44,9 +44,6 @@ struct exception_table_entry | |||
| 44 | unsigned long insn, fixup; | 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 | * These are the main single-value transfer routines. They automatically | 49 | * These are the main single-value transfer routines. They automatically |
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h index 826676778094..253a67e275ad 100644 --- a/arch/microblaze/include/asm/uaccess.h +++ b/arch/microblaze/include/asm/uaccess.h | |||
| @@ -71,9 +71,6 @@ struct exception_table_entry { | |||
| 71 | unsigned long insn, fixup; | 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 | #ifndef CONFIG_MMU | 74 | #ifndef CONFIG_MMU |
| 78 | 75 | ||
| 79 | /* Check against bounds of physical memory */ | 76 | /* Check against bounds of physical memory */ |
diff --git a/arch/mips/include/asm/extable.h b/arch/mips/include/asm/extable.h new file mode 100644 index 000000000000..dce7a627a925 --- /dev/null +++ b/arch/mips/include/asm/extable.h | |||
| @@ -0,0 +1,13 @@ | |||
| 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 | ||
diff --git a/arch/mips/include/asm/module.h b/arch/mips/include/asm/module.h index 0aaf9a01ea50..702c273e67a9 100644 --- a/arch/mips/include/asm/module.h +++ b/arch/mips/include/asm/module.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/list.h> | 4 | #include <linux/list.h> |
| 5 | #include <linux/elf.h> | 5 | #include <linux/elf.h> |
| 6 | #include <asm/uaccess.h> | 6 | #include <asm/extable.h> |
| 7 | 7 | ||
| 8 | struct mod_arch_specific { | 8 | struct mod_arch_specific { |
| 9 | /* Data Bus Error exception tables */ | 9 | /* Data Bus Error exception tables */ |
diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h index 21a2aaba20d5..4daf839cd8a8 100644 --- a/arch/mips/include/asm/uaccess.h +++ b/arch/mips/include/asm/uaccess.h | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/thread_info.h> | 16 | #include <linux/thread_info.h> |
| 17 | #include <linux/string.h> | 17 | #include <linux/string.h> |
| 18 | #include <asm/asm-eva.h> | 18 | #include <asm/asm-eva.h> |
| 19 | #include <asm/extable.h> | ||
| 19 | 20 | ||
| 20 | /* | 21 | /* |
| 21 | * The fs value determines whether argument validity checking should be | 22 | * The fs value determines whether argument validity checking should be |
| @@ -1485,12 +1486,4 @@ static inline long strnlen_user(const char __user *s, long n) | |||
| 1485 | return res; | 1486 | return res; |
| 1486 | } | 1487 | } |
| 1487 | 1488 | ||
| 1488 | struct exception_table_entry | ||
| 1489 | { | ||
| 1490 | unsigned long insn; | ||
| 1491 | unsigned long nextinsn; | ||
| 1492 | }; | ||
| 1493 | |||
| 1494 | extern int fixup_exception(struct pt_regs *regs); | ||
| 1495 | |||
| 1496 | #endif /* _ASM_UACCESS_H */ | 1489 | #endif /* _ASM_UACCESS_H */ |
diff --git a/arch/mips/lasat/picvue_proc.c b/arch/mips/lasat/picvue_proc.c index 27533c109f92..dd292dcec684 100644 --- a/arch/mips/lasat/picvue_proc.c +++ b/arch/mips/lasat/picvue_proc.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | #include <linux/timer.h> | 17 | #include <linux/timer.h> |
| 18 | #include <linux/mutex.h> | 18 | #include <linux/mutex.h> |
| 19 | #include <linux/uaccess.h> | ||
| 19 | 20 | ||
| 20 | #include "picvue.h" | 21 | #include "picvue.h" |
| 21 | 22 | ||
diff --git a/arch/mn10300/include/asm/processor.h b/arch/mn10300/include/asm/processor.h index 769d5ed8e992..b10ba121c849 100644 --- a/arch/mn10300/include/asm/processor.h +++ b/arch/mn10300/include/asm/processor.h | |||
| @@ -18,7 +18,6 @@ | |||
| 18 | #include <asm/page.h> | 18 | #include <asm/page.h> |
| 19 | #include <asm/ptrace.h> | 19 | #include <asm/ptrace.h> |
| 20 | #include <asm/cpu-regs.h> | 20 | #include <asm/cpu-regs.h> |
| 21 | #include <asm/uaccess.h> | ||
| 22 | #include <asm/current.h> | 21 | #include <asm/current.h> |
| 23 | 22 | ||
| 24 | /* Forward declaration, a strange C thing */ | 23 | /* Forward declaration, a strange C thing */ |
diff --git a/arch/mn10300/include/asm/uaccess.h b/arch/mn10300/include/asm/uaccess.h index d012e877a95a..2eedf6f46a57 100644 --- a/arch/mn10300/include/asm/uaccess.h +++ b/arch/mn10300/include/asm/uaccess.h | |||
| @@ -38,7 +38,6 @@ | |||
| 38 | #define get_ds() (KERNEL_DS) | 38 | #define get_ds() (KERNEL_DS) |
| 39 | #define get_fs() (current_thread_info()->addr_limit) | 39 | #define get_fs() (current_thread_info()->addr_limit) |
| 40 | #define set_fs(x) (current_thread_info()->addr_limit = (x)) | 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 | #define segment_eq(a, b) ((a).seg == (b).seg) | 42 | #define segment_eq(a, b) ((a).seg == (b).seg) |
| 44 | 43 | ||
| @@ -72,12 +71,6 @@ static inline int ___range_ok(unsigned long addr, unsigned int size) | |||
| 72 | #define access_ok(type, addr, size) (__range_ok((addr), (size)) == 0) | 71 | #define access_ok(type, addr, size) (__range_ok((addr), (size)) == 0) |
| 73 | #define __access_ok(addr, size) (__range_ok((addr), (size)) == 0) | 72 | #define __access_ok(addr, size) (__range_ok((addr), (size)) == 0) |
| 74 | 73 | ||
| 75 | static inline int verify_area(int type, const void *addr, unsigned long size) | ||
| 76 | { | ||
| 77 | return access_ok(type, addr, size) ? 0 : -EFAULT; | ||
| 78 | } | ||
| 79 | |||
| 80 | |||
| 81 | /* | 74 | /* |
| 82 | * The exception table consists of pairs of addresses: the first is the | 75 | * The exception table consists of pairs of addresses: the first is the |
| 83 | * address of an instruction that is allowed to fault, and the second is | 76 | * address of an instruction that is allowed to fault, and the second is |
diff --git a/arch/mn10300/kernel/signal.c b/arch/mn10300/kernel/signal.c index dfd0301cf200..cd8cb1d1176b 100644 --- a/arch/mn10300/kernel/signal.c +++ b/arch/mn10300/kernel/signal.c | |||
| @@ -75,7 +75,7 @@ static int restore_sigcontext(struct pt_regs *regs, | |||
| 75 | struct fpucontext *buf; | 75 | struct fpucontext *buf; |
| 76 | err |= __get_user(buf, &sc->fpucontext); | 76 | err |= __get_user(buf, &sc->fpucontext); |
| 77 | if (buf) { | 77 | if (buf) { |
| 78 | if (verify_area(VERIFY_READ, buf, sizeof(*buf))) | 78 | if (!access_ok(VERIFY_READ, buf, sizeof(*buf))) |
| 79 | goto badframe; | 79 | goto badframe; |
| 80 | err |= fpu_restore_sigcontext(buf); | 80 | err |= fpu_restore_sigcontext(buf); |
| 81 | } | 81 | } |
| @@ -98,7 +98,7 @@ asmlinkage long sys_sigreturn(void) | |||
| 98 | long d0; | 98 | long d0; |
| 99 | 99 | ||
| 100 | frame = (struct sigframe __user *) current_frame()->sp; | 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 | goto badframe; | 102 | goto badframe; |
| 103 | if (__get_user(set.sig[0], &frame->sc.oldmask)) | 103 | if (__get_user(set.sig[0], &frame->sc.oldmask)) |
| 104 | goto badframe; | 104 | goto badframe; |
| @@ -130,7 +130,7 @@ asmlinkage long sys_rt_sigreturn(void) | |||
| 130 | long d0; | 130 | long d0; |
| 131 | 131 | ||
| 132 | frame = (struct rt_sigframe __user *) current_frame()->sp; | 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 | goto badframe; | 134 | goto badframe; |
| 135 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) | 135 | if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) |
| 136 | goto badframe; | 136 | goto badframe; |
diff --git a/arch/openrisc/include/asm/uaccess.h b/arch/openrisc/include/asm/uaccess.h index 5cc6b4f1b795..140faa16685a 100644 --- a/arch/openrisc/include/asm/uaccess.h +++ b/arch/openrisc/include/asm/uaccess.h | |||
| @@ -82,10 +82,6 @@ struct exception_table_entry { | |||
| 82 | unsigned long insn, fixup; | 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 | * These are the main single-value transfer routines. They automatically | 86 | * These are the main single-value transfer routines. They automatically |
| 91 | * use the right size if we just have the right pointer type. | 87 | * use the right size if we just have the right pointer type. |
diff --git a/arch/score/include/asm/extable.h b/arch/score/include/asm/extable.h new file mode 100644 index 000000000000..c4423ccf830d --- /dev/null +++ b/arch/score/include/asm/extable.h | |||
| @@ -0,0 +1,11 @@ | |||
| 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 | ||
diff --git a/arch/score/include/asm/module.h b/arch/score/include/asm/module.h index abf395bbfaba..6dc1f2935eef 100644 --- a/arch/score/include/asm/module.h +++ b/arch/score/include/asm/module.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #define _ASM_SCORE_MODULE_H | 2 | #define _ASM_SCORE_MODULE_H |
| 3 | 3 | ||
| 4 | #include <linux/list.h> | 4 | #include <linux/list.h> |
| 5 | #include <asm/uaccess.h> | 5 | #include <asm/extable.h> |
| 6 | #include <asm-generic/module.h> | 6 | #include <asm-generic/module.h> |
| 7 | 7 | ||
| 8 | struct mod_arch_specific { | 8 | struct mod_arch_specific { |
diff --git a/arch/score/include/asm/uaccess.h b/arch/score/include/asm/uaccess.h index 01aec8ccde83..db58ab98ec4b 100644 --- a/arch/score/include/asm/uaccess.h +++ b/arch/score/include/asm/uaccess.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
| 5 | #include <linux/errno.h> | 5 | #include <linux/errno.h> |
| 6 | #include <linux/thread_info.h> | 6 | #include <linux/thread_info.h> |
| 7 | #include <asm/extable.h> | ||
| 7 | 8 | ||
| 8 | #define VERIFY_READ 0 | 9 | #define VERIFY_READ 0 |
| 9 | #define VERIFY_WRITE 1 | 10 | #define VERIFY_WRITE 1 |
| @@ -420,12 +421,5 @@ static inline long strnlen_user(const char __user *str, long len) | |||
| 420 | return __strnlen_user(str, len); | 421 | return __strnlen_user(str, len); |
| 421 | } | 422 | } |
| 422 | 423 | ||
| 423 | struct exception_table_entry { | ||
| 424 | unsigned long insn; | ||
| 425 | unsigned long fixup; | ||
| 426 | }; | ||
| 427 | |||
| 428 | extern int fixup_exception(struct pt_regs *regs); | ||
| 429 | |||
| 430 | #endif /* __SCORE_UACCESS_H */ | 424 | #endif /* __SCORE_UACCESS_H */ |
| 431 | 425 | ||
diff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h index 92ade79ac427..a38d0c7b818f 100644 --- a/arch/sh/include/asm/uaccess.h +++ b/arch/sh/include/asm/uaccess.h | |||
| @@ -192,8 +192,6 @@ struct exception_table_entry { | |||
| 192 | #endif | 192 | #endif |
| 193 | 193 | ||
| 194 | int fixup_exception(struct pt_regs *regs); | 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 | const struct exception_table_entry *search_exception_tables(unsigned long addr); | 195 | const struct exception_table_entry *search_exception_tables(unsigned long addr); |
| 198 | 196 | ||
| 199 | extern void *set_exception_table_vec(unsigned int vec, void *handler); | 197 | extern void *set_exception_table_vec(unsigned int vec, void *handler); |
diff --git a/arch/sparc/include/asm/elf_64.h b/arch/sparc/include/asm/elf_64.h index 93310837c2df..3f2d403873bd 100644 --- a/arch/sparc/include/asm/elf_64.h +++ b/arch/sparc/include/asm/elf_64.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | #include <asm/ptrace.h> | 8 | #include <asm/ptrace.h> |
| 9 | #include <asm/processor.h> | 9 | #include <asm/processor.h> |
| 10 | #include <asm/uaccess.h> | 10 | #include <asm/extable_64.h> |
| 11 | #include <asm/spitfire.h> | 11 | #include <asm/spitfire.h> |
| 12 | 12 | ||
| 13 | /* | 13 | /* |
diff --git a/arch/sparc/include/asm/extable_64.h b/arch/sparc/include/asm/extable_64.h new file mode 100644 index 000000000000..1121cb056ffb --- /dev/null +++ b/arch/sparc/include/asm/extable_64.h | |||
| @@ -0,0 +1,20 @@ | |||
| 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 | ||
diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h index 37a315d0ddd4..b68acc563235 100644 --- a/arch/sparc/include/asm/uaccess_64.h +++ b/arch/sparc/include/asm/uaccess_64.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <asm/asi.h> | 13 | #include <asm/asi.h> |
| 14 | #include <asm/spitfire.h> | 14 | #include <asm/spitfire.h> |
| 15 | #include <asm-generic/uaccess-unaligned.h> | 15 | #include <asm-generic/uaccess-unaligned.h> |
| 16 | #include <asm/extable_64.h> | ||
| 16 | #endif | 17 | #endif |
| 17 | 18 | ||
| 18 | #ifndef __ASSEMBLY__ | 19 | #ifndef __ASSEMBLY__ |
| @@ -81,23 +82,6 @@ static inline int access_ok(int type, const void __user * addr, unsigned long si | |||
| 81 | return 1; | 82 | return 1; |
| 82 | } | 83 | } |
| 83 | 84 | ||
| 84 | /* | ||
| 85 | * The exception table consists of pairs of addresses: the first is the | ||
| 86 | * address of an instruction that is allowed to fault, and the second is | ||
| 87 | * the address at which the program should continue. No registers are | ||
| 88 | * modified, so it is entirely up to the continuation code to figure out | ||
| 89 | * what to do. | ||
| 90 | * | ||
| 91 | * All the routines below use bits of fixup code that are out of line | ||
| 92 | * with the main instruction path. This means when everything is well, | ||
| 93 | * we don't even have to jump over them. Further, they do not intrude | ||
| 94 | * on our cache or tlb entries. | ||
| 95 | */ | ||
| 96 | |||
| 97 | struct exception_table_entry { | ||
| 98 | unsigned int insn, fixup; | ||
| 99 | }; | ||
| 100 | |||
| 101 | void __ret_efault(void); | 85 | void __ret_efault(void); |
| 102 | void __retl_efault(void); | 86 | void __retl_efault(void); |
| 103 | 87 | ||
diff --git a/arch/x86/include/asm/cacheflush.h b/arch/x86/include/asm/cacheflush.h index 61518cf79437..872877d930de 100644 --- a/arch/x86/include/asm/cacheflush.h +++ b/arch/x86/include/asm/cacheflush.h | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | /* Caches aren't brain-dead on the intel. */ | 4 | /* Caches aren't brain-dead on the intel. */ |
| 5 | #include <asm-generic/cacheflush.h> | 5 | #include <asm-generic/cacheflush.h> |
| 6 | #include <asm/special_insns.h> | 6 | #include <asm/special_insns.h> |
| 7 | #include <asm/uaccess.h> | ||
| 8 | 7 | ||
| 9 | /* | 8 | /* |
| 10 | * The set_memory_* API can be used to change various attributes of a virtual | 9 | * The set_memory_* API can be used to change various attributes of a virtual |
diff --git a/arch/x86/include/asm/extable.h b/arch/x86/include/asm/extable.h new file mode 100644 index 000000000000..b8ad261d11dc --- /dev/null +++ b/arch/x86/include/asm/extable.h | |||
| @@ -0,0 +1,35 @@ | |||
| 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 | ||
diff --git a/arch/x86/include/asm/sections.h b/arch/x86/include/asm/sections.h index 13b6cdd0af57..2f75f30cb2f6 100644 --- a/arch/x86/include/asm/sections.h +++ b/arch/x86/include/asm/sections.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #define _ASM_X86_SECTIONS_H | 2 | #define _ASM_X86_SECTIONS_H |
| 3 | 3 | ||
| 4 | #include <asm-generic/sections.h> | 4 | #include <asm-generic/sections.h> |
| 5 | #include <asm/uaccess.h> | 5 | #include <asm/extable.h> |
| 6 | 6 | ||
| 7 | extern char __brk_base[], __brk_limit[]; | 7 | extern char __brk_base[], __brk_limit[]; |
| 8 | extern struct exception_table_entry __stop___ex_table[]; | 8 | extern struct exception_table_entry __stop___ex_table[]; |
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index 2131c4ce7d8a..faf3687f1035 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include <asm/asm.h> | 11 | #include <asm/asm.h> |
| 12 | #include <asm/page.h> | 12 | #include <asm/page.h> |
| 13 | #include <asm/smap.h> | 13 | #include <asm/smap.h> |
| 14 | #include <asm/extable.h> | ||
| 14 | 15 | ||
| 15 | #define VERIFY_READ 0 | 16 | #define VERIFY_READ 0 |
| 16 | #define VERIFY_WRITE 1 | 17 | #define VERIFY_WRITE 1 |
| @@ -91,37 +92,6 @@ static inline bool __chk_range_not_ok(unsigned long addr, unsigned long size, un | |||
| 91 | likely(!__range_not_ok(addr, size, user_addr_max())) | 92 | likely(!__range_not_ok(addr, size, user_addr_max())) |
| 92 | 93 | ||
| 93 | /* | 94 | /* |
| 94 | * The exception table consists of triples of addresses relative to the | ||
| 95 | * exception table entry itself. The first address is of an instruction | ||
| 96 | * that is allowed to fault, the second is the target at which the program | ||
| 97 | * should continue. The third is a handler function to deal with the fault | ||
| 98 | * caused by the instruction in the first field. | ||
| 99 | * | ||
| 100 | * All the routines below use bits of fixup code that are out of line | ||
| 101 | * with the main instruction path. This means when everything is well, | ||
| 102 | * we don't even have to jump over them. Further, they do not intrude | ||
| 103 | * on our cache or tlb entries. | ||
| 104 | */ | ||
| 105 | |||
| 106 | struct exception_table_entry { | ||
| 107 | int insn, fixup, handler; | ||
| 108 | }; | ||
| 109 | |||
| 110 | #define ARCH_HAS_RELATIVE_EXTABLE | ||
| 111 | |||
| 112 | #define swap_ex_entry_fixup(a, b, tmp, delta) \ | ||
| 113 | do { \ | ||
| 114 | (a)->fixup = (b)->fixup + (delta); \ | ||
| 115 | (b)->fixup = (tmp).fixup - (delta); \ | ||
| 116 | (a)->handler = (b)->handler + (delta); \ | ||
| 117 | (b)->handler = (tmp).handler - (delta); \ | ||
| 118 | } while (0) | ||
| 119 | |||
| 120 | extern int fixup_exception(struct pt_regs *regs, int trapnr); | ||
| 121 | extern bool ex_has_fault_handler(unsigned long ip); | ||
| 122 | extern void early_fixup_exception(struct pt_regs *regs, int trapnr); | ||
| 123 | |||
| 124 | /* | ||
| 125 | * These are the main single-value transfer routines. They automatically | 95 | * These are the main single-value transfer routines. They automatically |
| 126 | * use the right size if we just have the right pointer type. | 96 | * use the right size if we just have the right pointer type. |
| 127 | * | 97 | * |
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 4dc13340653e..9f72ca3b2669 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | */ | 5 | */ |
| 6 | #include <linux/sched.h> /* test_thread_flag(), ... */ | 6 | #include <linux/sched.h> /* test_thread_flag(), ... */ |
| 7 | #include <linux/kdebug.h> /* oops_begin/end, ... */ | 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 | #include <linux/bootmem.h> /* max_low_pfn */ | 9 | #include <linux/bootmem.h> /* max_low_pfn */ |
| 10 | #include <linux/kprobes.h> /* NOKPROBE_SYMBOL, ... */ | 10 | #include <linux/kprobes.h> /* NOKPROBE_SYMBOL, ... */ |
| 11 | #include <linux/mmiotrace.h> /* kmmio_handler, ... */ | 11 | #include <linux/mmiotrace.h> /* kmmio_handler, ... */ |
diff --git a/arch/xtensa/include/asm/asm-uaccess.h b/arch/xtensa/include/asm/asm-uaccess.h new file mode 100644 index 000000000000..a7a110039786 --- /dev/null +++ b/arch/xtensa/include/asm/asm-uaccess.h | |||
| @@ -0,0 +1,160 @@ | |||
| 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 */ | ||
diff --git a/arch/xtensa/include/asm/uaccess.h b/arch/xtensa/include/asm/uaccess.h index 147b26ed9c91..848a3d736bcb 100644 --- a/arch/xtensa/include/asm/uaccess.h +++ b/arch/xtensa/include/asm/uaccess.h | |||
| @@ -17,153 +17,12 @@ | |||
| 17 | #define _XTENSA_UACCESS_H | 17 | #define _XTENSA_UACCESS_H |
| 18 | 18 | ||
| 19 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
| 20 | #ifndef __ASSEMBLY__ | ||
| 21 | #include <linux/prefetch.h> | 20 | #include <linux/prefetch.h> |
| 22 | #endif | ||
| 23 | #include <asm/types.h> | 21 | #include <asm/types.h> |
| 24 | 22 | ||
| 25 | #define VERIFY_READ 0 | 23 | #define VERIFY_READ 0 |
| 26 | #define VERIFY_WRITE 1 | 24 | #define VERIFY_WRITE 1 |
| 27 | 25 | ||
| 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 | |||
| 167 | #include <linux/sched.h> | 26 | #include <linux/sched.h> |
| 168 | 27 | ||
| 169 | /* | 28 | /* |
| @@ -495,16 +354,4 @@ struct exception_table_entry | |||
| 495 | unsigned long insn, fixup; | 354 | unsigned long insn, fixup; |
| 496 | }; | 355 | }; |
| 497 | 356 | ||
| 498 | /* Returns 0 if exception not found and fixup.unit otherwise. */ | ||
| 499 | |||
| 500 | extern unsigned long search_exception_table(unsigned long addr); | ||
| 501 | extern void sort_exception_table(void); | ||
| 502 | |||
| 503 | /* Returns the new pc */ | ||
| 504 | #define fixup_exception(map_reg, fixup_unit, pc) \ | ||
| 505 | ({ \ | ||
| 506 | fixup_unit; \ | ||
| 507 | }) | ||
| 508 | |||
| 509 | #endif /* __ASSEMBLY__ */ | ||
| 510 | #endif /* _XTENSA_UACCESS_H */ | 357 | #endif /* _XTENSA_UACCESS_H */ |
diff --git a/arch/xtensa/kernel/coprocessor.S b/arch/xtensa/kernel/coprocessor.S index a482df5df2b2..6911e384f608 100644 --- a/arch/xtensa/kernel/coprocessor.S +++ b/arch/xtensa/kernel/coprocessor.S | |||
| @@ -17,7 +17,7 @@ | |||
| 17 | #include <asm/processor.h> | 17 | #include <asm/processor.h> |
| 18 | #include <asm/coprocessor.h> | 18 | #include <asm/coprocessor.h> |
| 19 | #include <asm/thread_info.h> | 19 | #include <asm/thread_info.h> |
| 20 | #include <asm/uaccess.h> | 20 | #include <asm/asm-uaccess.h> |
| 21 | #include <asm/unistd.h> | 21 | #include <asm/unistd.h> |
| 22 | #include <asm/ptrace.h> | 22 | #include <asm/ptrace.h> |
| 23 | #include <asm/current.h> | 23 | #include <asm/current.h> |
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S index fa04d9d368a7..f5ef3cc0497c 100644 --- a/arch/xtensa/kernel/entry.S +++ b/arch/xtensa/kernel/entry.S | |||
| @@ -17,7 +17,7 @@ | |||
| 17 | #include <asm/processor.h> | 17 | #include <asm/processor.h> |
| 18 | #include <asm/coprocessor.h> | 18 | #include <asm/coprocessor.h> |
| 19 | #include <asm/thread_info.h> | 19 | #include <asm/thread_info.h> |
| 20 | #include <asm/uaccess.h> | 20 | #include <asm/asm-uaccess.h> |
| 21 | #include <asm/unistd.h> | 21 | #include <asm/unistd.h> |
| 22 | #include <asm/ptrace.h> | 22 | #include <asm/ptrace.h> |
| 23 | #include <asm/current.h> | 23 | #include <asm/current.h> |
diff --git a/drivers/char/tb0219.c b/drivers/char/tb0219.c index 480a777db577..7c19d9b22785 100644 --- a/drivers/char/tb0219.c +++ b/drivers/char/tb0219.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
| 22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
| 23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
| 24 | #include <linux/uaccess.h> | ||
| 24 | 25 | ||
| 25 | #include <asm/io.h> | 26 | #include <asm/io.h> |
| 26 | #include <asm/reboot.h> | 27 | #include <asm/reboot.h> |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 3f31ca32f52b..5fa36ebc0640 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
| @@ -471,9 +471,9 @@ static int bond_check_dev_link(struct bonding *bond, | |||
| 471 | /* Yes, the mii is overlaid on the ifreq.ifr_ifru */ | 471 | /* Yes, the mii is overlaid on the ifreq.ifr_ifru */ |
| 472 | strncpy(ifr.ifr_name, slave_dev->name, IFNAMSIZ); | 472 | strncpy(ifr.ifr_name, slave_dev->name, IFNAMSIZ); |
| 473 | mii = if_mii(&ifr); | 473 | mii = if_mii(&ifr); |
| 474 | if (IOCTL(slave_dev, &ifr, SIOCGMIIPHY) == 0) { | 474 | if (ioctl(slave_dev, &ifr, SIOCGMIIPHY) == 0) { |
| 475 | mii->reg_num = MII_BMSR; | 475 | mii->reg_num = MII_BMSR; |
| 476 | if (IOCTL(slave_dev, &ifr, SIOCGMIIREG) == 0) | 476 | if (ioctl(slave_dev, &ifr, SIOCGMIIREG) == 0) |
| 477 | return mii->val_out & BMSR_LSTATUS; | 477 | return mii->val_out & BMSR_LSTATUS; |
| 478 | } | 478 | } |
| 479 | } | 479 | } |
diff --git a/drivers/platform/x86/dell-smo8800.c b/drivers/platform/x86/dell-smo8800.c index 0aec4fd4c48e..37e646034ef8 100644 --- a/drivers/platform/x86/dell-smo8800.c +++ b/drivers/platform/x86/dell-smo8800.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/acpi.h> | 24 | #include <linux/acpi.h> |
| 25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
| 26 | #include <linux/miscdevice.h> | 26 | #include <linux/miscdevice.h> |
| 27 | #include <linux/uaccess.h> | ||
| 27 | 28 | ||
| 28 | struct smo8800_device { | 29 | struct smo8800_device { |
| 29 | u32 irq; /* acpi device irq */ | 30 | u32 irq; /* acpi device irq */ |
diff --git a/drivers/video/fbdev/au1200fb.c b/drivers/video/fbdev/au1200fb.c index f9507b1894df..6c2b2ca4a909 100644 --- a/drivers/video/fbdev/au1200fb.c +++ b/drivers/video/fbdev/au1200fb.c | |||
| @@ -43,6 +43,7 @@ | |||
| 43 | #include <linux/ctype.h> | 43 | #include <linux/ctype.h> |
| 44 | #include <linux/dma-mapping.h> | 44 | #include <linux/dma-mapping.h> |
| 45 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
| 46 | #include <linux/uaccess.h> | ||
| 46 | 47 | ||
| 47 | #include <asm/mach-au1x00/au1000.h> | 48 | #include <asm/mach-au1x00/au1000.h> |
| 48 | #include <asm/mach-au1x00/au1200fb.h> /* platform_data */ | 49 | #include <asm/mach-au1x00/au1200fb.h> /* platform_data */ |
diff --git a/drivers/watchdog/ath79_wdt.c b/drivers/watchdog/ath79_wdt.c index 835d310081e1..e2209bf5fa8a 100644 --- a/drivers/watchdog/ath79_wdt.c +++ b/drivers/watchdog/ath79_wdt.c | |||
| @@ -35,6 +35,7 @@ | |||
| 35 | #include <linux/err.h> | 35 | #include <linux/err.h> |
| 36 | #include <linux/of.h> | 36 | #include <linux/of.h> |
| 37 | #include <linux/of_platform.h> | 37 | #include <linux/of_platform.h> |
| 38 | #include <linux/uaccess.h> | ||
| 38 | 39 | ||
| 39 | #define DRIVER_NAME "ath79-wdt" | 40 | #define DRIVER_NAME "ath79-wdt" |
| 40 | 41 | ||
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h index 6df9b0749671..cc6bb319e464 100644 --- a/include/asm-generic/uaccess.h +++ b/include/asm-generic/uaccess.h | |||
| @@ -69,10 +69,6 @@ struct exception_table_entry | |||
| 69 | unsigned long insn, fixup; | 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 | * architectures with an MMU should override these two | 73 | * architectures with an MMU should override these two |
| 78 | */ | 74 | */ |
diff --git a/include/net/bonding.h b/include/net/bonding.h index 6360c259da6d..f32f7ef8a23a 100644 --- a/include/net/bonding.h +++ b/include/net/bonding.h | |||
| @@ -37,18 +37,6 @@ | |||
| 37 | #ifndef __long_aligned | 37 | #ifndef __long_aligned |
| 38 | #define __long_aligned __attribute__((aligned((sizeof(long))))) | 38 | #define __long_aligned __attribute__((aligned((sizeof(long))))) |
| 39 | #endif | 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 | #define BOND_MODE(bond) ((bond)->params.mode) | 41 | #define BOND_MODE(bond) ((bond)->params.mode) |
| 54 | 42 | ||
