diff options
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/Kconfig | 3 | ||||
-rw-r--r-- | arch/mips/include/asm/module.h | 10 | ||||
-rw-r--r-- | arch/mips/include/asm/thread_info.h | 3 | ||||
-rw-r--r-- | arch/mips/kernel/Makefile | 1 | ||||
-rw-r--r-- | arch/mips/kernel/kgdb.c | 9 | ||||
-rw-r--r-- | arch/mips/kernel/linux32.c | 4 | ||||
-rw-r--r-- | arch/mips/kernel/module-rela.c | 145 | ||||
-rw-r--r-- | arch/mips/kernel/module.c | 121 | ||||
-rw-r--r-- | arch/mips/kernel/syscall.c | 4 |
9 files changed, 171 insertions, 129 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 3803696e635..dba9390d37c 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -37,6 +37,9 @@ config MIPS | |||
37 | select BUILDTIME_EXTABLE_SORT | 37 | select BUILDTIME_EXTABLE_SORT |
38 | select GENERIC_CLOCKEVENTS | 38 | select GENERIC_CLOCKEVENTS |
39 | select GENERIC_CMOS_UPDATE | 39 | select GENERIC_CMOS_UPDATE |
40 | select HAVE_MOD_ARCH_SPECIFIC | ||
41 | select MODULES_USE_ELF_REL | ||
42 | select MODULES_USE_ELF_RELA if 64BIT | ||
40 | 43 | ||
41 | menu "Machine selection" | 44 | menu "Machine selection" |
42 | 45 | ||
diff --git a/arch/mips/include/asm/module.h b/arch/mips/include/asm/module.h index dca8bce8c7a..26137da1c71 100644 --- a/arch/mips/include/asm/module.h +++ b/arch/mips/include/asm/module.h | |||
@@ -35,11 +35,14 @@ typedef struct { | |||
35 | } Elf64_Mips_Rela; | 35 | } Elf64_Mips_Rela; |
36 | 36 | ||
37 | #ifdef CONFIG_32BIT | 37 | #ifdef CONFIG_32BIT |
38 | |||
39 | #define Elf_Shdr Elf32_Shdr | 38 | #define Elf_Shdr Elf32_Shdr |
40 | #define Elf_Sym Elf32_Sym | 39 | #define Elf_Sym Elf32_Sym |
41 | #define Elf_Ehdr Elf32_Ehdr | 40 | #define Elf_Ehdr Elf32_Ehdr |
42 | #define Elf_Addr Elf32_Addr | 41 | #define Elf_Addr Elf32_Addr |
42 | #define Elf_Rel Elf32_Rel | ||
43 | #define Elf_Rela Elf32_Rela | ||
44 | #define ELF_R_TYPE(X) ELF32_R_TYPE(X) | ||
45 | #define ELF_R_SYM(X) ELF32_R_SYM(X) | ||
43 | 46 | ||
44 | #define Elf_Mips_Rel Elf32_Rel | 47 | #define Elf_Mips_Rel Elf32_Rel |
45 | #define Elf_Mips_Rela Elf32_Rela | 48 | #define Elf_Mips_Rela Elf32_Rela |
@@ -50,11 +53,14 @@ typedef struct { | |||
50 | #endif | 53 | #endif |
51 | 54 | ||
52 | #ifdef CONFIG_64BIT | 55 | #ifdef CONFIG_64BIT |
53 | |||
54 | #define Elf_Shdr Elf64_Shdr | 56 | #define Elf_Shdr Elf64_Shdr |
55 | #define Elf_Sym Elf64_Sym | 57 | #define Elf_Sym Elf64_Sym |
56 | #define Elf_Ehdr Elf64_Ehdr | 58 | #define Elf_Ehdr Elf64_Ehdr |
57 | #define Elf_Addr Elf64_Addr | 59 | #define Elf_Addr Elf64_Addr |
60 | #define Elf_Rel Elf64_Rel | ||
61 | #define Elf_Rela Elf64_Rela | ||
62 | #define ELF_R_TYPE(X) ELF64_R_TYPE(X) | ||
63 | #define ELF_R_SYM(X) ELF64_R_SYM(X) | ||
58 | 64 | ||
59 | #define Elf_Mips_Rel Elf64_Mips_Rel | 65 | #define Elf_Mips_Rel Elf64_Mips_Rel |
60 | #define Elf_Mips_Rela Elf64_Mips_Rela | 66 | #define Elf_Mips_Rela Elf64_Mips_Rela |
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h index 946e010f201..8debe9e9175 100644 --- a/arch/mips/include/asm/thread_info.h +++ b/arch/mips/include/asm/thread_info.h | |||
@@ -103,7 +103,6 @@ register struct thread_info *__current_thread_info __asm__("$28"); | |||
103 | #define TIF_NOTIFY_RESUME 5 /* callback before returning to user */ | 103 | #define TIF_NOTIFY_RESUME 5 /* callback before returning to user */ |
104 | #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */ | 104 | #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */ |
105 | #define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ | 105 | #define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ |
106 | #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ | ||
107 | #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ | 106 | #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ |
108 | #define TIF_FIXADE 20 /* Fix address errors in software */ | 107 | #define TIF_FIXADE 20 /* Fix address errors in software */ |
109 | #define TIF_LOGADE 21 /* Log address errors to syslog */ | 108 | #define TIF_LOGADE 21 /* Log address errors to syslog */ |
@@ -125,9 +124,7 @@ register struct thread_info *__current_thread_info __asm__("$28"); | |||
125 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) | 124 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) |
126 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) | 125 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) |
127 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | 126 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
128 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | ||
129 | #define _TIF_USEDFPU (1<<TIF_USEDFPU) | 127 | #define _TIF_USEDFPU (1<<TIF_USEDFPU) |
130 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | ||
131 | #define _TIF_FIXADE (1<<TIF_FIXADE) | 128 | #define _TIF_FIXADE (1<<TIF_FIXADE) |
132 | #define _TIF_LOGADE (1<<TIF_LOGADE) | 129 | #define _TIF_LOGADE (1<<TIF_LOGADE) |
133 | #define _TIF_32BIT_REGS (1<<TIF_32BIT_REGS) | 130 | #define _TIF_32BIT_REGS (1<<TIF_32BIT_REGS) |
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile index e49c4469f73..8b28bc4e14e 100644 --- a/arch/mips/kernel/Makefile +++ b/arch/mips/kernel/Makefile | |||
@@ -31,6 +31,7 @@ obj-$(CONFIG_SYNC_R4K) += sync-r4k.o | |||
31 | 31 | ||
32 | obj-$(CONFIG_STACKTRACE) += stacktrace.o | 32 | obj-$(CONFIG_STACKTRACE) += stacktrace.o |
33 | obj-$(CONFIG_MODULES) += mips_ksyms.o module.o | 33 | obj-$(CONFIG_MODULES) += mips_ksyms.o module.o |
34 | obj-$(CONFIG_MODULES_USE_ELF_RELA) += module-rela.o | ||
34 | 35 | ||
35 | obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o | 36 | obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o |
36 | 37 | ||
diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c index f4546e97c60..23817a6e32b 100644 --- a/arch/mips/kernel/kgdb.c +++ b/arch/mips/kernel/kgdb.c | |||
@@ -283,6 +283,15 @@ static int kgdb_mips_notify(struct notifier_block *self, unsigned long cmd, | |||
283 | struct pt_regs *regs = args->regs; | 283 | struct pt_regs *regs = args->regs; |
284 | int trap = (regs->cp0_cause & 0x7c) >> 2; | 284 | int trap = (regs->cp0_cause & 0x7c) >> 2; |
285 | 285 | ||
286 | #ifdef CONFIG_KPROBES | ||
287 | /* | ||
288 | * Return immediately if the kprobes fault notifier has set | ||
289 | * DIE_PAGE_FAULT. | ||
290 | */ | ||
291 | if (cmd == DIE_PAGE_FAULT) | ||
292 | return NOTIFY_DONE; | ||
293 | #endif /* CONFIG_KPROBES */ | ||
294 | |||
286 | /* Userspace events, ignore. */ | 295 | /* Userspace events, ignore. */ |
287 | if (user_mode(regs)) | 296 | if (user_mode(regs)) |
288 | return NOTIFY_DONE; | 297 | return NOTIFY_DONE; |
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index 922a554cd10..3a21acedf88 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c | |||
@@ -83,13 +83,13 @@ out: | |||
83 | asmlinkage int sys32_execve(nabi_no_regargs struct pt_regs regs) | 83 | asmlinkage int sys32_execve(nabi_no_regargs struct pt_regs regs) |
84 | { | 84 | { |
85 | int error; | 85 | int error; |
86 | char * filename; | 86 | struct filename *filename; |
87 | 87 | ||
88 | filename = getname(compat_ptr(regs.regs[4])); | 88 | filename = getname(compat_ptr(regs.regs[4])); |
89 | error = PTR_ERR(filename); | 89 | error = PTR_ERR(filename); |
90 | if (IS_ERR(filename)) | 90 | if (IS_ERR(filename)) |
91 | goto out; | 91 | goto out; |
92 | error = compat_do_execve(filename, compat_ptr(regs.regs[5]), | 92 | error = compat_do_execve(filename->name, compat_ptr(regs.regs[5]), |
93 | compat_ptr(regs.regs[6]), ®s); | 93 | compat_ptr(regs.regs[6]), ®s); |
94 | putname(filename); | 94 | putname(filename); |
95 | 95 | ||
diff --git a/arch/mips/kernel/module-rela.c b/arch/mips/kernel/module-rela.c new file mode 100644 index 00000000000..61d60028b88 --- /dev/null +++ b/arch/mips/kernel/module-rela.c | |||
@@ -0,0 +1,145 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or modify | ||
3 | * it under the terms of the GNU General Public License as published by | ||
4 | * the Free Software Foundation; either version 2 of the License, or | ||
5 | * (at your option) any later version. | ||
6 | * | ||
7 | * This program is distributed in the hope that it will be useful, | ||
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
10 | * GNU General Public License for more details. | ||
11 | * | ||
12 | * You should have received a copy of the GNU General Public License | ||
13 | * along with this program; if not, write to the Free Software | ||
14 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
15 | * | ||
16 | * Copyright (C) 2001 Rusty Russell. | ||
17 | * Copyright (C) 2003, 2004 Ralf Baechle (ralf@linux-mips.org) | ||
18 | * Copyright (C) 2005 Thiemo Seufer | ||
19 | */ | ||
20 | |||
21 | #include <linux/elf.h> | ||
22 | #include <linux/err.h> | ||
23 | #include <linux/errno.h> | ||
24 | #include <linux/moduleloader.h> | ||
25 | |||
26 | extern int apply_r_mips_none(struct module *me, u32 *location, Elf_Addr v); | ||
27 | |||
28 | static int apply_r_mips_32_rela(struct module *me, u32 *location, Elf_Addr v) | ||
29 | { | ||
30 | *location = v; | ||
31 | |||
32 | return 0; | ||
33 | } | ||
34 | |||
35 | static int apply_r_mips_26_rela(struct module *me, u32 *location, Elf_Addr v) | ||
36 | { | ||
37 | if (v % 4) { | ||
38 | pr_err("module %s: dangerous R_MIPS_26 RELArelocation\n", | ||
39 | me->name); | ||
40 | return -ENOEXEC; | ||
41 | } | ||
42 | |||
43 | if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { | ||
44 | printk(KERN_ERR | ||
45 | "module %s: relocation overflow\n", | ||
46 | me->name); | ||
47 | return -ENOEXEC; | ||
48 | } | ||
49 | |||
50 | *location = (*location & ~0x03ffffff) | ((v >> 2) & 0x03ffffff); | ||
51 | |||
52 | return 0; | ||
53 | } | ||
54 | |||
55 | static int apply_r_mips_hi16_rela(struct module *me, u32 *location, Elf_Addr v) | ||
56 | { | ||
57 | *location = (*location & 0xffff0000) | | ||
58 | ((((long long) v + 0x8000LL) >> 16) & 0xffff); | ||
59 | |||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | static int apply_r_mips_lo16_rela(struct module *me, u32 *location, Elf_Addr v) | ||
64 | { | ||
65 | *location = (*location & 0xffff0000) | (v & 0xffff); | ||
66 | |||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | static int apply_r_mips_64_rela(struct module *me, u32 *location, Elf_Addr v) | ||
71 | { | ||
72 | *(Elf_Addr *)location = v; | ||
73 | |||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | static int apply_r_mips_higher_rela(struct module *me, u32 *location, | ||
78 | Elf_Addr v) | ||
79 | { | ||
80 | *location = (*location & 0xffff0000) | | ||
81 | ((((long long) v + 0x80008000LL) >> 32) & 0xffff); | ||
82 | |||
83 | return 0; | ||
84 | } | ||
85 | |||
86 | static int apply_r_mips_highest_rela(struct module *me, u32 *location, | ||
87 | Elf_Addr v) | ||
88 | { | ||
89 | *location = (*location & 0xffff0000) | | ||
90 | ((((long long) v + 0x800080008000LL) >> 48) & 0xffff); | ||
91 | |||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | static int (*reloc_handlers_rela[]) (struct module *me, u32 *location, | ||
96 | Elf_Addr v) = { | ||
97 | [R_MIPS_NONE] = apply_r_mips_none, | ||
98 | [R_MIPS_32] = apply_r_mips_32_rela, | ||
99 | [R_MIPS_26] = apply_r_mips_26_rela, | ||
100 | [R_MIPS_HI16] = apply_r_mips_hi16_rela, | ||
101 | [R_MIPS_LO16] = apply_r_mips_lo16_rela, | ||
102 | [R_MIPS_64] = apply_r_mips_64_rela, | ||
103 | [R_MIPS_HIGHER] = apply_r_mips_higher_rela, | ||
104 | [R_MIPS_HIGHEST] = apply_r_mips_highest_rela | ||
105 | }; | ||
106 | |||
107 | int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab, | ||
108 | unsigned int symindex, unsigned int relsec, | ||
109 | struct module *me) | ||
110 | { | ||
111 | Elf_Mips_Rela *rel = (void *) sechdrs[relsec].sh_addr; | ||
112 | Elf_Sym *sym; | ||
113 | u32 *location; | ||
114 | unsigned int i; | ||
115 | Elf_Addr v; | ||
116 | int res; | ||
117 | |||
118 | pr_debug("Applying relocate section %u to %u\n", relsec, | ||
119 | sechdrs[relsec].sh_info); | ||
120 | |||
121 | for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { | ||
122 | /* This is where to make the change */ | ||
123 | location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr | ||
124 | + rel[i].r_offset; | ||
125 | /* This is the symbol it is referring to */ | ||
126 | sym = (Elf_Sym *)sechdrs[symindex].sh_addr | ||
127 | + ELF_MIPS_R_SYM(rel[i]); | ||
128 | if (IS_ERR_VALUE(sym->st_value)) { | ||
129 | /* Ignore unresolved weak symbol */ | ||
130 | if (ELF_ST_BIND(sym->st_info) == STB_WEAK) | ||
131 | continue; | ||
132 | printk(KERN_WARNING "%s: Unknown symbol %s\n", | ||
133 | me->name, strtab + sym->st_name); | ||
134 | return -ENOENT; | ||
135 | } | ||
136 | |||
137 | v = sym->st_value + rel[i].r_addend; | ||
138 | |||
139 | res = reloc_handlers_rela[ELF_MIPS_R_TYPE(rel[i])](me, location, v); | ||
140 | if (res) | ||
141 | return res; | ||
142 | } | ||
143 | |||
144 | return 0; | ||
145 | } | ||
diff --git a/arch/mips/kernel/module.c b/arch/mips/kernel/module.c index 4f8c3cba8c0..07ff5812ffa 100644 --- a/arch/mips/kernel/module.c +++ b/arch/mips/kernel/module.c | |||
@@ -51,7 +51,7 @@ void *module_alloc(unsigned long size) | |||
51 | } | 51 | } |
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | static int apply_r_mips_none(struct module *me, u32 *location, Elf_Addr v) | 54 | int apply_r_mips_none(struct module *me, u32 *location, Elf_Addr v) |
55 | { | 55 | { |
56 | return 0; | 56 | return 0; |
57 | } | 57 | } |
@@ -63,13 +63,6 @@ static int apply_r_mips_32_rel(struct module *me, u32 *location, Elf_Addr v) | |||
63 | return 0; | 63 | return 0; |
64 | } | 64 | } |
65 | 65 | ||
66 | static int apply_r_mips_32_rela(struct module *me, u32 *location, Elf_Addr v) | ||
67 | { | ||
68 | *location = v; | ||
69 | |||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v) | 66 | static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v) |
74 | { | 67 | { |
75 | if (v % 4) { | 68 | if (v % 4) { |
@@ -91,26 +84,6 @@ static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v) | |||
91 | return 0; | 84 | return 0; |
92 | } | 85 | } |
93 | 86 | ||
94 | static int apply_r_mips_26_rela(struct module *me, u32 *location, Elf_Addr v) | ||
95 | { | ||
96 | if (v % 4) { | ||
97 | pr_err("module %s: dangerous R_MIPS_26 RELArelocation\n", | ||
98 | me->name); | ||
99 | return -ENOEXEC; | ||
100 | } | ||
101 | |||
102 | if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { | ||
103 | printk(KERN_ERR | ||
104 | "module %s: relocation overflow\n", | ||
105 | me->name); | ||
106 | return -ENOEXEC; | ||
107 | } | ||
108 | |||
109 | *location = (*location & ~0x03ffffff) | ((v >> 2) & 0x03ffffff); | ||
110 | |||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | static int apply_r_mips_hi16_rel(struct module *me, u32 *location, Elf_Addr v) | 87 | static int apply_r_mips_hi16_rel(struct module *me, u32 *location, Elf_Addr v) |
115 | { | 88 | { |
116 | struct mips_hi16 *n; | 89 | struct mips_hi16 *n; |
@@ -132,14 +105,6 @@ static int apply_r_mips_hi16_rel(struct module *me, u32 *location, Elf_Addr v) | |||
132 | return 0; | 105 | return 0; |
133 | } | 106 | } |
134 | 107 | ||
135 | static int apply_r_mips_hi16_rela(struct module *me, u32 *location, Elf_Addr v) | ||
136 | { | ||
137 | *location = (*location & 0xffff0000) | | ||
138 | ((((long long) v + 0x8000LL) >> 16) & 0xffff); | ||
139 | |||
140 | return 0; | ||
141 | } | ||
142 | |||
143 | static void free_relocation_chain(struct mips_hi16 *l) | 108 | static void free_relocation_chain(struct mips_hi16 *l) |
144 | { | 109 | { |
145 | struct mips_hi16 *next; | 110 | struct mips_hi16 *next; |
@@ -217,38 +182,6 @@ out_danger: | |||
217 | return -ENOEXEC; | 182 | return -ENOEXEC; |
218 | } | 183 | } |
219 | 184 | ||
220 | static int apply_r_mips_lo16_rela(struct module *me, u32 *location, Elf_Addr v) | ||
221 | { | ||
222 | *location = (*location & 0xffff0000) | (v & 0xffff); | ||
223 | |||
224 | return 0; | ||
225 | } | ||
226 | |||
227 | static int apply_r_mips_64_rela(struct module *me, u32 *location, Elf_Addr v) | ||
228 | { | ||
229 | *(Elf_Addr *)location = v; | ||
230 | |||
231 | return 0; | ||
232 | } | ||
233 | |||
234 | static int apply_r_mips_higher_rela(struct module *me, u32 *location, | ||
235 | Elf_Addr v) | ||
236 | { | ||
237 | *location = (*location & 0xffff0000) | | ||
238 | ((((long long) v + 0x80008000LL) >> 32) & 0xffff); | ||
239 | |||
240 | return 0; | ||
241 | } | ||
242 | |||
243 | static int apply_r_mips_highest_rela(struct module *me, u32 *location, | ||
244 | Elf_Addr v) | ||
245 | { | ||
246 | *location = (*location & 0xffff0000) | | ||
247 | ((((long long) v + 0x800080008000LL) >> 48) & 0xffff); | ||
248 | |||
249 | return 0; | ||
250 | } | ||
251 | |||
252 | static int (*reloc_handlers_rel[]) (struct module *me, u32 *location, | 185 | static int (*reloc_handlers_rel[]) (struct module *me, u32 *location, |
253 | Elf_Addr v) = { | 186 | Elf_Addr v) = { |
254 | [R_MIPS_NONE] = apply_r_mips_none, | 187 | [R_MIPS_NONE] = apply_r_mips_none, |
@@ -258,18 +191,6 @@ static int (*reloc_handlers_rel[]) (struct module *me, u32 *location, | |||
258 | [R_MIPS_LO16] = apply_r_mips_lo16_rel | 191 | [R_MIPS_LO16] = apply_r_mips_lo16_rel |
259 | }; | 192 | }; |
260 | 193 | ||
261 | static int (*reloc_handlers_rela[]) (struct module *me, u32 *location, | ||
262 | Elf_Addr v) = { | ||
263 | [R_MIPS_NONE] = apply_r_mips_none, | ||
264 | [R_MIPS_32] = apply_r_mips_32_rela, | ||
265 | [R_MIPS_26] = apply_r_mips_26_rela, | ||
266 | [R_MIPS_HI16] = apply_r_mips_hi16_rela, | ||
267 | [R_MIPS_LO16] = apply_r_mips_lo16_rela, | ||
268 | [R_MIPS_64] = apply_r_mips_64_rela, | ||
269 | [R_MIPS_HIGHER] = apply_r_mips_higher_rela, | ||
270 | [R_MIPS_HIGHEST] = apply_r_mips_highest_rela | ||
271 | }; | ||
272 | |||
273 | int apply_relocate(Elf_Shdr *sechdrs, const char *strtab, | 194 | int apply_relocate(Elf_Shdr *sechdrs, const char *strtab, |
274 | unsigned int symindex, unsigned int relsec, | 195 | unsigned int symindex, unsigned int relsec, |
275 | struct module *me) | 196 | struct module *me) |
@@ -324,46 +245,6 @@ int apply_relocate(Elf_Shdr *sechdrs, const char *strtab, | |||
324 | return 0; | 245 | return 0; |
325 | } | 246 | } |
326 | 247 | ||
327 | int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab, | ||
328 | unsigned int symindex, unsigned int relsec, | ||
329 | struct module *me) | ||
330 | { | ||
331 | Elf_Mips_Rela *rel = (void *) sechdrs[relsec].sh_addr; | ||
332 | Elf_Sym *sym; | ||
333 | u32 *location; | ||
334 | unsigned int i; | ||
335 | Elf_Addr v; | ||
336 | int res; | ||
337 | |||
338 | pr_debug("Applying relocate section %u to %u\n", relsec, | ||
339 | sechdrs[relsec].sh_info); | ||
340 | |||
341 | for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { | ||
342 | /* This is where to make the change */ | ||
343 | location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr | ||
344 | + rel[i].r_offset; | ||
345 | /* This is the symbol it is referring to */ | ||
346 | sym = (Elf_Sym *)sechdrs[symindex].sh_addr | ||
347 | + ELF_MIPS_R_SYM(rel[i]); | ||
348 | if (IS_ERR_VALUE(sym->st_value)) { | ||
349 | /* Ignore unresolved weak symbol */ | ||
350 | if (ELF_ST_BIND(sym->st_info) == STB_WEAK) | ||
351 | continue; | ||
352 | printk(KERN_WARNING "%s: Unknown symbol %s\n", | ||
353 | me->name, strtab + sym->st_name); | ||
354 | return -ENOENT; | ||
355 | } | ||
356 | |||
357 | v = sym->st_value + rel[i].r_addend; | ||
358 | |||
359 | res = reloc_handlers_rela[ELF_MIPS_R_TYPE(rel[i])](me, location, v); | ||
360 | if (res) | ||
361 | return res; | ||
362 | } | ||
363 | |||
364 | return 0; | ||
365 | } | ||
366 | |||
367 | /* Given an address, look for it in the module exception tables. */ | 248 | /* Given an address, look for it in the module exception tables. */ |
368 | const struct exception_table_entry *search_module_dbetables(unsigned long addr) | 249 | const struct exception_table_entry *search_module_dbetables(unsigned long addr) |
369 | { | 250 | { |
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c index b08220c8211..2bd561bc05a 100644 --- a/arch/mips/kernel/syscall.c +++ b/arch/mips/kernel/syscall.c | |||
@@ -133,13 +133,13 @@ _sys_clone(nabi_no_regargs struct pt_regs regs) | |||
133 | asmlinkage int sys_execve(nabi_no_regargs struct pt_regs regs) | 133 | asmlinkage int sys_execve(nabi_no_regargs struct pt_regs regs) |
134 | { | 134 | { |
135 | int error; | 135 | int error; |
136 | char * filename; | 136 | struct filename *filename; |
137 | 137 | ||
138 | filename = getname((const char __user *) (long)regs.regs[4]); | 138 | filename = getname((const char __user *) (long)regs.regs[4]); |
139 | error = PTR_ERR(filename); | 139 | error = PTR_ERR(filename); |
140 | if (IS_ERR(filename)) | 140 | if (IS_ERR(filename)) |
141 | goto out; | 141 | goto out; |
142 | error = do_execve(filename, | 142 | error = do_execve(filename->name, |
143 | (const char __user *const __user *) (long)regs.regs[5], | 143 | (const char __user *const __user *) (long)regs.regs[5], |
144 | (const char __user *const __user *) (long)regs.regs[6], | 144 | (const char __user *const __user *) (long)regs.regs[6], |
145 | ®s); | 145 | ®s); |