]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Nov 2020 11:57:38 +0000 (12:57 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Nov 2020 11:57:38 +0000 (12:57 +0100)
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

queue-5.9/coresight-etm-perf-sink-selection-using-sysfs-is-deprecated.patch [new file with mode: 0644]
queue-5.9/coresight-fix-uninitialised-pointer-bug-in-etm_setup_aux.patch [new file with mode: 0644]
queue-5.9/perf-scripting-python-avoid-declaring-function-pointers-with-a-visibility-attribute.patch [new file with mode: 0644]
queue-5.9/series

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 (file)
index 0000000..4d06ee9
--- /dev/null
@@ -0,0 +1,32 @@
+From bb1860efc817c18fce4112f25f51043e44346d1b Mon Sep 17 00:00:00 2001
+From: Linu Cherian <lcherian@marvell.com>
+Date: Wed, 16 Sep 2020 13:17:34 -0600
+Subject: coresight: etm: perf: Sink selection using sysfs is deprecated
+
+From: Linu Cherian <lcherian@marvell.com>
+
+commit bb1860efc817c18fce4112f25f51043e44346d1b upstream.
+
+When using the perf interface, sink selection using sysfs is
+deprecated.
+
+Signed-off-by: Linu Cherian <lcherian@marvell.com>
+Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
+Link: https://lore.kernel.org/r/20200916191737.4001561-14-mathieu.poirier@linaro.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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 (file)
index 0000000..5c06c0e
--- /dev/null
@@ -0,0 +1,72 @@
+From 39a7661dcf655c8198fd5d72412f5030a8e58444 Mon Sep 17 00:00:00 2001
+From: Mike Leach <mike.leach@linaro.org>
+Date: Thu, 29 Oct 2020 10:45:59 -0600
+Subject: coresight: Fix uninitialised pointer bug in etm_setup_aux()
+
+From: Mike Leach <mike.leach@linaro.org>
+
+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(...)
+
+<snip>
+        struct coresight_device *sink;
+<snip>
+
+        /* 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);
+        }
+<ctd>
+
+*sink always initialised - possibly to NULL which triggers the
+automatic sink selection.
+
+After commit:
+
+static void etm_setup_aux(...)
+
+<snip>
+        struct coresight_device *sink;
+<snip>
+
+        /* First get the selected sink from user space. */
+        if (event->attr.config2) {
+                id = (u32)event->attr.config2;
+                sink = coresight_get_sink_by_id(id);
+        }
+<ctd>
+
+*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 <mike.leach@linaro.org>
+Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
+Link: https://lore.kernel.org/r/20201029164559.1268531-3-mathieu.poirier@linaro.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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 (file)
index 0000000..726adb4
--- /dev/null
@@ -0,0 +1,79 @@
+From d0e7b0c71fbb653de90a7163ef46912a96f0bdaf Mon Sep 17 00:00:00 2001
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+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 <acme@redhat.com>
+
+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 <adrian.hunter@intel.com>
+Cc: Ian Rogers <irogers@google.com>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Tapas Kundu <tkundu@vmware.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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
index 95c94bb40de472f62a0c89b6afcd775bd3d13add..aaa2127f700d9fd314f66f041f1d929223516dd6 100644 (file)
@@ -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