diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2015-11-25 18:14:08 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2015-12-04 16:46:25 -0500 |
commit | 7523e4dc5057e157212b4741abd6256e03404cf1 (patch) | |
tree | 034014d98dea3f675e8e138bc34bd4e0a860b12b /arch | |
parent | c65abf358f211c3f88c8ed714dff25775ab49fc1 (diff) |
module: use a structure to encapsulate layout.
Makes it easier to handle init vs core cleanly, though the change is
fairly invasive across random architectures.
It simplifies the rbtree code immediately, however, while keeping the
core data together in the same cachline (now iff the rbtree code is
enabled).
Acked-by: Peter Zijlstra <peterz@infradead.org>
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/alpha/kernel/module.c | 2 | ||||
-rw-r--r-- | arch/arc/kernel/unwind.c | 4 | ||||
-rw-r--r-- | arch/arm/kernel/module-plts.c | 2 | ||||
-rw-r--r-- | arch/avr32/kernel/module.c | 12 | ||||
-rw-r--r-- | arch/ia64/kernel/module.c | 14 | ||||
-rw-r--r-- | arch/metag/kernel/module.c | 4 | ||||
-rw-r--r-- | arch/mips/kernel/vpe.c | 6 | ||||
-rw-r--r-- | arch/parisc/kernel/module.c | 32 | ||||
-rw-r--r-- | arch/powerpc/kernel/module_32.c | 6 | ||||
-rw-r--r-- | arch/s390/kernel/module.c | 22 | ||||
-rw-r--r-- | arch/x86/kernel/livepatch.c | 6 |
11 files changed, 55 insertions, 55 deletions
diff --git a/arch/alpha/kernel/module.c b/arch/alpha/kernel/module.c index 2fd00b7077e4..936bc8f89a67 100644 --- a/arch/alpha/kernel/module.c +++ b/arch/alpha/kernel/module.c | |||
@@ -160,7 +160,7 @@ apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab, | |||
160 | 160 | ||
161 | /* The small sections were sorted to the end of the segment. | 161 | /* The small sections were sorted to the end of the segment. |
162 | The following should definitely cover them. */ | 162 | The following should definitely cover them. */ |
163 | gp = (u64)me->module_core + me->core_size - 0x8000; | 163 | gp = (u64)me->core_layout.base + me->core_layout.size - 0x8000; |
164 | got = sechdrs[me->arch.gotsecindex].sh_addr; | 164 | got = sechdrs[me->arch.gotsecindex].sh_addr; |
165 | 165 | ||
166 | for (i = 0; i < n; i++) { | 166 | for (i = 0; i < n; i++) { |
diff --git a/arch/arc/kernel/unwind.c b/arch/arc/kernel/unwind.c index 93c6ea52b671..e0034a6656ef 100644 --- a/arch/arc/kernel/unwind.c +++ b/arch/arc/kernel/unwind.c | |||
@@ -372,8 +372,8 @@ void *unwind_add_table(struct module *module, const void *table_start, | |||
372 | return NULL; | 372 | return NULL; |
373 | 373 | ||
374 | init_unwind_table(table, module->name, | 374 | init_unwind_table(table, module->name, |
375 | module->module_core, module->core_size, | 375 | module->core_layout.base, module->core_layout.size, |
376 | module->module_init, module->init_size, | 376 | module->init_layout.base, module->init_layout.size, |
377 | table_start, table_size, | 377 | table_start, table_size, |
378 | NULL, 0); | 378 | NULL, 0); |
379 | 379 | ||
diff --git a/arch/arm/kernel/module-plts.c b/arch/arm/kernel/module-plts.c index 097e2e201b9f..0c7efc3446c0 100644 --- a/arch/arm/kernel/module-plts.c +++ b/arch/arm/kernel/module-plts.c | |||
@@ -32,7 +32,7 @@ struct plt_entries { | |||
32 | 32 | ||
33 | static bool in_init(const struct module *mod, u32 addr) | 33 | static bool in_init(const struct module *mod, u32 addr) |
34 | { | 34 | { |
35 | return addr - (u32)mod->module_init < mod->init_size; | 35 | return addr - (u32)mod->init_layout.base < mod->init_layout.size; |
36 | } | 36 | } |
37 | 37 | ||
38 | u32 get_module_plt(struct module *mod, unsigned long loc, Elf32_Addr val) | 38 | u32 get_module_plt(struct module *mod, unsigned long loc, Elf32_Addr val) |
diff --git a/arch/avr32/kernel/module.c b/arch/avr32/kernel/module.c index 164efa009e5b..2b4c54c04cb6 100644 --- a/arch/avr32/kernel/module.c +++ b/arch/avr32/kernel/module.c | |||
@@ -118,9 +118,9 @@ int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, | |||
118 | * Increase core size to make room for GOT and set start | 118 | * Increase core size to make room for GOT and set start |
119 | * offset for GOT. | 119 | * offset for GOT. |
120 | */ | 120 | */ |
121 | module->core_size = ALIGN(module->core_size, 4); | 121 | module->core_layout.size = ALIGN(module->core_layout.size, 4); |
122 | module->arch.got_offset = module->core_size; | 122 | module->arch.got_offset = module->core_layout.size; |
123 | module->core_size += module->arch.got_size; | 123 | module->core_layout.size += module->arch.got_size; |
124 | 124 | ||
125 | return 0; | 125 | return 0; |
126 | 126 | ||
@@ -177,7 +177,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab, | |||
177 | if (!info->got_initialized) { | 177 | if (!info->got_initialized) { |
178 | Elf32_Addr *gotent; | 178 | Elf32_Addr *gotent; |
179 | 179 | ||
180 | gotent = (module->module_core | 180 | gotent = (module->core_layout.base |
181 | + module->arch.got_offset | 181 | + module->arch.got_offset |
182 | + info->got_offset); | 182 | + info->got_offset); |
183 | *gotent = relocation; | 183 | *gotent = relocation; |
@@ -255,8 +255,8 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab, | |||
255 | */ | 255 | */ |
256 | pr_debug("GOTPC: PC=0x%x, got_offset=0x%lx, core=0x%p\n", | 256 | pr_debug("GOTPC: PC=0x%x, got_offset=0x%lx, core=0x%p\n", |
257 | relocation, module->arch.got_offset, | 257 | relocation, module->arch.got_offset, |
258 | module->module_core); | 258 | module->core_layout.base); |
259 | relocation -= ((unsigned long)module->module_core | 259 | relocation -= ((unsigned long)module->core_layout.base |
260 | + module->arch.got_offset); | 260 | + module->arch.got_offset); |
261 | *location = relocation; | 261 | *location = relocation; |
262 | break; | 262 | break; |
diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c index b15933c31b2f..6ab0ae7d6535 100644 --- a/arch/ia64/kernel/module.c +++ b/arch/ia64/kernel/module.c | |||
@@ -486,13 +486,13 @@ module_frob_arch_sections (Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, char *secstrings, | |||
486 | static inline int | 486 | static inline int |
487 | in_init (const struct module *mod, uint64_t addr) | 487 | in_init (const struct module *mod, uint64_t addr) |
488 | { | 488 | { |
489 | return addr - (uint64_t) mod->module_init < mod->init_size; | 489 | return addr - (uint64_t) mod->init_layout.base < mod->init_layout.size; |
490 | } | 490 | } |
491 | 491 | ||
492 | static inline int | 492 | static inline int |
493 | in_core (const struct module *mod, uint64_t addr) | 493 | in_core (const struct module *mod, uint64_t addr) |
494 | { | 494 | { |
495 | return addr - (uint64_t) mod->module_core < mod->core_size; | 495 | return addr - (uint64_t) mod->core_layout.base < mod->core_layout.size; |
496 | } | 496 | } |
497 | 497 | ||
498 | static inline int | 498 | static inline int |
@@ -675,7 +675,7 @@ do_reloc (struct module *mod, uint8_t r_type, Elf64_Sym *sym, uint64_t addend, | |||
675 | break; | 675 | break; |
676 | 676 | ||
677 | case RV_BDREL: | 677 | case RV_BDREL: |
678 | val -= (uint64_t) (in_init(mod, val) ? mod->module_init : mod->module_core); | 678 | val -= (uint64_t) (in_init(mod, val) ? mod->init_layout.base : mod->core_layout.base); |
679 | break; | 679 | break; |
680 | 680 | ||
681 | case RV_LTV: | 681 | case RV_LTV: |
@@ -810,15 +810,15 @@ apply_relocate_add (Elf64_Shdr *sechdrs, const char *strtab, unsigned int symind | |||
810 | * addresses have been selected... | 810 | * addresses have been selected... |
811 | */ | 811 | */ |
812 | uint64_t gp; | 812 | uint64_t gp; |
813 | if (mod->core_size > MAX_LTOFF) | 813 | if (mod->core_layout.size > MAX_LTOFF) |
814 | /* | 814 | /* |
815 | * This takes advantage of fact that SHF_ARCH_SMALL gets allocated | 815 | * This takes advantage of fact that SHF_ARCH_SMALL gets allocated |
816 | * at the end of the module. | 816 | * at the end of the module. |
817 | */ | 817 | */ |
818 | gp = mod->core_size - MAX_LTOFF / 2; | 818 | gp = mod->core_layout.size - MAX_LTOFF / 2; |
819 | else | 819 | else |
820 | gp = mod->core_size / 2; | 820 | gp = mod->core_layout.size / 2; |
821 | gp = (uint64_t) mod->module_core + ((gp + 7) & -8); | 821 | gp = (uint64_t) mod->core_layout.base + ((gp + 7) & -8); |
822 | mod->arch.gp = gp; | 822 | mod->arch.gp = gp; |
823 | DEBUGP("%s: placing gp at 0x%lx\n", __func__, gp); | 823 | DEBUGP("%s: placing gp at 0x%lx\n", __func__, gp); |
824 | } | 824 | } |
diff --git a/arch/metag/kernel/module.c b/arch/metag/kernel/module.c index 986331cd0a52..bb8dfba9a763 100644 --- a/arch/metag/kernel/module.c +++ b/arch/metag/kernel/module.c | |||
@@ -176,8 +176,8 @@ static uint32_t do_plt_call(void *location, Elf32_Addr val, | |||
176 | tramp[1] = 0xac000001 | ((val & 0x0000ffff) << 3); | 176 | tramp[1] = 0xac000001 | ((val & 0x0000ffff) << 3); |
177 | 177 | ||
178 | /* Init, or core PLT? */ | 178 | /* Init, or core PLT? */ |
179 | if (location >= mod->module_core | 179 | if (location >= mod->core_layout.base |
180 | && location < mod->module_core + mod->core_size) | 180 | && location < mod->core_layout.base + mod->core_layout.size) |
181 | entry = (void *)sechdrs[mod->arch.core_plt_section].sh_addr; | 181 | entry = (void *)sechdrs[mod->arch.core_plt_section].sh_addr; |
182 | else | 182 | else |
183 | entry = (void *)sechdrs[mod->arch.init_plt_section].sh_addr; | 183 | entry = (void *)sechdrs[mod->arch.init_plt_section].sh_addr; |
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c index 9067b651c7a2..544ea21bfef9 100644 --- a/arch/mips/kernel/vpe.c +++ b/arch/mips/kernel/vpe.c | |||
@@ -205,11 +205,11 @@ static void layout_sections(struct module *mod, const Elf_Ehdr *hdr, | |||
205 | || s->sh_entsize != ~0UL) | 205 | || s->sh_entsize != ~0UL) |
206 | continue; | 206 | continue; |
207 | s->sh_entsize = | 207 | s->sh_entsize = |
208 | get_offset((unsigned long *)&mod->core_size, s); | 208 | get_offset((unsigned long *)&mod->core_layout.size, s); |
209 | } | 209 | } |
210 | 210 | ||
211 | if (m == 0) | 211 | if (m == 0) |
212 | mod->core_text_size = mod->core_size; | 212 | mod->core_layout.text_size = mod->core_layout.size; |
213 | 213 | ||
214 | } | 214 | } |
215 | } | 215 | } |
@@ -641,7 +641,7 @@ static int vpe_elfload(struct vpe *v) | |||
641 | layout_sections(&mod, hdr, sechdrs, secstrings); | 641 | layout_sections(&mod, hdr, sechdrs, secstrings); |
642 | } | 642 | } |
643 | 643 | ||
644 | v->load_addr = alloc_progmem(mod.core_size); | 644 | v->load_addr = alloc_progmem(mod.core_layout.size); |
645 | if (!v->load_addr) | 645 | if (!v->load_addr) |
646 | return -ENOMEM; | 646 | return -ENOMEM; |
647 | 647 | ||
diff --git a/arch/parisc/kernel/module.c b/arch/parisc/kernel/module.c index 3c63a820fcda..b9d75d9fa9ac 100644 --- a/arch/parisc/kernel/module.c +++ b/arch/parisc/kernel/module.c | |||
@@ -42,9 +42,9 @@ | |||
42 | * We are not doing SEGREL32 handling correctly. According to the ABI, we | 42 | * We are not doing SEGREL32 handling correctly. According to the ABI, we |
43 | * should do a value offset, like this: | 43 | * should do a value offset, like this: |
44 | * if (in_init(me, (void *)val)) | 44 | * if (in_init(me, (void *)val)) |
45 | * val -= (uint32_t)me->module_init; | 45 | * val -= (uint32_t)me->init_layout.base; |
46 | * else | 46 | * else |
47 | * val -= (uint32_t)me->module_core; | 47 | * val -= (uint32_t)me->core_layout.base; |
48 | * However, SEGREL32 is used only for PARISC unwind entries, and we want | 48 | * However, SEGREL32 is used only for PARISC unwind entries, and we want |
49 | * those entries to have an absolute address, and not just an offset. | 49 | * those entries to have an absolute address, and not just an offset. |
50 | * | 50 | * |
@@ -100,14 +100,14 @@ | |||
100 | * or init pieces the location is */ | 100 | * or init pieces the location is */ |
101 | static inline int in_init(struct module *me, void *loc) | 101 | static inline int in_init(struct module *me, void *loc) |
102 | { | 102 | { |
103 | return (loc >= me->module_init && | 103 | return (loc >= me->init_layout.base && |
104 | loc <= (me->module_init + me->init_size)); | 104 | loc <= (me->init_layout.base + me->init_layout.size)); |
105 | } | 105 | } |
106 | 106 | ||
107 | static inline int in_core(struct module *me, void *loc) | 107 | static inline int in_core(struct module *me, void *loc) |
108 | { | 108 | { |
109 | return (loc >= me->module_core && | 109 | return (loc >= me->core_layout.base && |
110 | loc <= (me->module_core + me->core_size)); | 110 | loc <= (me->core_layout.base + me->core_layout.size)); |
111 | } | 111 | } |
112 | 112 | ||
113 | static inline int in_local(struct module *me, void *loc) | 113 | static inline int in_local(struct module *me, void *loc) |
@@ -367,13 +367,13 @@ int module_frob_arch_sections(CONST Elf_Ehdr *hdr, | |||
367 | } | 367 | } |
368 | 368 | ||
369 | /* align things a bit */ | 369 | /* align things a bit */ |
370 | me->core_size = ALIGN(me->core_size, 16); | 370 | me->core_layout.size = ALIGN(me->core_layout.size, 16); |
371 | me->arch.got_offset = me->core_size; | 371 | me->arch.got_offset = me->core_layout.size; |
372 | me->core_size += gots * sizeof(struct got_entry); | 372 | me->core_layout.size += gots * sizeof(struct got_entry); |
373 | 373 | ||
374 | me->core_size = ALIGN(me->core_size, 16); | 374 | me->core_layout.size = ALIGN(me->core_layout.size, 16); |
375 | me->arch.fdesc_offset = me->core_size; | 375 | me->arch.fdesc_offset = me->core_layout.size; |
376 | me->core_size += fdescs * sizeof(Elf_Fdesc); | 376 | me->core_layout.size += fdescs * sizeof(Elf_Fdesc); |
377 | 377 | ||
378 | me->arch.got_max = gots; | 378 | me->arch.got_max = gots; |
379 | me->arch.fdesc_max = fdescs; | 379 | me->arch.fdesc_max = fdescs; |
@@ -391,7 +391,7 @@ static Elf64_Word get_got(struct module *me, unsigned long value, long addend) | |||
391 | 391 | ||
392 | BUG_ON(value == 0); | 392 | BUG_ON(value == 0); |
393 | 393 | ||
394 | got = me->module_core + me->arch.got_offset; | 394 | got = me->core_layout.base + me->arch.got_offset; |
395 | for (i = 0; got[i].addr; i++) | 395 | for (i = 0; got[i].addr; i++) |
396 | if (got[i].addr == value) | 396 | if (got[i].addr == value) |
397 | goto out; | 397 | goto out; |
@@ -409,7 +409,7 @@ static Elf64_Word get_got(struct module *me, unsigned long value, long addend) | |||
409 | #ifdef CONFIG_64BIT | 409 | #ifdef CONFIG_64BIT |
410 | static Elf_Addr get_fdesc(struct module *me, unsigned long value) | 410 | static Elf_Addr get_fdesc(struct module *me, unsigned long value) |
411 | { | 411 | { |
412 | Elf_Fdesc *fdesc = me->module_core + me->arch.fdesc_offset; | 412 | Elf_Fdesc *fdesc = me->core_layout.base + me->arch.fdesc_offset; |
413 | 413 | ||
414 | if (!value) { | 414 | if (!value) { |
415 | printk(KERN_ERR "%s: zero OPD requested!\n", me->name); | 415 | printk(KERN_ERR "%s: zero OPD requested!\n", me->name); |
@@ -427,7 +427,7 @@ static Elf_Addr get_fdesc(struct module *me, unsigned long value) | |||
427 | 427 | ||
428 | /* Create new one */ | 428 | /* Create new one */ |
429 | fdesc->addr = value; | 429 | fdesc->addr = value; |
430 | fdesc->gp = (Elf_Addr)me->module_core + me->arch.got_offset; | 430 | fdesc->gp = (Elf_Addr)me->core_layout.base + me->arch.got_offset; |
431 | return (Elf_Addr)fdesc; | 431 | return (Elf_Addr)fdesc; |
432 | } | 432 | } |
433 | #endif /* CONFIG_64BIT */ | 433 | #endif /* CONFIG_64BIT */ |
@@ -839,7 +839,7 @@ register_unwind_table(struct module *me, | |||
839 | 839 | ||
840 | table = (unsigned char *)sechdrs[me->arch.unwind_section].sh_addr; | 840 | table = (unsigned char *)sechdrs[me->arch.unwind_section].sh_addr; |
841 | end = table + sechdrs[me->arch.unwind_section].sh_size; | 841 | end = table + sechdrs[me->arch.unwind_section].sh_size; |
842 | gp = (Elf_Addr)me->module_core + me->arch.got_offset; | 842 | gp = (Elf_Addr)me->core_layout.base + me->arch.got_offset; |
843 | 843 | ||
844 | DEBUGP("register_unwind_table(), sect = %d at 0x%p - 0x%p (gp=0x%lx)\n", | 844 | DEBUGP("register_unwind_table(), sect = %d at 0x%p - 0x%p (gp=0x%lx)\n", |
845 | me->arch.unwind_section, table, end, gp); | 845 | me->arch.unwind_section, table, end, gp); |
diff --git a/arch/powerpc/kernel/module_32.c b/arch/powerpc/kernel/module_32.c index c94d2e018d84..2c01665eb410 100644 --- a/arch/powerpc/kernel/module_32.c +++ b/arch/powerpc/kernel/module_32.c | |||
@@ -188,8 +188,8 @@ static uint32_t do_plt_call(void *location, | |||
188 | 188 | ||
189 | pr_debug("Doing plt for call to 0x%x at 0x%x\n", val, (unsigned int)location); | 189 | pr_debug("Doing plt for call to 0x%x at 0x%x\n", val, (unsigned int)location); |
190 | /* Init, or core PLT? */ | 190 | /* Init, or core PLT? */ |
191 | if (location >= mod->module_core | 191 | if (location >= mod->core_layout.base |
192 | && location < mod->module_core + mod->core_size) | 192 | && location < mod->core_layout.base + mod->core_layout.size) |
193 | entry = (void *)sechdrs[mod->arch.core_plt_section].sh_addr; | 193 | entry = (void *)sechdrs[mod->arch.core_plt_section].sh_addr; |
194 | else | 194 | else |
195 | entry = (void *)sechdrs[mod->arch.init_plt_section].sh_addr; | 195 | entry = (void *)sechdrs[mod->arch.init_plt_section].sh_addr; |
@@ -296,7 +296,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, | |||
296 | } | 296 | } |
297 | #ifdef CONFIG_DYNAMIC_FTRACE | 297 | #ifdef CONFIG_DYNAMIC_FTRACE |
298 | module->arch.tramp = | 298 | module->arch.tramp = |
299 | do_plt_call(module->module_core, | 299 | do_plt_call(module->core_layout.base, |
300 | (unsigned long)ftrace_caller, | 300 | (unsigned long)ftrace_caller, |
301 | sechdrs, module); | 301 | sechdrs, module); |
302 | #endif | 302 | #endif |
diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c index 0c1a679314dd..7873e171457c 100644 --- a/arch/s390/kernel/module.c +++ b/arch/s390/kernel/module.c | |||
@@ -159,11 +159,11 @@ int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, | |||
159 | 159 | ||
160 | /* Increase core size by size of got & plt and set start | 160 | /* Increase core size by size of got & plt and set start |
161 | offsets for got and plt. */ | 161 | offsets for got and plt. */ |
162 | me->core_size = ALIGN(me->core_size, 4); | 162 | me->core_layout.size = ALIGN(me->core_layout.size, 4); |
163 | me->arch.got_offset = me->core_size; | 163 | me->arch.got_offset = me->core_layout.size; |
164 | me->core_size += me->arch.got_size; | 164 | me->core_layout.size += me->arch.got_size; |
165 | me->arch.plt_offset = me->core_size; | 165 | me->arch.plt_offset = me->core_layout.size; |
166 | me->core_size += me->arch.plt_size; | 166 | me->core_layout.size += me->arch.plt_size; |
167 | return 0; | 167 | return 0; |
168 | } | 168 | } |
169 | 169 | ||
@@ -279,7 +279,7 @@ static int apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab, | |||
279 | if (info->got_initialized == 0) { | 279 | if (info->got_initialized == 0) { |
280 | Elf_Addr *gotent; | 280 | Elf_Addr *gotent; |
281 | 281 | ||
282 | gotent = me->module_core + me->arch.got_offset + | 282 | gotent = me->core_layout.base + me->arch.got_offset + |
283 | info->got_offset; | 283 | info->got_offset; |
284 | *gotent = val; | 284 | *gotent = val; |
285 | info->got_initialized = 1; | 285 | info->got_initialized = 1; |
@@ -302,7 +302,7 @@ static int apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab, | |||
302 | rc = apply_rela_bits(loc, val, 0, 64, 0); | 302 | rc = apply_rela_bits(loc, val, 0, 64, 0); |
303 | else if (r_type == R_390_GOTENT || | 303 | else if (r_type == R_390_GOTENT || |
304 | r_type == R_390_GOTPLTENT) { | 304 | r_type == R_390_GOTPLTENT) { |
305 | val += (Elf_Addr) me->module_core - loc; | 305 | val += (Elf_Addr) me->core_layout.base - loc; |
306 | rc = apply_rela_bits(loc, val, 1, 32, 1); | 306 | rc = apply_rela_bits(loc, val, 1, 32, 1); |
307 | } | 307 | } |
308 | break; | 308 | break; |
@@ -315,7 +315,7 @@ static int apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab, | |||
315 | case R_390_PLTOFF64: /* 16 bit offset from GOT to PLT. */ | 315 | case R_390_PLTOFF64: /* 16 bit offset from GOT to PLT. */ |
316 | if (info->plt_initialized == 0) { | 316 | if (info->plt_initialized == 0) { |
317 | unsigned int *ip; | 317 | unsigned int *ip; |
318 | ip = me->module_core + me->arch.plt_offset + | 318 | ip = me->core_layout.base + me->arch.plt_offset + |
319 | info->plt_offset; | 319 | info->plt_offset; |
320 | ip[0] = 0x0d10e310; /* basr 1,0; lg 1,10(1); br 1 */ | 320 | ip[0] = 0x0d10e310; /* basr 1,0; lg 1,10(1); br 1 */ |
321 | ip[1] = 0x100a0004; | 321 | ip[1] = 0x100a0004; |
@@ -334,7 +334,7 @@ static int apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab, | |||
334 | val - loc + 0xffffUL < 0x1ffffeUL) || | 334 | val - loc + 0xffffUL < 0x1ffffeUL) || |
335 | (r_type == R_390_PLT32DBL && | 335 | (r_type == R_390_PLT32DBL && |
336 | val - loc + 0xffffffffULL < 0x1fffffffeULL))) | 336 | val - loc + 0xffffffffULL < 0x1fffffffeULL))) |
337 | val = (Elf_Addr) me->module_core + | 337 | val = (Elf_Addr) me->core_layout.base + |
338 | me->arch.plt_offset + | 338 | me->arch.plt_offset + |
339 | info->plt_offset; | 339 | info->plt_offset; |
340 | val += rela->r_addend - loc; | 340 | val += rela->r_addend - loc; |
@@ -356,7 +356,7 @@ static int apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab, | |||
356 | case R_390_GOTOFF32: /* 32 bit offset to GOT. */ | 356 | case R_390_GOTOFF32: /* 32 bit offset to GOT. */ |
357 | case R_390_GOTOFF64: /* 64 bit offset to GOT. */ | 357 | case R_390_GOTOFF64: /* 64 bit offset to GOT. */ |
358 | val = val + rela->r_addend - | 358 | val = val + rela->r_addend - |
359 | ((Elf_Addr) me->module_core + me->arch.got_offset); | 359 | ((Elf_Addr) me->core_layout.base + me->arch.got_offset); |
360 | if (r_type == R_390_GOTOFF16) | 360 | if (r_type == R_390_GOTOFF16) |
361 | rc = apply_rela_bits(loc, val, 0, 16, 0); | 361 | rc = apply_rela_bits(loc, val, 0, 16, 0); |
362 | else if (r_type == R_390_GOTOFF32) | 362 | else if (r_type == R_390_GOTOFF32) |
@@ -366,7 +366,7 @@ static int apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab, | |||
366 | break; | 366 | break; |
367 | case R_390_GOTPC: /* 32 bit PC relative offset to GOT. */ | 367 | case R_390_GOTPC: /* 32 bit PC relative offset to GOT. */ |
368 | case R_390_GOTPCDBL: /* 32 bit PC rel. off. to GOT shifted by 1. */ | 368 | case R_390_GOTPCDBL: /* 32 bit PC rel. off. to GOT shifted by 1. */ |
369 | val = (Elf_Addr) me->module_core + me->arch.got_offset + | 369 | val = (Elf_Addr) me->core_layout.base + me->arch.got_offset + |
370 | rela->r_addend - loc; | 370 | rela->r_addend - loc; |
371 | if (r_type == R_390_GOTPC) | 371 | if (r_type == R_390_GOTPC) |
372 | rc = apply_rela_bits(loc, val, 1, 32, 0); | 372 | rc = apply_rela_bits(loc, val, 1, 32, 0); |
diff --git a/arch/x86/kernel/livepatch.c b/arch/x86/kernel/livepatch.c index d1d35ccffed3..bcc06e82a593 100644 --- a/arch/x86/kernel/livepatch.c +++ b/arch/x86/kernel/livepatch.c | |||
@@ -41,8 +41,8 @@ int klp_write_module_reloc(struct module *mod, unsigned long type, | |||
41 | int ret, numpages, size = 4; | 41 | int ret, numpages, size = 4; |
42 | bool readonly; | 42 | bool readonly; |
43 | unsigned long val; | 43 | unsigned long val; |
44 | unsigned long core = (unsigned long)mod->module_core; | 44 | unsigned long core = (unsigned long)mod->core_layout.base; |
45 | unsigned long core_size = mod->core_size; | 45 | unsigned long core_size = mod->core_layout.size; |
46 | 46 | ||
47 | switch (type) { | 47 | switch (type) { |
48 | case R_X86_64_NONE: | 48 | case R_X86_64_NONE: |
@@ -72,7 +72,7 @@ int klp_write_module_reloc(struct module *mod, unsigned long type, | |||
72 | readonly = false; | 72 | readonly = false; |
73 | 73 | ||
74 | #ifdef CONFIG_DEBUG_SET_MODULE_RONX | 74 | #ifdef CONFIG_DEBUG_SET_MODULE_RONX |
75 | if (loc < core + mod->core_ro_size) | 75 | if (loc < core + mod->core_layout.ro_size) |
76 | readonly = true; | 76 | readonly = true; |
77 | #endif | 77 | #endif |
78 | 78 | ||