|
@@ -43,6 +43,7 @@ int machine__init(struct machine *machine, const char *root_dir, pid_t pid)
|
|
|
|
|
|
machine->symbol_filter = NULL;
|
|
|
machine->id_hdr_size = 0;
|
|
|
+ machine->kptr_restrict_warned = false;
|
|
|
machine->comm_exec = false;
|
|
|
machine->kernel_start = 0;
|
|
|
|
|
@@ -1135,10 +1136,10 @@ int machine__create_kernel_maps(struct machine *machine)
|
|
|
{
|
|
|
struct dso *kernel = machine__get_kernel(machine);
|
|
|
const char *name;
|
|
|
- u64 addr = machine__get_running_kernel_start(machine, &name);
|
|
|
+ u64 addr;
|
|
|
int ret;
|
|
|
|
|
|
- if (!addr || kernel == NULL)
|
|
|
+ if (kernel == NULL)
|
|
|
return -1;
|
|
|
|
|
|
ret = __machine__create_kernel_maps(machine, kernel);
|
|
@@ -1160,8 +1161,9 @@ int machine__create_kernel_maps(struct machine *machine)
|
|
|
*/
|
|
|
map_groups__fixup_end(&machine->kmaps);
|
|
|
|
|
|
- if (maps__set_kallsyms_ref_reloc_sym(machine->vmlinux_maps, name,
|
|
|
- addr)) {
|
|
|
+ addr = machine__get_running_kernel_start(machine, &name);
|
|
|
+ if (!addr) {
|
|
|
+ } else if (maps__set_kallsyms_ref_reloc_sym(machine->vmlinux_maps, name, addr)) {
|
|
|
machine__destroy_kernel_maps(machine);
|
|
|
return -1;
|
|
|
}
|
|
@@ -1769,11 +1771,6 @@ static int resolve_lbr_callchain_sample(struct thread *thread,
|
|
|
*/
|
|
|
int mix_chain_nr = i + 1 + lbr_nr + 1;
|
|
|
|
|
|
- if (mix_chain_nr > (int)sysctl_perf_event_max_stack + PERF_MAX_BRANCH_DEPTH) {
|
|
|
- pr_warning("corrupted callchain. skipping...\n");
|
|
|
- return 0;
|
|
|
- }
|
|
|
-
|
|
|
for (j = 0; j < mix_chain_nr; j++) {
|
|
|
if (callchain_param.order == ORDER_CALLEE) {
|
|
|
if (j < i + 1)
|
|
@@ -1813,7 +1810,7 @@ static int thread__resolve_callchain_sample(struct thread *thread,
|
|
|
struct ip_callchain *chain = sample->callchain;
|
|
|
int chain_nr = chain->nr;
|
|
|
u8 cpumode = PERF_RECORD_MISC_USER;
|
|
|
- int i, j, err, nr_entries, nr_contexts;
|
|
|
+ int i, j, err, nr_entries;
|
|
|
int skip_idx = -1;
|
|
|
int first_call = 0;
|
|
|
|
|
@@ -1828,8 +1825,7 @@ static int thread__resolve_callchain_sample(struct thread *thread,
|
|
|
* Based on DWARF debug information, some architectures skip
|
|
|
* a callchain entry saved by the kernel.
|
|
|
*/
|
|
|
- if (chain_nr < sysctl_perf_event_max_stack)
|
|
|
- skip_idx = arch_skip_callchain_idx(thread, chain);
|
|
|
+ skip_idx = arch_skip_callchain_idx(thread, chain);
|
|
|
|
|
|
/*
|
|
|
* Add branches to call stack for easier browsing. This gives
|
|
@@ -1889,7 +1885,7 @@ static int thread__resolve_callchain_sample(struct thread *thread,
|
|
|
}
|
|
|
|
|
|
check_calls:
|
|
|
- for (i = first_call, nr_entries = 0, nr_contexts = 0;
|
|
|
+ for (i = first_call, nr_entries = 0;
|
|
|
i < chain_nr && nr_entries < max_stack; i++) {
|
|
|
u64 ip;
|
|
|
|
|
@@ -1904,13 +1900,8 @@ check_calls:
|
|
|
#endif
|
|
|
ip = chain->ips[j];
|
|
|
|
|
|
- if (ip >= PERF_CONTEXT_MAX) {
|
|
|
- if (++nr_contexts > sysctl_perf_event_max_contexts_per_stack)
|
|
|
- goto out_corrupted_callchain;
|
|
|
- } else {
|
|
|
- if (++nr_entries > sysctl_perf_event_max_stack)
|
|
|
- goto out_corrupted_callchain;
|
|
|
- }
|
|
|
+ if (ip < PERF_CONTEXT_MAX)
|
|
|
+ ++nr_entries;
|
|
|
|
|
|
err = add_callchain_ip(thread, cursor, parent, root_al, &cpumode, ip);
|
|
|
|
|
@@ -1919,10 +1910,6 @@ check_calls:
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
-
|
|
|
-out_corrupted_callchain:
|
|
|
- pr_warning("corrupted callchain. skipping...\n");
|
|
|
- return 0;
|
|
|
}
|
|
|
|
|
|
static int unwind_entry(struct unwind_entry *entry, void *arg)
|