From: Greg Kroah-Hartman Date: Tue, 17 Nov 2020 11:57:38 +0000 (+0100) Subject: 5.9-stable patches X-Git-Tag: v4.4.244~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=02c65ea347b53a0d6b9f1d8dd4a53ec3d1c0dea8;p=thirdparty%2Fkernel%2Fstable-queue.git 5.9-stable patches added patches: coresight-etm-perf-sink-selection-using-sysfs-is-deprecated.patch coresight-fix-uninitialised-pointer-bug-in-etm_setup_aux.patch perf-scripting-python-avoid-declaring-function-pointers-with-a-visibility-attribute.patch --- diff --git a/queue-5.9/coresight-etm-perf-sink-selection-using-sysfs-is-deprecated.patch b/queue-5.9/coresight-etm-perf-sink-selection-using-sysfs-is-deprecated.patch new file mode 100644 index 00000000000..4d06ee9954f --- /dev/null +++ b/queue-5.9/coresight-etm-perf-sink-selection-using-sysfs-is-deprecated.patch @@ -0,0 +1,32 @@ +From bb1860efc817c18fce4112f25f51043e44346d1b Mon Sep 17 00:00:00 2001 +From: Linu Cherian +Date: Wed, 16 Sep 2020 13:17:34 -0600 +Subject: coresight: etm: perf: Sink selection using sysfs is deprecated + +From: Linu Cherian + +commit bb1860efc817c18fce4112f25f51043e44346d1b upstream. + +When using the perf interface, sink selection using sysfs is +deprecated. + +Signed-off-by: Linu Cherian +Signed-off-by: Mathieu Poirier +Link: https://lore.kernel.org/r/20200916191737.4001561-14-mathieu.poirier@linaro.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/hwtracing/coresight/coresight-etm-perf.c | 2 -- + 1 file changed, 2 deletions(-) + +--- a/drivers/hwtracing/coresight/coresight-etm-perf.c ++++ b/drivers/hwtracing/coresight/coresight-etm-perf.c +@@ -222,8 +222,6 @@ static void *etm_setup_aux(struct perf_e + if (event->attr.config2) { + id = (u32)event->attr.config2; + sink = coresight_get_sink_by_id(id); +- } else { +- sink = coresight_get_enabled_sink(true); + } + + mask = &event_data->mask; diff --git a/queue-5.9/coresight-fix-uninitialised-pointer-bug-in-etm_setup_aux.patch b/queue-5.9/coresight-fix-uninitialised-pointer-bug-in-etm_setup_aux.patch new file mode 100644 index 00000000000..5c06c0e8ec6 --- /dev/null +++ b/queue-5.9/coresight-fix-uninitialised-pointer-bug-in-etm_setup_aux.patch @@ -0,0 +1,72 @@ +From 39a7661dcf655c8198fd5d72412f5030a8e58444 Mon Sep 17 00:00:00 2001 +From: Mike Leach +Date: Thu, 29 Oct 2020 10:45:59 -0600 +Subject: coresight: Fix uninitialised pointer bug in etm_setup_aux() + +From: Mike Leach + +commit 39a7661dcf655c8198fd5d72412f5030a8e58444 upstream. + +Commit [bb1860efc817] changed the sink handling code introducing an +uninitialised pointer bug. This results in the default sink selection +failing. + +Prior to commit: + +static void etm_setup_aux(...) + + + struct coresight_device *sink; + + + /* First get the selected sink from user space. */ + if (event->attr.config2) { + id = (u32)event->attr.config2; + sink = coresight_get_sink_by_id(id); + } else { + sink = coresight_get_enabled_sink(true); + } + + +*sink always initialised - possibly to NULL which triggers the +automatic sink selection. + +After commit: + +static void etm_setup_aux(...) + + + struct coresight_device *sink; + + + /* First get the selected sink from user space. */ + if (event->attr.config2) { + id = (u32)event->attr.config2; + sink = coresight_get_sink_by_id(id); + } + + +*sink pointer uninitialised when not providing a sink on the perf command +line. This breaks later checks to enable automatic sink selection. + +Fixes: bb1860efc817 ("coresight: etm: perf: Sink selection using sysfs is deprecated") +Signed-off-by: Mike Leach +Signed-off-by: Mathieu Poirier +Link: https://lore.kernel.org/r/20201029164559.1268531-3-mathieu.poirier@linaro.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/hwtracing/coresight/coresight-etm-perf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/hwtracing/coresight/coresight-etm-perf.c ++++ b/drivers/hwtracing/coresight/coresight-etm-perf.c +@@ -210,7 +210,7 @@ static void *etm_setup_aux(struct perf_e + u32 id; + int cpu = event->cpu; + cpumask_t *mask; +- struct coresight_device *sink; ++ struct coresight_device *sink = NULL; + struct etm_event_data *event_data = NULL; + + event_data = alloc_event_data(cpu); diff --git a/queue-5.9/perf-scripting-python-avoid-declaring-function-pointers-with-a-visibility-attribute.patch b/queue-5.9/perf-scripting-python-avoid-declaring-function-pointers-with-a-visibility-attribute.patch new file mode 100644 index 00000000000..726adb49556 --- /dev/null +++ b/queue-5.9/perf-scripting-python-avoid-declaring-function-pointers-with-a-visibility-attribute.patch @@ -0,0 +1,79 @@ +From d0e7b0c71fbb653de90a7163ef46912a96f0bdaf Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Fri, 30 Oct 2020 08:24:38 -0300 +Subject: perf scripting python: Avoid declaring function pointers with a visibility attribute + +From: Arnaldo Carvalho de Melo + +commit d0e7b0c71fbb653de90a7163ef46912a96f0bdaf upstream. + +To avoid this: + + util/scripting-engines/trace-event-python.c: In function 'python_start_script': + util/scripting-engines/trace-event-python.c:1595:2: error: 'visibility' attribute ignored [-Werror=attributes] + 1595 | PyMODINIT_FUNC (*initfunc)(void); + | ^~~~~~~~~~~~~~ + +That started breaking when building with PYTHON=python3 and these gcc +versions (I haven't checked with the clang ones, maybe it breaks there +as well): + + # export PERF_TARBALL=http://192.168.86.5/perf/perf-5.9.0.tar.xz + # dm fedora:33 fedora:rawhide + 1 107.80 fedora:33 : Ok gcc (GCC) 10.2.1 20201005 (Red Hat 10.2.1-5), clang version 11.0.0 (Fedora 11.0.0-1.fc33) + 2 92.47 fedora:rawhide : Ok gcc (GCC) 10.2.1 20201016 (Red Hat 10.2.1-6), clang version 11.0.0 (Fedora 11.0.0-1.fc34) + # + +Avoid that by ditching that 'initfunc' function pointer with its: + + #define Py_EXPORTED_SYMBOL _attribute_ ((visibility ("default"))) + #define PyMODINIT_FUNC Py_EXPORTED_SYMBOL PyObject* + +And just call PyImport_AppendInittab() at the end of the ifdef python3 +block with the functions that were being attributed to that initfunc. + +Cc: Adrian Hunter +Cc: Ian Rogers +Cc: Jiri Olsa +Cc: Namhyung Kim +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Tapas Kundu +Signed-off-by: Greg Kroah-Hartman + +--- + tools/perf/util/scripting-engines/trace-event-python.c | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +--- a/tools/perf/util/scripting-engines/trace-event-python.c ++++ b/tools/perf/util/scripting-engines/trace-event-python.c +@@ -1592,7 +1592,6 @@ static void _free_command_line(wchar_t * + static int python_start_script(const char *script, int argc, const char **argv) + { + struct tables *tables = &tables_global; +- PyMODINIT_FUNC (*initfunc)(void); + #if PY_MAJOR_VERSION < 3 + const char **command_line; + #else +@@ -1607,20 +1606,18 @@ static int python_start_script(const cha + FILE *fp; + + #if PY_MAJOR_VERSION < 3 +- initfunc = initperf_trace_context; + command_line = malloc((argc + 1) * sizeof(const char *)); + command_line[0] = script; + for (i = 1; i < argc + 1; i++) + command_line[i] = argv[i - 1]; ++ PyImport_AppendInittab(name, initperf_trace_context); + #else +- initfunc = PyInit_perf_trace_context; + command_line = malloc((argc + 1) * sizeof(wchar_t *)); + command_line[0] = Py_DecodeLocale(script, NULL); + for (i = 1; i < argc + 1; i++) + command_line[i] = Py_DecodeLocale(argv[i - 1], NULL); ++ PyImport_AppendInittab(name, PyInit_perf_trace_context); + #endif +- +- PyImport_AppendInittab(name, initfunc); + Py_Initialize(); + + #if PY_MAJOR_VERSION < 3 diff --git a/queue-5.9/series b/queue-5.9/series index 95c94bb40de..aaa2127f700 100644 --- a/queue-5.9/series +++ b/queue-5.9/series @@ -250,3 +250,6 @@ limit.patch tunnels-fix-off-by-one-in-lower-mtu-bounds-for-icmp-icmpv6-replies.patch powerpc-603-always-fault-when-_page_accessed-is-not-set.patch null_blk-fix-scheduling-in-atomic-with-zoned-mode.patch +perf-scripting-python-avoid-declaring-function-pointers-with-a-visibility-attribute.patch +coresight-etm-perf-sink-selection-using-sysfs-is-deprecated.patch +coresight-fix-uninitialised-pointer-bug-in-etm_setup_aux.patch