[PATCH] perf: Fix ppc64 SEGV in dso__load_sym with debuginfo files

From: Anton Blanchard
Date: Mon Jul 25 2011 - 00:24:12 EST



64bit PowerPC debuginfo files have an empty function descriptor
section. I hit a SEGV when perf tried to use this section for
symbol resolution.

To fix this we need to check the section is valid and we can
do this by checking for type SHT_PROGBITS.

Signed-off-by: Anton Blanchard <anton@xxxxxxxxx>
Cc: <stable@xxxxxxxxxx>
---

Index: linux-2.6-tip/tools/perf/util/symbol.c
===================================================================
--- linux-2.6-tip.orig/tools/perf/util/symbol.c 2011-07-11 12:49:12.341506269 +1000
+++ linux-2.6-tip/tools/perf/util/symbol.c 2011-07-24 14:48:00.203783423 +1000
@@ -1111,6 +1111,8 @@ static int dso__load_sym(struct dso *dso
}

opdsec = elf_section_by_name(elf, &ehdr, &opdshdr, ".opd", &opdidx);
+ if (opdshdr.sh_type != SHT_PROGBITS)
+ opdsec = NULL;
if (opdsec)
opddata = elf_rawdata(opdsec, NULL);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/