Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 310589
b: refs/heads/master
c: 114067b
h: refs/heads/master
i:
  310587: 225261c
v: v3
  • Loading branch information
Namhyung Kim authored and Arnaldo Carvalho de Melo committed May 31, 2012
1 parent d04224a commit bb4fe2a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 472606458f3e1ced5fe3cc5f04e90a6b5a4732cf
refs/heads/master: 114067b69e7b2c691faace0e33db2f04096f668d
4 changes: 2 additions & 2 deletions trunk/include/linux/perf_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ enum perf_event_type {
PERF_RECORD_MAX, /* non-ABI */
};

#define PERF_MAX_STACK_DEPTH 255

enum perf_callchain_context {
PERF_CONTEXT_HV = (__u64)-32,
PERF_CONTEXT_KERNEL = (__u64)-128,
Expand Down Expand Up @@ -609,8 +611,6 @@ struct perf_guest_info_callbacks {
#include <linux/sysfs.h>
#include <asm/local.h>

#define PERF_MAX_STACK_DEPTH 255

struct perf_callchain_entry {
__u64 nr;
__u64 ip[PERF_MAX_STACK_DEPTH];
Expand Down
14 changes: 13 additions & 1 deletion trunk/tools/perf/util/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@ int machine__resolve_callchain(struct machine *self,

callchain_cursor_reset(&callchain_cursor);

if (chain->nr > PERF_MAX_STACK_DEPTH) {
pr_warning("corrupted callchain. skipping...\n");
return 0;
}

for (i = 0; i < chain->nr; i++) {
u64 ip;
struct addr_location al;
Expand All @@ -318,7 +323,14 @@ int machine__resolve_callchain(struct machine *self,
case PERF_CONTEXT_USER:
cpumode = PERF_RECORD_MISC_USER; break;
default:
break;
pr_debug("invalid callchain context: "
"%"PRId64"\n", (s64) ip);
/*
* It seems the callchain is corrupted.
* Discard all.
*/
callchain_cursor_reset(&callchain_cursor);
return 0;
}
continue;
}
Expand Down

0 comments on commit bb4fe2a

Please sign in to comment.