Browse Source

kbuild: fix segfault in modpost

Do not try to look up section name until we know it is not a special
section. Otherwise we will address outside legal space and segfault.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Sam Ravnborg 19 năm trước cách đây
mục cha
commit
8ea80ca4f5
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      scripts/mod/modpost.c

+ 1 - 1
scripts/mod/modpost.c

@@ -576,11 +576,11 @@ static void check_sec_ref(struct module *mod, const char *modname,
 			r.r_offset = TO_NATIVE(rela->r_offset);
 			r.r_info   = TO_NATIVE(rela->r_info);
 			sym = elf->symtab_start + ELF_R_SYM(r.r_info);
-			secname = secstrings + sechdrs[sym->st_shndx].sh_name;
 			/* Skip special sections */
 			if (sym->st_shndx >= SHN_LORESERVE)
 				continue;
 
+			secname = secstrings + sechdrs[sym->st_shndx].sh_name;
 			if (section(secname))
 				warn_sec_mismatch(modname, name, elf, sym, r);
 		}