Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull objtool fixes from Ingo Molnar:
"Two fixes for boundary conditions"

* 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
objtool: Fix segfault in .cold detection with -ffunction-sections
objtool: Fix double-free in .cold detection error path

+15 -4
+15 -4
tools/objtool/elf.c
··· 31 31 #include "elf.h" 32 32 #include "warn.h" 33 33 34 + #define MAX_NAME_LEN 128 35 + 34 36 struct section *find_section_by_name(struct elf *elf, const char *name) 35 37 { 36 38 struct section *sec; ··· 300 298 /* Create parent/child links for any cold subfunctions */ 301 299 list_for_each_entry(sec, &elf->sections, list) { 302 300 list_for_each_entry(sym, &sec->symbol_list, list) { 301 + char pname[MAX_NAME_LEN + 1]; 302 + size_t pnamelen; 303 303 if (sym->type != STT_FUNC) 304 304 continue; 305 305 sym->pfunc = sym->cfunc = sym; ··· 309 305 if (!coldstr) 310 306 continue; 311 307 312 - coldstr[0] = '\0'; 313 - pfunc = find_symbol_by_name(elf, sym->name); 314 - coldstr[0] = '.'; 308 + pnamelen = coldstr - sym->name; 309 + if (pnamelen > MAX_NAME_LEN) { 310 + WARN("%s(): parent function name exceeds maximum length of %d characters", 311 + sym->name, MAX_NAME_LEN); 312 + return -1; 313 + } 314 + 315 + strncpy(pname, sym->name, pnamelen); 316 + pname[pnamelen] = '\0'; 317 + pfunc = find_symbol_by_name(elf, pname); 315 318 316 319 if (!pfunc) { 317 320 WARN("%s(): can't find parent function", 318 321 sym->name); 319 - goto err; 322 + return -1; 320 323 } 321 324 322 325 sym->pfunc = pfunc;