From: Greg Kroah-Hartman Date: Mon, 17 Oct 2022 05:24:59 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v5.4.219~43 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c647d3851853ece605181fceccb7072068dc3700;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: perf-intel-pt-fix-segfault-in-intel_pt_print_info-with-uclibc.patch --- diff --git a/queue-4.19/perf-intel-pt-fix-segfault-in-intel_pt_print_info-with-uclibc.patch b/queue-4.19/perf-intel-pt-fix-segfault-in-intel_pt_print_info-with-uclibc.patch new file mode 100644 index 00000000000..e6b862a9474 --- /dev/null +++ b/queue-4.19/perf-intel-pt-fix-segfault-in-intel_pt_print_info-with-uclibc.patch @@ -0,0 +1,56 @@ +From 5a3d47071f0ced0431ef82a5fb6bd077ed9493db Mon Sep 17 00:00:00 2001 +From: Adrian Hunter +Date: Wed, 12 Oct 2022 11:22:58 +0300 +Subject: perf intel-pt: Fix segfault in intel_pt_print_info() with uClibc + +From: Adrian Hunter + +commit 5a3d47071f0ced0431ef82a5fb6bd077ed9493db upstream. + +uClibc segfaulted because NULL was passed as the format to fprintf(). + +That happened because one of the format strings was missing and +intel_pt_print_info() didn't check that before calling fprintf(). + +Add the missing format string, and check format is not NULL before calling +fprintf(). + +Fixes: 11fa7cb86b56d361 ("perf tools: Pass Intel PT information for decoding MTC and CYC") +Signed-off-by: Adrian Hunter +Acked-by: Namhyung Kim +Cc: Adrian Hunter +Cc: Ian Rogers +Cc: Jiri Olsa +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20221012082259.22394-2-adrian.hunter@intel.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/util/intel-pt.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +--- a/tools/perf/util/intel-pt.c ++++ b/tools/perf/util/intel-pt.c +@@ -2373,6 +2373,7 @@ static const char * const intel_pt_info_ + [INTEL_PT_SNAPSHOT_MODE] = " Snapshot mode %"PRId64"\n", + [INTEL_PT_PER_CPU_MMAPS] = " Per-cpu maps %"PRId64"\n", + [INTEL_PT_MTC_BIT] = " MTC bit %#"PRIx64"\n", ++ [INTEL_PT_MTC_FREQ_BITS] = " MTC freq bits %#"PRIx64"\n", + [INTEL_PT_TSC_CTC_N] = " TSC:CTC numerator %"PRIu64"\n", + [INTEL_PT_TSC_CTC_D] = " TSC:CTC denominator %"PRIu64"\n", + [INTEL_PT_CYC_BIT] = " CYC bit %#"PRIx64"\n", +@@ -2387,8 +2388,12 @@ static void intel_pt_print_info(u64 *arr + if (!dump_trace) + return; + +- for (i = start; i <= finish; i++) +- fprintf(stdout, intel_pt_info_fmts[i], arr[i]); ++ for (i = start; i <= finish; i++) { ++ const char *fmt = intel_pt_info_fmts[i]; ++ ++ if (fmt) ++ fprintf(stdout, fmt, arr[i]); ++ } + } + + static void intel_pt_print_info_str(const char *name, const char *str) diff --git a/queue-4.19/series b/queue-4.19/series index ebefa27cd06..f83ae57f030 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -241,3 +241,4 @@ nvme-copy-firmware_rev-on-each-init.patch usb-idmouse-fix-an-uninit-value-in-idmouse_open.patch fsi-master-ast-cf-fix-missing-of_node_put-in-fsi_mas.patch clk-bcm2835-make-peripheral-pllc-critical.patch +perf-intel-pt-fix-segfault-in-intel_pt_print_info-with-uclibc.patch