From: Sasha Levin Date: Tue, 4 May 2021 17:49:36 +0000 (-0400) Subject: Fixes for 5.4 X-Git-Tag: v4.19.190~21 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=55f6fae2a3f0e76ca6b7d6bc3fb6bae125899092;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.4 Signed-off-by: Sasha Levin --- diff --git a/queue-5.4/perf-data-fix-error-return-code-in-perf_data__create.patch b/queue-5.4/perf-data-fix-error-return-code-in-perf_data__create.patch new file mode 100644 index 00000000000..08fb9ab35d4 --- /dev/null +++ b/queue-5.4/perf-data-fix-error-return-code-in-perf_data__create.patch @@ -0,0 +1,53 @@ +From 11bae229112f048ddbd56ad8f94d83035d9f0225 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 15 Apr 2021 16:34:16 +0800 +Subject: perf data: Fix error return code in perf_data__create_dir() + +From: Zhen Lei + +[ Upstream commit f2211881e737cade55e0ee07cf6a26d91a35a6fe ] + +Although 'ret' has been initialized to -1, but it will be reassigned by +the "ret = open(...)" statement in the for loop. So that, the value of +'ret' is unknown when asprintf() failed. + +Reported-by: Hulk Robot +Signed-off-by: Zhen Lei +Cc: Alexander Shishkin +Cc: Jiri Olsa +Cc: Mark Rutland +Cc: Namhyung Kim +Cc: Peter Zijlstra +Link: http://lore.kernel.org/lkml/20210415083417.3740-1-thunder.leizhen@huawei.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/util/data.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c +index 88fba2ba549f..7534455ffc6a 100644 +--- a/tools/perf/util/data.c ++++ b/tools/perf/util/data.c +@@ -35,7 +35,7 @@ void perf_data__close_dir(struct perf_data *data) + int perf_data__create_dir(struct perf_data *data, int nr) + { + struct perf_data_file *files = NULL; +- int i, ret = -1; ++ int i, ret; + + if (WARN_ON(!data->is_dir)) + return -EINVAL; +@@ -51,7 +51,8 @@ int perf_data__create_dir(struct perf_data *data, int nr) + for (i = 0; i < nr; i++) { + struct perf_data_file *file = &files[i]; + +- if (asprintf(&file->path, "%s/data.%d", data->path, i) < 0) ++ ret = asprintf(&file->path, "%s/data.%d", data->path, i); ++ if (ret < 0) + goto out_err; + + ret = open(file->path, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR); +-- +2.30.2 + diff --git a/queue-5.4/perf-ftrace-fix-access-to-pid-in-array-when-setting-.patch b/queue-5.4/perf-ftrace-fix-access-to-pid-in-array-when-setting-.patch new file mode 100644 index 00000000000..af806c72f50 --- /dev/null +++ b/queue-5.4/perf-ftrace-fix-access-to-pid-in-array-when-setting-.patch @@ -0,0 +1,64 @@ +From f6a86880582a4d2385ad27f0e731ea2c5b962dbb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 21 Apr 2021 14:04:00 +0200 +Subject: perf ftrace: Fix access to pid in array when setting a pid filter + +From: Thomas Richter + +[ Upstream commit 671b60cb6a897a5b3832fe57657152f2c3995e25 ] + +Command 'perf ftrace -v -- ls' fails in s390 (at least 5.12.0rc6). + +The root cause is a missing pointer dereference which causes an +array element address to be used as PID. + +Fix this by extracting the PID. + +Output before: + # ./perf ftrace -v -- ls + function_graph tracer is used + write '-263732416' to tracing/set_ftrace_pid failed: Invalid argument + failed to set ftrace pid + # + +Output after: + ./perf ftrace -v -- ls + function_graph tracer is used + # tracer: function_graph + # + # CPU DURATION FUNCTION CALLS + # | | | | | | | + 4) | rcu_read_lock_sched_held() { + 4) 0.552 us | rcu_lockdep_current_cpu_online(); + 4) 6.124 us | } + +Reported-by: Alexander Schmidt +Signed-off-by: Thomas Richter +Acked-by: Namhyung Kim +Cc: Heiko Carstens +Cc: Sumanth Korikkar +Cc: Sven Schnelle +Cc: Vasily Gorbik +Link: http://lore.kernel.org/lkml/20210421120400.2126433-1-tmricht@linux.ibm.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/builtin-ftrace.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c +index d5adc417a4ca..40b179f54428 100644 +--- a/tools/perf/builtin-ftrace.c ++++ b/tools/perf/builtin-ftrace.c +@@ -161,7 +161,7 @@ static int set_tracing_pid(struct perf_ftrace *ftrace) + + for (i = 0; i < perf_thread_map__nr(ftrace->evlist->core.threads); i++) { + scnprintf(buf, sizeof(buf), "%d", +- ftrace->evlist->core.threads->map[i]); ++ perf_thread_map__pid(ftrace->evlist->core.threads, i)); + if (append_tracing_file("set_ftrace_pid", buf) < 0) + return -1; + } +-- +2.30.2 + diff --git a/queue-5.4/series b/queue-5.4/series index d60628df5a5..fc27b7b201e 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -8,3 +8,5 @@ bpf-fix-masking-negation-logic-upon-negative-dst-register.patch bpf-fix-leakage-of-uninitialized-bpf-stack-under-speculation.patch avoid-__memcat_p-link-failure.patch iwlwifi-fix-softirq-hardirq-disabling-in-iwl_pcie_gen2_enqueue_hcmd.patch +perf-data-fix-error-return-code-in-perf_data__create.patch +perf-ftrace-fix-access-to-pid-in-array-when-setting-.patch