* linux-next: manual merge of the rr tree with the mips tree
@ 2012-08-22 3:11 Stephen Rothwell
2012-08-25 19:32 ` Geert Uytterhoeven
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Rothwell @ 2012-08-22 3:11 UTC (permalink / raw)
To: Rusty Russell; +Cc: linux-next, linux-kernel, Ralf Baechle
[-- Attachment #1: Type: text/plain, Size: 3159 bytes --]
Hi Rusty,
Today's linux-next merge of the rr tree got a conflict in
arch/mips/kernel/module.c between commit c54de490a2e4 ("MIPS: Module:
Deal with malformed HI16/LO16 relocation sequences") from the mips tree
and commit 9db0bbe072c8 ("MIPS: Fix module.c build for 32 bit") from the
rr tree.
Just context changes (I think). I fixed it up (see below) and can carry
the fix as necessary.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --cc arch/mips/kernel/module.c
index 4f8c3cb,8ffd089..0000000
--- a/arch/mips/kernel/module.c
+++ b/arch/mips/kernel/module.c
@@@ -132,25 -107,6 +105,17 @@@ static int apply_r_mips_hi16_rel(struc
return 0;
}
- static int apply_r_mips_hi16_rela(struct module *me, u32 *location, Elf_Addr v)
- {
- *location = (*location & 0xffff0000) |
- ((((long long) v + 0x8000LL) >> 16) & 0xffff);
-
- return 0;
- }
-
+static void free_relocation_chain(struct mips_hi16 *l)
+{
+ struct mips_hi16 *next;
+
+ while (l) {
+ next = l->next;
+ kfree(l);
+ l = next;
+ }
+}
+
static int apply_r_mips_lo16_rel(struct module *me, u32 *location, Elf_Addr v)
{
unsigned long insnlo = *location;
@@@ -308,61 -217,9 +229,22 @@@ int apply_relocate(Elf_Shdr *sechdrs, c
return res;
}
+ /*
+ * Normally the hi16 list should be deallocated at this point. A
+ * malformed binary however could contain a series of R_MIPS_HI16
+ * relocations not followed by a R_MIPS_LO16 relocation. In that
+ * case, free up the list and return an error.
+ */
+ if (me->arch.r_mips_hi16_list) {
+ free_relocation_chain(me->arch.r_mips_hi16_list);
+ me->arch.r_mips_hi16_list = NULL;
+
+ return -ENOEXEC;
+ }
+
return 0;
}
-
- int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
- unsigned int symindex, unsigned int relsec,
- struct module *me)
- {
- Elf_Mips_Rela *rel = (void *) sechdrs[relsec].sh_addr;
- Elf_Sym *sym;
- u32 *location;
- unsigned int i;
- Elf_Addr v;
- int res;
-
- pr_debug("Applying relocate section %u to %u\n", relsec,
- sechdrs[relsec].sh_info);
-
- for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
- /* This is where to make the change */
- location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
- + rel[i].r_offset;
- /* This is the symbol it is referring to */
- sym = (Elf_Sym *)sechdrs[symindex].sh_addr
- + ELF_MIPS_R_SYM(rel[i]);
- if (IS_ERR_VALUE(sym->st_value)) {
- /* Ignore unresolved weak symbol */
- if (ELF_ST_BIND(sym->st_info) == STB_WEAK)
- continue;
- printk(KERN_WARNING "%s: Unknown symbol %s\n",
- me->name, strtab + sym->st_name);
- return -ENOENT;
- }
-
- v = sym->st_value + rel[i].r_addend;
-
- res = reloc_handlers_rela[ELF_MIPS_R_TYPE(rel[i])](me, location, v);
- if (res)
- return res;
- }
-
- return 0;
- }
+ #endif
/* Given an address, look for it in the module exception tables. */
const struct exception_table_entry *search_module_dbetables(unsigned long addr)
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: linux-next: manual merge of the rr tree with the mips tree
2012-08-22 3:11 linux-next: manual merge of the rr tree with the mips tree Stephen Rothwell
@ 2012-08-25 19:32 ` Geert Uytterhoeven
2012-08-27 16:46 ` Rusty Russell
0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2012-08-25 19:32 UTC (permalink / raw)
To: Stephen Rothwell, David Howells
Cc: Rusty Russell, linux-next, linux-kernel, Ralf Baechle,
Linux MIPS Mailing List
Hi Stephen, David,
On Wed, Aug 22, 2012 at 5:11 AM, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> Today's linux-next merge of the rr tree got a conflict in
> arch/mips/kernel/module.c between commit c54de490a2e4 ("MIPS: Module:
> Deal with malformed HI16/LO16 relocation sequences") from the mips tree
> and commit 9db0bbe072c8 ("MIPS: Fix module.c build for 32 bit") from the
> rr tree.
>
> Just context changes (I think). I fixed it up (see below) and can carry
> the fix as necessary.
> + #endif
At first I thought this merge conflict resolution introduced the bogus #endif:
arch/mips/kernel/module.c:247:2: error: #endif without #if
(e.g. http://kisskb.ellerman.id.au/kisskb/buildresult/6999289/)
but it seems to be present already in David's commit
bd029f48459adc8a72a2db95f7d79a7296c5ad5a ("Make most arch
asm/module.h files use asm-generic/module.h")..
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: linux-next: manual merge of the rr tree with the mips tree
2012-08-25 19:32 ` Geert Uytterhoeven
@ 2012-08-27 16:46 ` Rusty Russell
0 siblings, 0 replies; 3+ messages in thread
From: Rusty Russell @ 2012-08-27 16:46 UTC (permalink / raw)
To: Geert Uytterhoeven, Stephen Rothwell, David Howells
Cc: linux-next, linux-kernel, Ralf Baechle, Linux MIPS Mailing List
Geert Uytterhoeven <geert@linux-m68k.org> writes:
> Hi Stephen, David,
>
> On Wed, Aug 22, 2012 at 5:11 AM, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>> Today's linux-next merge of the rr tree got a conflict in
>> arch/mips/kernel/module.c between commit c54de490a2e4 ("MIPS: Module:
>> Deal with malformed HI16/LO16 relocation sequences") from the mips tree
>> and commit 9db0bbe072c8 ("MIPS: Fix module.c build for 32 bit") from the
>> rr tree.
>>
>> Just context changes (I think). I fixed it up (see below) and can carry
>> the fix as necessary.
>
>> + #endif
>
> At first I thought this merge conflict resolution introduced the bogus #endif:
>
> arch/mips/kernel/module.c:247:2: error: #endif without #if
That was my bad rebase against another patch.
Fixed now, thanks.
Rusty.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-08-27 16:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-22 3:11 linux-next: manual merge of the rr tree with the mips tree Stephen Rothwell
2012-08-25 19:32 ` Geert Uytterhoeven
2012-08-27 16:46 ` Rusty Russell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).