.. | .. |
---|
3 | 3 | #include "perf_regs.h" |
---|
4 | 4 | #include "thread.h" |
---|
5 | 5 | #include "map.h" |
---|
| 6 | +#include "maps.h" |
---|
6 | 7 | #include "event.h" |
---|
7 | 8 | #include "debug.h" |
---|
8 | 9 | #include "tests/tests.h" |
---|
.. | .. |
---|
26 | 27 | |
---|
27 | 28 | sp = (unsigned long) regs[PERF_REG_X86_SP]; |
---|
28 | 29 | |
---|
29 | | - map = map_groups__find(thread->mg, (u64)sp); |
---|
| 30 | + map = maps__find(thread->maps, (u64)sp); |
---|
30 | 31 | if (!map) { |
---|
31 | 32 | pr_debug("failed to get stack map\n"); |
---|
32 | 33 | free(buf); |
---|
.. | .. |
---|
37 | 38 | stack_size = stack_size > STACK_SIZE ? STACK_SIZE : stack_size; |
---|
38 | 39 | |
---|
39 | 40 | memcpy(buf, (void *) sp, stack_size); |
---|
| 41 | +#ifdef MEMORY_SANITIZER |
---|
| 42 | + /* |
---|
| 43 | + * Copying the stack may copy msan poison, avoid false positives in the |
---|
| 44 | + * unwinder by removing the poison here. |
---|
| 45 | + */ |
---|
| 46 | + __msan_unpoison(buf, stack_size); |
---|
| 47 | +#endif |
---|
40 | 48 | stack->data = (char *) buf; |
---|
41 | 49 | stack->size = stack_size; |
---|
42 | 50 | return 0; |
---|
.. | .. |
---|
54 | 62 | return -1; |
---|
55 | 63 | } |
---|
56 | 64 | |
---|
| 65 | +#ifdef MEMORY_SANITIZER |
---|
| 66 | + /* |
---|
| 67 | + * Assignments to buf in the assembly function perf_regs_load aren't |
---|
| 68 | + * seen by memory sanitizer. Zero the memory to convince memory |
---|
| 69 | + * sanitizer the memory is initialized. |
---|
| 70 | + */ |
---|
| 71 | + memset(buf, 0, sizeof(u64) * PERF_REGS_MAX); |
---|
| 72 | +#endif |
---|
57 | 73 | perf_regs_load(buf); |
---|
58 | 74 | regs->abi = PERF_SAMPLE_REGS_ABI; |
---|
59 | 75 | regs->regs = buf; |
---|