diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2010-08-05 14:59:07 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2010-08-04 23:29:07 -0400 |
commit | d6df72a06e067139d491da4a9d14d92ad39e7a50 (patch) | |
tree | 2a7d0387df66c2d6f510cd9a24c622bf75ca669c /kernel | |
parent | 8b5f61a795fe37be090b0fd18b6b7271db9298e0 (diff) |
module: refactor out section header rewriting: FIX modversions
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>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/module.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/module.c b/kernel/module.c index 91f3ebe230e3..ab07f67de996 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -2225,11 +2225,13 @@ static int rewrite_section_headers(struct load_info *info) | |||
2225 | if (strstarts(info->secstrings+shdr->sh_name, ".exit")) | 2225 | if (strstarts(info->secstrings+shdr->sh_name, ".exit")) |
2226 | shdr->sh_flags &= ~(unsigned long)SHF_ALLOC; | 2226 | shdr->sh_flags &= ~(unsigned long)SHF_ALLOC; |
2227 | #endif | 2227 | #endif |
2228 | /* Don't keep modinfo and version sections. */ | ||
2229 | if (!strcmp(info->secstrings+shdr->sh_name, "__versions") | ||
2230 | || !strcmp(info->secstrings+shdr->sh_name, ".modinfo")) | ||
2231 | shdr->sh_flags &= ~(unsigned long)SHF_ALLOC; | ||
2232 | } | 2228 | } |
2229 | |||
2230 | /* Track but don't keep modinfo and version sections. */ | ||
2231 | info->index.vers = find_sec(info->hdr, info->sechdrs, info->secstrings, "__versions"); | ||
2232 | info->index.info = find_sec(info->hdr, info->sechdrs, info->secstrings, ".modinfo"); | ||
2233 | info->sechdrs[info->index.info].sh_flags &= ~(unsigned long)SHF_ALLOC; | ||
2234 | info->sechdrs[info->index.vers].sh_flags &= ~(unsigned long)SHF_ALLOC; | ||
2233 | return 0; | 2235 | return 0; |
2234 | } | 2236 | } |
2235 | 2237 | ||
@@ -2282,8 +2284,6 @@ static struct module *setup_load_info(struct load_info *info) | |||
2282 | return ERR_PTR(-ENOEXEC); | 2284 | return ERR_PTR(-ENOEXEC); |
2283 | } | 2285 | } |
2284 | 2286 | ||
2285 | info->index.vers = find_sec(info->hdr, info->sechdrs, info->secstrings, "__versions"); | ||
2286 | info->index.info = find_sec(info->hdr, info->sechdrs, info->secstrings, ".modinfo"); | ||
2287 | info->index.pcpu = find_pcpusec(info->hdr, info->sechdrs, info->secstrings); | 2287 | info->index.pcpu = find_pcpusec(info->hdr, info->sechdrs, info->secstrings); |
2288 | 2288 | ||
2289 | /* Check module struct version now, before we try to use module. */ | 2289 | /* Check module struct version now, before we try to use module. */ |