Skip to content

Commit

Permalink
module: refactor out section header rewriting: FIX modversions
Browse files Browse the repository at this point in the history
We can't do the find_sec after removing the SHF_ALLOC flags; it won't
find the sections.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
Rusty Russell committed Aug 5, 2010
1 parent 8b5f61a commit d6df72a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -2225,11 +2225,13 @@ static int rewrite_section_headers(struct load_info *info)
if (strstarts(info->secstrings+shdr->sh_name, ".exit"))
shdr->sh_flags &= ~(unsigned long)SHF_ALLOC;
#endif
/* Don't keep modinfo and version sections. */
if (!strcmp(info->secstrings+shdr->sh_name, "__versions")
|| !strcmp(info->secstrings+shdr->sh_name, ".modinfo"))
shdr->sh_flags &= ~(unsigned long)SHF_ALLOC;
}

/* Track but don't keep modinfo and version sections. */
info->index.vers = find_sec(info->hdr, info->sechdrs, info->secstrings, "__versions");
info->index.info = find_sec(info->hdr, info->sechdrs, info->secstrings, ".modinfo");
info->sechdrs[info->index.info].sh_flags &= ~(unsigned long)SHF_ALLOC;
info->sechdrs[info->index.vers].sh_flags &= ~(unsigned long)SHF_ALLOC;
return 0;
}

Expand Down Expand Up @@ -2282,8 +2284,6 @@ static struct module *setup_load_info(struct load_info *info)
return ERR_PTR(-ENOEXEC);
}

info->index.vers = find_sec(info->hdr, info->sechdrs, info->secstrings, "__versions");
info->index.info = find_sec(info->hdr, info->sechdrs, info->secstrings, ".modinfo");
info->index.pcpu = find_pcpusec(info->hdr, info->sechdrs, info->secstrings);

/* Check module struct version now, before we try to use module. */
Expand Down

0 comments on commit d6df72a

Please sign in to comment.