Commit 1a6100ca authored by Linus Torvalds's avatar Linus Torvalds

Don't relocate non-allocated regions in modules.

This fixes loading of modules compiled with debugging on
some platforms.

From Rusty.
parent e32c91c0
...@@ -1618,6 +1618,16 @@ static struct module *load_module(void __user *umod, ...@@ -1618,6 +1618,16 @@ static struct module *load_module(void __user *umod,
/* Now do relocations. */ /* Now do relocations. */
for (i = 1; i < hdr->e_shnum; i++) { for (i = 1; i < hdr->e_shnum; i++) {
const char *strtab = (char *)sechdrs[strindex].sh_addr; const char *strtab = (char *)sechdrs[strindex].sh_addr;
unsigned int info = sechdrs[i].sh_info;
/* Not a valid relocation section? */
if (info >= hdr->e_shnum)
continue;
/* Don't bother with non-allocated sections */
if (!(sechdrs[info].sh_flags & SHF_ALLOC))
continue;
if (sechdrs[i].sh_type == SHT_REL) if (sechdrs[i].sh_type == SHT_REL)
err = apply_relocate(sechdrs, strtab, symindex, i,mod); err = apply_relocate(sechdrs, strtab, symindex, i,mod);
else if (sechdrs[i].sh_type == SHT_RELA) else if (sechdrs[i].sh_type == SHT_RELA)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment