From: Linus Torvalds Date: Sat, 25 Feb 2023 21:06:28 +0000 (-0800) Subject: Merge tag 'probes-v6.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace... X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=116b41162f8b267987ea9a73eb7e73eaa7c2cce5;p=linux.git Merge tag 'probes-v6.3-2' of git://git./linux/kernel/git/trace/linux-trace Pull kprobes cleanup updates from Masami Hiramatsu: "These are probe events cleanups, no new features but improve readability: - Rename print_probe_args() to trace_probe_print_args() and un-inline it - Introduce a set of default data fetch functions for dynamic probe events - Extract common code of data fetch process of dynamic probe events" * tag 'probes-v6.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: kernel/trace: extract common part in process_fetch_insn kernel/trace: Provide default impelentations defined in trace_probe_tmpl.h kernel/trace: Introduce trace_probe_print_args and use it in *probes --- 116b41162f8b267987ea9a73eb7e73eaa7c2cce5 diff --cc kernel/trace/trace_events_synth.c index 70bddb25d9c08,76590f50930cb..46d0abb32d0fa --- a/kernel/trace/trace_events_synth.c +++ b/kernel/trace/trace_events_synth.c @@@ -445,10 -416,11 +445,10 @@@ static unsigned int trace_string(struc if (is_dynamic) { u32 data_offset; - data_offset = offsetof(typeof(*entry), fields); - data_offset += event->n_u64 * sizeof(u64); + data_offset = struct_size(entry, fields, event->n_u64); data_offset += data_size; - len = kern_fetch_store_strlen((unsigned long)str_val); + len = fetch_store_strlen((unsigned long)str_val); data_offset |= len << 16; *(u32 *)&entry->fields[*n_u64] = data_offset; @@@ -538,12 -473,7 +538,12 @@@ static notrace void trace_event_raw_eve val_idx = var_ref_idx[field_pos]; str_val = (char *)(long)var_ref_vals[val_idx]; - len = fetch_store_strlen((unsigned long)str_val); + if (event->dynamic_fields[i]->is_stack) { + len = *((unsigned long *)str_val); + len *= sizeof(unsigned long); + } else { - len = kern_fetch_store_strlen((unsigned long)str_val); ++ len = fetch_store_strlen((unsigned long)str_val); + } fields_size += len; }