Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8ea80ca4 authored by Sam Ravnborg's avatar Sam Ravnborg
Browse files

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: default avatarSam Ravnborg <sam@ravnborg.org>
parent 41370d3b
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -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_offset = TO_NATIVE(rela->r_offset);
			r.r_info   = TO_NATIVE(rela->r_info);
			r.r_info   = TO_NATIVE(rela->r_info);
			sym = elf->symtab_start + ELF_R_SYM(r.r_info);
			sym = elf->symtab_start + ELF_R_SYM(r.r_info);
			secname = secstrings + sechdrs[sym->st_shndx].sh_name;
			/* Skip special sections */
			/* Skip special sections */
			if (sym->st_shndx >= SHN_LORESERVE)
			if (sym->st_shndx >= SHN_LORESERVE)
				continue;
				continue;


			secname = secstrings + sechdrs[sym->st_shndx].sh_name;
			if (section(secname))
			if (section(secname))
				warn_sec_mismatch(modname, name, elf, sym, r);
				warn_sec_mismatch(modname, name, elf, sym, r);
		}
		}