Date:2010-01-29 19:07:38 (3 years 3 months ago)
Author:florian
Commit:45c66fabea801cef215df07a9e5de4d888405a55
Message:[kernel] refresh no_module_reloc.patch for mips64 targets

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19382 3c298f89-4303-0410-b956-a3cf2f4a3e73
Files: target/linux/cobalt/patches/001-no_module_reloc.patch (10 diffs)
target/linux/octeon/patches/106-no_module_reloc.patch (10 diffs)
target/linux/sibyte/patches/106-no_module_reloc.patch (10 diffs)

Change Details

target/linux/cobalt/patches/001-no_module_reloc.patch
1+++ b/arch/mips/Makefile
2@@ -83,7 +83,7 @@ all-$(CONFIG_BOOT_ELF64) := $(vmlinux-64
1diff -urN linux-2.6.30.10/arch/mips/Makefile linux-2.6.30.10.new//arch/mips/Makefile
2--- linux-2.6.30.10/arch/mips/Makefile 2010-01-29 16:12:01.000000000 +0100
3@@ -83,7 +83,7 @@
34 cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
45 cflags-y += -msoft-float
56 LDFLAGS_vmlinux += -G 0 -static -n -nostdlib
...... 
910
1011 cflags-y += -ffreestanding
1112
12+++ b/arch/mips/include/asm/module.h
13@@ -9,11 +9,6 @@ struct mod_arch_specific {
13diff -urN linux-2.6.30.10/arch/mips/include/asm/module.h linux-2.6.30.10.new//arch/mips/include/asm/module.h
14--- linux-2.6.30.10/arch/mips/include/asm/module.h 2010-01-29 16:12:01.000000000 +0100
15@@ -9,11 +9,6 @@
1416     struct list_head dbe_list;
1517     const struct exception_table_entry *dbe_start;
1618     const struct exception_table_entry *dbe_end;
1719-
18- void *plt_tbl;
19- unsigned int core_plt_offset;
20- unsigned int core_plt_size;
21- unsigned int init_plt_offset;
20- void *phys_plt_tbl;
21- void *virt_plt_tbl;
22- unsigned int phys_plt_offset;
23- unsigned int virt_plt_offset;
2224 };
2325
2426 typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */
25+++ b/arch/mips/kernel/module.c
26@@ -43,116 +43,6 @@ static struct mips_hi16 *mips_hi16_list;
27diff -urN linux-2.6.30.10/arch/mips/kernel/module.c linux-2.6.30.10.new//arch/mips/kernel/module.c
28--- linux-2.6.30.10/arch/mips/kernel/module.c 2010-01-29 16:12:01.000000000 +0100
29@@ -43,116 +43,6 @@
2730 static LIST_HEAD(dbe_list);
2831 static DEFINE_SPINLOCK(dbe_lock);
2932
...... 
142145 void *module_alloc(unsigned long size)
143146 {
144147 #ifdef MODULE_START
145@@ -168,45 +58,16 @@ void *module_alloc(unsigned long size)
148@@ -168,101 +58,23 @@
146149
147150     return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL);
148151 #else
...... 
190193     /* FIXME: If module_region == mod->init_region, trim exception
191194            table entries. */
192195 }
193@@ -214,24 +75,6 @@ void module_free(struct module *mod, voi
196
197-static void *__module_alloc(int size, bool phys)
198-{
199- void *ptr;
200-
201- if (phys)
202- ptr = kmalloc(size, GFP_KERNEL);
203- else
204- ptr = vmalloc(size);
205- return ptr;
206-}
207-
208-static void __module_free(void *ptr)
209-{
210- if (is_phys_addr(ptr))
211- kfree(ptr);
212- else
213- vfree(ptr);
214-}
215-
194216 int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
195217                   char *secstrings, struct module *mod)
196218 {
...... 
205227- core_size = get_plt_size(hdr, sechdrs, secstrings, symindex, false);
206228- init_size = get_plt_size(hdr, sechdrs, secstrings, symindex, true);
207229-
208- mod->arch.core_plt_offset = 0;
209- mod->arch.core_plt_size = core_size;
210- mod->arch.init_plt_offset = core_size;
211- mod->arch.plt_tbl = kmalloc(core_size + init_size, GFP_KERNEL);
212- if (!mod->arch.plt_tbl)
230- mod->arch.phys_plt_offset = 0;
231- mod->arch.virt_plt_offset = 0;
232- mod->arch.phys_plt_tbl = NULL;
233- mod->arch.virt_plt_tbl = NULL;
234-
235- if ((core_size + init_size) == 0)
236- return 0;
237-
238- mod->arch.phys_plt_tbl = __module_alloc(core_size + init_size, 1);
239- if (!mod->arch.phys_plt_tbl)
213240- return -ENOMEM;
214241-
242- mod->arch.virt_plt_tbl = __module_alloc(core_size + init_size, 0);
243- if (!mod->arch.virt_plt_tbl) {
244- __module_free(mod->arch.phys_plt_tbl);
245- mod->arch.phys_plt_tbl = NULL;
246- return -ENOMEM;
247- }
248-
215249     return 0;
216250 }
217251
218@@ -254,41 +97,27 @@ static int apply_r_mips_32_rela(struct m
252@@ -285,37 +97,27 @@
219253     return 0;
220254 }
221255
...... 
235269- tramp[1] = 0x27390000 | (v & 0xffff); /* addiu t9, t9, lo16 */
236270- tramp[2] = 0x03200008; /* jr t9 */
237271- tramp[3] = 0x00000000; /* nop */
238-
239- return (Elf_Addr) tramp;
240-}
241272+ if (v % 4) {
242273+ printk(KERN_ERR "module %s: dangerous relocation\n", me->name);
243274+ return -ENOEXEC;
244275+ }
245276
246-static Elf_Addr add_plt_entry(struct module *me, void *location, Elf_Addr v)
247-{
248- if (location >= me->module_core &&
249- location < me->module_core + me->core_size)
250- return add_plt_entry_to(&me->arch.core_plt_offset,
251- me->arch.plt_tbl, v);
277- return (Elf_Addr) tramp;
278-}
252279+ if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) {
253280+ printk(KERN_ERR
254281+ "module %s: relocation overflow\n",
...... 
256283+ return -ENOEXEC;
257284+ }
258285
259- if (location >= me->module_init &&
260- location < me->module_init + me->init_size)
261- return add_plt_entry_to(&me->arch.init_plt_offset,
262- me->arch.plt_tbl, v);
286-static Elf_Addr add_plt_entry(struct module *me, void *location, Elf_Addr v)
287-{
288- if (is_phys_addr(location))
289- return add_plt_entry_to(&me->arch.phys_plt_offset,
290- me->arch.phys_plt_tbl, v);
291- else
292- return add_plt_entry_to(&me->arch.virt_plt_offset,
293- me->arch.virt_plt_tbl, v);
263294+ *location = (*location & ~0x03ffffff) |
264295+ ((*location + (v >> 2)) & 0x03ffffff);
265296
266     return 0;
297+ return 0;
267298 }
268299
269300-static int set_r_mips_26(struct module *me, u32 *location, u32 ofs, Elf_Addr v)
...... 
271302 {
272303     if (v % 4) {
273304         printk(KERN_ERR "module %s: dangerous relocation\n", me->name);
274@@ -296,31 +125,17 @@ static int set_r_mips_26(struct module *
305@@ -323,31 +125,17 @@
275306     }
276307
277308     if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) {
...... 
306337 static int apply_r_mips_hi16_rel(struct module *me, u32 *location, Elf_Addr v)
307338 {
308339     struct mips_hi16 *n;
309@@ -585,23 +400,11 @@ int module_finalize(const Elf_Ehdr *hdr,
340@@ -612,32 +400,11 @@
310341         list_add(&me->arch.dbe_list, &dbe_list);
311342         spin_unlock_irq(&dbe_lock);
312343     }
313344-
314345- /* Get rid of the fixup trampoline if we're running the module
315346- * from physically mapped address space */
316- if (me->arch.core_plt_offset == 0 &&
317- me->arch.init_plt_offset == me->arch.core_plt_size &&
318- is_phys_addr(me->module_core)) {
319- kfree(me->arch.plt_tbl);
320- me->arch.plt_tbl = NULL;
347- if (me->arch.phys_plt_offset == 0) {
348- __module_free(me->arch.phys_plt_tbl);
349- me->arch.phys_plt_tbl = NULL;
350- }
351- if (me->arch.virt_plt_offset == 0) {
352- __module_free(me->arch.virt_plt_tbl);
353- me->arch.virt_plt_tbl = NULL;
321354- }
322355-
323356     return 0;
...... 
325358
326359 void module_arch_cleanup(struct module *mod)
327360 {
328- if (mod->arch.plt_tbl)
329- kfree(mod->arch.plt_tbl);
361- if (mod->arch.phys_plt_tbl) {
362- __module_free(mod->arch.phys_plt_tbl);
363- mod->arch.phys_plt_tbl = NULL;
364- }
365- if (mod->arch.virt_plt_tbl) {
366- __module_free(mod->arch.virt_plt_tbl);
367- mod->arch.virt_plt_tbl = NULL;
368- }
369-
330370     spin_lock_irq(&dbe_lock);
331371     list_del(&mod->arch.dbe_list);
332372     spin_unlock_irq(&dbe_lock);
target/linux/octeon/patches/106-no_module_reloc.patch
1diff -urN linux-2.6.30.7/arch/mips/Makefile linux-2.6.30.7.new/arch/mips/Makefile
2+++ linux-2.6.30.7.new/arch/mips/Makefile 2009-09-15 19:46:05.000000000 +0200
1diff -urN linux-2.6.30.10/arch/mips/Makefile linux-2.6.30.10.new//arch/mips/Makefile
2--- linux-2.6.30.10/arch/mips/Makefile 2010-01-29 16:12:01.000000000 +0100
33@@ -83,7 +83,7 @@
44 cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
55 cflags-y += -msoft-float
...... 
1010
1111 cflags-y += -ffreestanding
1212
13diff -urN linux-2.6.30.7/arch/mips/include/asm/module.h linux-2.6.30.7.new/arch/mips/include/asm/module.h
14+++ linux-2.6.30.7.new/arch/mips/include/asm/module.h 2009-09-15 19:46:05.000000000 +0200
13diff -urN linux-2.6.30.10/arch/mips/include/asm/module.h linux-2.6.30.10.new//arch/mips/include/asm/module.h
14--- linux-2.6.30.10/arch/mips/include/asm/module.h 2010-01-29 16:12:01.000000000 +0100
1515@@ -9,11 +9,6 @@
1616     struct list_head dbe_list;
1717     const struct exception_table_entry *dbe_start;
1818     const struct exception_table_entry *dbe_end;
1919-
20- void *plt_tbl;
21- unsigned int core_plt_offset;
22- unsigned int core_plt_size;
23- unsigned int init_plt_offset;
20- void *phys_plt_tbl;
21- void *virt_plt_tbl;
22- unsigned int phys_plt_offset;
23- unsigned int virt_plt_offset;
2424 };
2525
2626 typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */
27diff -urN linux-2.6.30.7/arch/mips/kernel/module.c linux-2.6.30.7.new/arch/mips/kernel/module.c
28+++ linux-2.6.30.7.new/arch/mips/kernel/module.c 2009-09-15 19:46:05.000000000 +0200
27diff -urN linux-2.6.30.10/arch/mips/kernel/module.c linux-2.6.30.10.new//arch/mips/kernel/module.c
28--- linux-2.6.30.10/arch/mips/kernel/module.c 2010-01-29 16:12:01.000000000 +0100
2929@@ -43,116 +43,6 @@
3030 static LIST_HEAD(dbe_list);
3131 static DEFINE_SPINLOCK(dbe_lock);
...... 
145145 void *module_alloc(unsigned long size)
146146 {
147147 #ifdef MODULE_START
148@@ -168,45 +58,16 @@
148@@ -168,101 +58,23 @@
149149
150150     return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL);
151151 #else
...... 
193193     /* FIXME: If module_region == mod->init_region, trim exception
194194            table entries. */
195195 }
196@@ -214,24 +75,6 @@
196
197-static void *__module_alloc(int size, bool phys)
198-{
199- void *ptr;
200-
201- if (phys)
202- ptr = kmalloc(size, GFP_KERNEL);
203- else
204- ptr = vmalloc(size);
205- return ptr;
206-}
207-
208-static void __module_free(void *ptr)
209-{
210- if (is_phys_addr(ptr))
211- kfree(ptr);
212- else
213- vfree(ptr);
214-}
215-
197216 int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
198217                   char *secstrings, struct module *mod)
199218 {
...... 
208227- core_size = get_plt_size(hdr, sechdrs, secstrings, symindex, false);
209228- init_size = get_plt_size(hdr, sechdrs, secstrings, symindex, true);
210229-
211- mod->arch.core_plt_offset = 0;
212- mod->arch.core_plt_size = core_size;
213- mod->arch.init_plt_offset = core_size;
214- mod->arch.plt_tbl = kmalloc(core_size + init_size, GFP_KERNEL);
215- if (!mod->arch.plt_tbl)
230- mod->arch.phys_plt_offset = 0;
231- mod->arch.virt_plt_offset = 0;
232- mod->arch.phys_plt_tbl = NULL;
233- mod->arch.virt_plt_tbl = NULL;
234-
235- if ((core_size + init_size) == 0)
236- return 0;
237-
238- mod->arch.phys_plt_tbl = __module_alloc(core_size + init_size, 1);
239- if (!mod->arch.phys_plt_tbl)
216240- return -ENOMEM;
217241-
242- mod->arch.virt_plt_tbl = __module_alloc(core_size + init_size, 0);
243- if (!mod->arch.virt_plt_tbl) {
244- __module_free(mod->arch.phys_plt_tbl);
245- mod->arch.phys_plt_tbl = NULL;
246- return -ENOMEM;
247- }
248-
218249     return 0;
219250 }
220251
221@@ -254,41 +97,27 @@
252@@ -285,37 +97,27 @@
222253     return 0;
223254 }
224255
...... 
238269- tramp[1] = 0x27390000 | (v & 0xffff); /* addiu t9, t9, lo16 */
239270- tramp[2] = 0x03200008; /* jr t9 */
240271- tramp[3] = 0x00000000; /* nop */
241-
242- return (Elf_Addr) tramp;
243-}
244272+ if (v % 4) {
245273+ printk(KERN_ERR "module %s: dangerous relocation\n", me->name);
246274+ return -ENOEXEC;
247275+ }
248276
249-static Elf_Addr add_plt_entry(struct module *me, void *location, Elf_Addr v)
250-{
251- if (location >= me->module_core &&
252- location < me->module_core + me->core_size)
253- return add_plt_entry_to(&me->arch.core_plt_offset,
254- me->arch.plt_tbl, v);
277- return (Elf_Addr) tramp;
278-}
255279+ if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) {
256280+ printk(KERN_ERR
257281+ "module %s: relocation overflow\n",
...... 
259283+ return -ENOEXEC;
260284+ }
261285
262- if (location >= me->module_init &&
263- location < me->module_init + me->init_size)
264- return add_plt_entry_to(&me->arch.init_plt_offset,
265- me->arch.plt_tbl, v);
286-static Elf_Addr add_plt_entry(struct module *me, void *location, Elf_Addr v)
287-{
288- if (is_phys_addr(location))
289- return add_plt_entry_to(&me->arch.phys_plt_offset,
290- me->arch.phys_plt_tbl, v);
291- else
292- return add_plt_entry_to(&me->arch.virt_plt_offset,
293- me->arch.virt_plt_tbl, v);
266294+ *location = (*location & ~0x03ffffff) |
267295+ ((*location + (v >> 2)) & 0x03ffffff);
268296
269     return 0;
297+ return 0;
270298 }
271299
272300-static int set_r_mips_26(struct module *me, u32 *location, u32 ofs, Elf_Addr v)
...... 
274302 {
275303     if (v % 4) {
276304         printk(KERN_ERR "module %s: dangerous relocation\n", me->name);
277@@ -296,31 +125,17 @@
305@@ -323,31 +125,17 @@
278306     }
279307
280308     if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) {
...... 
309337 static int apply_r_mips_hi16_rel(struct module *me, u32 *location, Elf_Addr v)
310338 {
311339     struct mips_hi16 *n;
312@@ -585,23 +400,11 @@
340@@ -612,32 +400,11 @@
313341         list_add(&me->arch.dbe_list, &dbe_list);
314342         spin_unlock_irq(&dbe_lock);
315343     }
316344-
317345- /* Get rid of the fixup trampoline if we're running the module
318346- * from physically mapped address space */
319- if (me->arch.core_plt_offset == 0 &&
320- me->arch.init_plt_offset == me->arch.core_plt_size &&
321- is_phys_addr(me->module_core)) {
322- kfree(me->arch.plt_tbl);
323- me->arch.plt_tbl = NULL;
347- if (me->arch.phys_plt_offset == 0) {
348- __module_free(me->arch.phys_plt_tbl);
349- me->arch.phys_plt_tbl = NULL;
350- }
351- if (me->arch.virt_plt_offset == 0) {
352- __module_free(me->arch.virt_plt_tbl);
353- me->arch.virt_plt_tbl = NULL;
324354- }
325355-
326356     return 0;
...... 
328358
329359 void module_arch_cleanup(struct module *mod)
330360 {
331- if (mod->arch.plt_tbl)
332- kfree(mod->arch.plt_tbl);
361- if (mod->arch.phys_plt_tbl) {
362- __module_free(mod->arch.phys_plt_tbl);
363- mod->arch.phys_plt_tbl = NULL;
364- }
365- if (mod->arch.virt_plt_tbl) {
366- __module_free(mod->arch.virt_plt_tbl);
367- mod->arch.virt_plt_tbl = NULL;
368- }
369-
333370     spin_lock_irq(&dbe_lock);
334371     list_del(&mod->arch.dbe_list);
335372     spin_unlock_irq(&dbe_lock);
target/linux/sibyte/patches/106-no_module_reloc.patch
1diff -urN linux-2.6.30.7/arch/mips/Makefile linux-2.6.30.7.new/arch/mips/Makefile
2+++ linux-2.6.30.7.new/arch/mips/Makefile 2009-09-15 19:46:05.000000000 +0200
1diff -urN linux-2.6.30.10/arch/mips/Makefile linux-2.6.30.10.new//arch/mips/Makefile
2--- linux-2.6.30.10/arch/mips/Makefile 2010-01-29 16:12:01.000000000 +0100
33@@ -83,7 +83,7 @@
44 cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
55 cflags-y += -msoft-float
...... 
1010
1111 cflags-y += -ffreestanding
1212
13diff -urN linux-2.6.30.7/arch/mips/include/asm/module.h linux-2.6.30.7.new/arch/mips/include/asm/module.h
14+++ linux-2.6.30.7.new/arch/mips/include/asm/module.h 2009-09-15 19:46:05.000000000 +0200
13diff -urN linux-2.6.30.10/arch/mips/include/asm/module.h linux-2.6.30.10.new//arch/mips/include/asm/module.h
14--- linux-2.6.30.10/arch/mips/include/asm/module.h 2010-01-29 16:12:01.000000000 +0100
1515@@ -9,11 +9,6 @@
1616     struct list_head dbe_list;
1717     const struct exception_table_entry *dbe_start;
1818     const struct exception_table_entry *dbe_end;
1919-
20- void *plt_tbl;
21- unsigned int core_plt_offset;
22- unsigned int core_plt_size;
23- unsigned int init_plt_offset;
20- void *phys_plt_tbl;
21- void *virt_plt_tbl;
22- unsigned int phys_plt_offset;
23- unsigned int virt_plt_offset;
2424 };
2525
2626 typedef uint8_t Elf64_Byte; /* Type for a 8-bit quantity. */
27diff -urN linux-2.6.30.7/arch/mips/kernel/module.c linux-2.6.30.7.new/arch/mips/kernel/module.c
28+++ linux-2.6.30.7.new/arch/mips/kernel/module.c 2009-09-15 19:46:05.000000000 +0200
27diff -urN linux-2.6.30.10/arch/mips/kernel/module.c linux-2.6.30.10.new//arch/mips/kernel/module.c
28--- linux-2.6.30.10/arch/mips/kernel/module.c 2010-01-29 16:12:01.000000000 +0100
2929@@ -43,116 +43,6 @@
3030 static LIST_HEAD(dbe_list);
3131 static DEFINE_SPINLOCK(dbe_lock);
...... 
145145 void *module_alloc(unsigned long size)
146146 {
147147 #ifdef MODULE_START
148@@ -168,45 +58,16 @@
148@@ -168,101 +58,23 @@
149149
150150     return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL);
151151 #else
...... 
193193     /* FIXME: If module_region == mod->init_region, trim exception
194194            table entries. */
195195 }
196@@ -214,24 +75,6 @@
196
197-static void *__module_alloc(int size, bool phys)
198-{
199- void *ptr;
200-
201- if (phys)
202- ptr = kmalloc(size, GFP_KERNEL);
203- else
204- ptr = vmalloc(size);
205- return ptr;
206-}
207-
208-static void __module_free(void *ptr)
209-{
210- if (is_phys_addr(ptr))
211- kfree(ptr);
212- else
213- vfree(ptr);
214-}
215-
197216 int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
198217                   char *secstrings, struct module *mod)
199218 {
...... 
208227- core_size = get_plt_size(hdr, sechdrs, secstrings, symindex, false);
209228- init_size = get_plt_size(hdr, sechdrs, secstrings, symindex, true);
210229-
211- mod->arch.core_plt_offset = 0;
212- mod->arch.core_plt_size = core_size;
213- mod->arch.init_plt_offset = core_size;
214- mod->arch.plt_tbl = kmalloc(core_size + init_size, GFP_KERNEL);
215- if (!mod->arch.plt_tbl)
230- mod->arch.phys_plt_offset = 0;
231- mod->arch.virt_plt_offset = 0;
232- mod->arch.phys_plt_tbl = NULL;
233- mod->arch.virt_plt_tbl = NULL;
234-
235- if ((core_size + init_size) == 0)
236- return 0;
237-
238- mod->arch.phys_plt_tbl = __module_alloc(core_size + init_size, 1);
239- if (!mod->arch.phys_plt_tbl)
216240- return -ENOMEM;
217241-
242- mod->arch.virt_plt_tbl = __module_alloc(core_size + init_size, 0);
243- if (!mod->arch.virt_plt_tbl) {
244- __module_free(mod->arch.phys_plt_tbl);
245- mod->arch.phys_plt_tbl = NULL;
246- return -ENOMEM;
247- }
248-
218249     return 0;
219250 }
220251
221@@ -254,41 +97,27 @@
252@@ -285,37 +97,27 @@
222253     return 0;
223254 }
224255
...... 
238269- tramp[1] = 0x27390000 | (v & 0xffff); /* addiu t9, t9, lo16 */
239270- tramp[2] = 0x03200008; /* jr t9 */
240271- tramp[3] = 0x00000000; /* nop */
241-
242- return (Elf_Addr) tramp;
243-}
244272+ if (v % 4) {
245273+ printk(KERN_ERR "module %s: dangerous relocation\n", me->name);
246274+ return -ENOEXEC;
247275+ }
248276
249-static Elf_Addr add_plt_entry(struct module *me, void *location, Elf_Addr v)
250-{
251- if (location >= me->module_core &&
252- location < me->module_core + me->core_size)
253- return add_plt_entry_to(&me->arch.core_plt_offset,
254- me->arch.plt_tbl, v);
277- return (Elf_Addr) tramp;
278-}
255279+ if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) {
256280+ printk(KERN_ERR
257281+ "module %s: relocation overflow\n",
...... 
259283+ return -ENOEXEC;
260284+ }
261285
262- if (location >= me->module_init &&
263- location < me->module_init + me->init_size)
264- return add_plt_entry_to(&me->arch.init_plt_offset,
265- me->arch.plt_tbl, v);
286-static Elf_Addr add_plt_entry(struct module *me, void *location, Elf_Addr v)
287-{
288- if (is_phys_addr(location))
289- return add_plt_entry_to(&me->arch.phys_plt_offset,
290- me->arch.phys_plt_tbl, v);
291- else
292- return add_plt_entry_to(&me->arch.virt_plt_offset,
293- me->arch.virt_plt_tbl, v);
266294+ *location = (*location & ~0x03ffffff) |
267295+ ((*location + (v >> 2)) & 0x03ffffff);
268296
269     return 0;
297+ return 0;
270298 }
271299
272300-static int set_r_mips_26(struct module *me, u32 *location, u32 ofs, Elf_Addr v)
...... 
274302 {
275303     if (v % 4) {
276304         printk(KERN_ERR "module %s: dangerous relocation\n", me->name);
277@@ -296,31 +125,17 @@
305@@ -323,31 +125,17 @@
278306     }
279307
280308     if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) {
...... 
309337 static int apply_r_mips_hi16_rel(struct module *me, u32 *location, Elf_Addr v)
310338 {
311339     struct mips_hi16 *n;
312@@ -585,23 +400,11 @@
340@@ -612,32 +400,11 @@
313341         list_add(&me->arch.dbe_list, &dbe_list);
314342         spin_unlock_irq(&dbe_lock);
315343     }
316344-
317345- /* Get rid of the fixup trampoline if we're running the module
318346- * from physically mapped address space */
319- if (me->arch.core_plt_offset == 0 &&
320- me->arch.init_plt_offset == me->arch.core_plt_size &&
321- is_phys_addr(me->module_core)) {
322- kfree(me->arch.plt_tbl);
323- me->arch.plt_tbl = NULL;
347- if (me->arch.phys_plt_offset == 0) {
348- __module_free(me->arch.phys_plt_tbl);
349- me->arch.phys_plt_tbl = NULL;
350- }
351- if (me->arch.virt_plt_offset == 0) {
352- __module_free(me->arch.virt_plt_tbl);
353- me->arch.virt_plt_tbl = NULL;
324354- }
325355-
326356     return 0;
...... 
328358
329359 void module_arch_cleanup(struct module *mod)
330360 {
331- if (mod->arch.plt_tbl)
332- kfree(mod->arch.plt_tbl);
361- if (mod->arch.phys_plt_tbl) {
362- __module_free(mod->arch.phys_plt_tbl);
363- mod->arch.phys_plt_tbl = NULL;
364- }
365- if (mod->arch.virt_plt_tbl) {
366- __module_free(mod->arch.virt_plt_tbl);
367- mod->arch.virt_plt_tbl = NULL;
368- }
369-
333370     spin_lock_irq(&dbe_lock);
334371     list_del(&mod->arch.dbe_list);
335372     spin_unlock_irq(&dbe_lock);

Archive Download the corresponding diff file



interactive