]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 Oct 2018 07:29:21 +0000 (09:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 Oct 2018 07:29:21 +0000 (09:29 +0200)
added patches:
of-unittest-disable-interrupt-node-tests-for-old-world-mac-systems.patch
perf-annotate-use-asprintf-when-formatting-objdump-command-line.patch
perf-tools-fix-python-extension-build-for-gcc-8.patch

queue-4.14/of-unittest-disable-interrupt-node-tests-for-old-world-mac-systems.patch [new file with mode: 0644]
queue-4.14/perf-annotate-use-asprintf-when-formatting-objdump-command-line.patch [new file with mode: 0644]
queue-4.14/perf-tools-fix-python-extension-build-for-gcc-8.patch [new file with mode: 0644]
queue-4.14/series

diff --git a/queue-4.14/of-unittest-disable-interrupt-node-tests-for-old-world-mac-systems.patch b/queue-4.14/of-unittest-disable-interrupt-node-tests-for-old-world-mac-systems.patch
new file mode 100644 (file)
index 0000000..0ba47f5
--- /dev/null
@@ -0,0 +1,120 @@
+From 8894891446c9380709451b99ab45c5c53adfd2fc Mon Sep 17 00:00:00 2001
+From: Guenter Roeck <linux@roeck-us.net>
+Date: Tue, 25 Sep 2018 21:06:24 -0700
+Subject: of: unittest: Disable interrupt node tests for old world MAC systems
+
+From: Guenter Roeck <linux@roeck-us.net>
+
+commit 8894891446c9380709451b99ab45c5c53adfd2fc upstream.
+
+On systems with OF_IMAP_OLDWORLD_MAC set in of_irq_workarounds, the
+devicetree interrupt parsing code is different, causing unit tests of
+devicetree interrupt nodes to fail. Due to a bug in unittest code, which
+tries to dereference an uninitialized pointer, this results in a crash.
+
+OF: /testcase-data/phandle-tests/consumer-a: arguments longer than property
+Unable to handle kernel paging request for data at address 0x00bc616e
+Faulting instruction address: 0xc08e9468
+Oops: Kernel access of bad area, sig: 11 [#1]
+BE PREEMPT PowerMac
+Modules linked in:
+CPU: 0 PID: 1 Comm: swapper Not tainted 4.14.72-rc1-yocto-standard+ #1
+task: cf8e0000 task.stack: cf8da000
+NIP:  c08e9468 LR: c08ea5bc CTR: c08ea5ac
+REGS: cf8dbb50 TRAP: 0300   Not tainted  (4.14.72-rc1-yocto-standard+)
+MSR:  00001032 <ME,IR,DR,RI>  CR: 82004044  XER: 00000000
+DAR: 00bc616e DSISR: 40000000
+GPR00: c08ea5bc cf8dbc00 cf8e0000 c13ca517 c13ca517 c13ca8a0 00000066 00000002
+GPR08: 00000063 00bc614e c0b05865 000affff 82004048 00000000 c00047f0 00000000
+GPR16: c0a80000 c0a9cc34 c13ca517 c0ad1134 05ffffff 000affff c0b05860 c0abeef8
+GPR24: cecec278 cecec278 c0a8c4d0 c0a885e0 c13ca8a0 05ffffff c13ca8a0 c13ca517
+
+NIP [c08e9468] device_node_gen_full_name+0x30/0x15c
+LR [c08ea5bc] device_node_string+0x190/0x3c8
+Call Trace:
+[cf8dbc00] [c007f670] trace_hardirqs_on_caller+0x118/0x1fc (unreliable)
+[cf8dbc40] [c08ea5bc] device_node_string+0x190/0x3c8
+[cf8dbcb0] [c08eb794] pointer+0x25c/0x4d0
+[cf8dbd00] [c08ebcbc] vsnprintf+0x2b4/0x5ec
+[cf8dbd60] [c08ec00c] vscnprintf+0x18/0x48
+[cf8dbd70] [c008e268] vprintk_store+0x4c/0x22c
+[cf8dbda0] [c008ecac] vprintk_emit+0x94/0x130
+[cf8dbdd0] [c008ff54] printk+0x5c/0x6c
+[cf8dbe10] [c0b8ddd4] of_unittest+0x2220/0x26f8
+[cf8dbea0] [c0004434] do_one_initcall+0x4c/0x184
+[cf8dbf00] [c0b4534c] kernel_init_freeable+0x13c/0x1d8
+[cf8dbf30] [c0004814] kernel_init+0x24/0x118
+[cf8dbf40] [c0013398] ret_from_kernel_thread+0x5c/0x64
+
+The problem was observed when running a qemu test for the g3beige machine
+with devicetree unittests enabled.
+
+Disable interrupt node tests on affected systems to avoid both false
+unittest failures and the crash.
+
+With this patch in place, unittest on the affected system passes with
+the following message.
+
+       dt-test ### end of unittest - 144 passed, 0 failed
+
+Fixes: 53a42093d96ef ("of: Add device tree selftests")
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Reviewed-by: Frank Rowand <frank.rowand@sony.com>
+Signed-off-by: Rob Herring <robh@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/of/unittest.c |   28 +++++++++++++++++++---------
+ 1 file changed, 19 insertions(+), 9 deletions(-)
+
+--- a/drivers/of/unittest.c
++++ b/drivers/of/unittest.c
+@@ -614,6 +614,9 @@ static void __init of_unittest_parse_int
+       struct of_phandle_args args;
+       int i, rc;
++      if (of_irq_workarounds & OF_IMAP_OLDWORLD_MAC)
++              return;
++
+       np = of_find_node_by_path("/testcase-data/interrupts/interrupts0");
+       if (!np) {
+               pr_err("missing testcase data\n");
+@@ -688,6 +691,9 @@ static void __init of_unittest_parse_int
+       struct of_phandle_args args;
+       int i, rc;
++      if (of_irq_workarounds & OF_IMAP_OLDWORLD_MAC)
++              return;
++
+       np = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0");
+       if (!np) {
+               pr_err("missing testcase data\n");
+@@ -844,15 +850,19 @@ static void __init of_unittest_platform_
+       pdev = of_find_device_by_node(np);
+       unittest(pdev, "device 1 creation failed\n");
+-      irq = platform_get_irq(pdev, 0);
+-      unittest(irq == -EPROBE_DEFER, "device deferred probe failed - %d\n", irq);
+-
+-      /* Test that a parsing failure does not return -EPROBE_DEFER */
+-      np = of_find_node_by_path("/testcase-data/testcase-device2");
+-      pdev = of_find_device_by_node(np);
+-      unittest(pdev, "device 2 creation failed\n");
+-      irq = platform_get_irq(pdev, 0);
+-      unittest(irq < 0 && irq != -EPROBE_DEFER, "device parsing error failed - %d\n", irq);
++      if (!(of_irq_workarounds & OF_IMAP_OLDWORLD_MAC)) {
++              irq = platform_get_irq(pdev, 0);
++              unittest(irq == -EPROBE_DEFER,
++                       "device deferred probe failed - %d\n", irq);
++
++              /* Test that a parsing failure does not return -EPROBE_DEFER */
++              np = of_find_node_by_path("/testcase-data/testcase-device2");
++              pdev = of_find_device_by_node(np);
++              unittest(pdev, "device 2 creation failed\n");
++              irq = platform_get_irq(pdev, 0);
++              unittest(irq < 0 && irq != -EPROBE_DEFER,
++                       "device parsing error failed - %d\n", irq);
++      }
+       np = of_find_node_by_path("/testcase-data/platform-tests");
+       unittest(np, "No testcase data in device tree\n");
diff --git a/queue-4.14/perf-annotate-use-asprintf-when-formatting-objdump-command-line.patch b/queue-4.14/perf-annotate-use-asprintf-when-formatting-objdump-command-line.patch
new file mode 100644 (file)
index 0000000..38bbfcb
--- /dev/null
@@ -0,0 +1,115 @@
+From 6810158d526e483868e519befff407b91e76b3db Mon Sep 17 00:00:00 2001
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+Date: Wed, 14 Mar 2018 10:34:11 -0300
+Subject: perf annotate: Use asprintf when formatting objdump command line
+
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+
+commit 6810158d526e483868e519befff407b91e76b3db upstream.
+
+We were using a local buffer with an arbitrary size, that would have to
+get increased to avoid truncation as warned by gcc 8:
+
+  util/annotate.c: In function 'symbol__disassemble':
+  util/annotate.c:1488:4: error: '%s' directive output may be truncated writing up to 4095 bytes into a region of size between 3966 and 8086 [-Werror=format-truncation=]
+      "%s %s%s --start-address=0x%016" PRIx64
+      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  util/annotate.c:1498:20:
+      symfs_filename, symfs_filename);
+                      ~~~~~~~~~~~~~~
+  util/annotate.c:1490:50: note: format string is defined here
+      " -l -d %s %s -C \"%s\" 2>/dev/null|grep -v \"%s:\"|expand",
+                                                  ^~
+  In file included from /usr/include/stdio.h:861,
+                   from util/color.h:5,
+                   from util/sort.h:8,
+                   from util/annotate.c:14:
+  /usr/include/bits/stdio2.h:67:10: note: '__builtin___snprintf_chk' output 116 or more bytes (assuming 8331) into a destination of size 8192
+     return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
+            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+          __bos (__s), __fmt, __va_arg_pack ());
+          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+So switch to asprintf, that will make sure enough space is available.
+
+Cc: Adrian Hunter <adrian.hunter@intel.com>
+Cc: David Ahern <dsahern@gmail.com>
+Cc: Jin Yao <yao.jin@linux.intel.com>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Wang Nan <wangnan0@huawei.com>
+Link: https://lkml.kernel.org/n/tip-qagoy2dmbjpc9gdnaj0r3mml@git.kernel.org
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Cc: Ignat Korchagin <ignat@cloudflare.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ tools/perf/util/annotate.c |   17 ++++++++++++-----
+ 1 file changed, 12 insertions(+), 5 deletions(-)
+
+--- a/tools/perf/util/annotate.c
++++ b/tools/perf/util/annotate.c
+@@ -1432,7 +1432,7 @@ int symbol__disassemble(struct symbol *s
+                       struct arch **parch, char *cpuid)
+ {
+       struct dso *dso = map->dso;
+-      char command[PATH_MAX * 2];
++      char *command;
+       struct arch *arch = NULL;
+       FILE *file;
+       char symfs_filename[PATH_MAX];
+@@ -1496,7 +1496,7 @@ int symbol__disassemble(struct symbol *s
+               strcpy(symfs_filename, tmp);
+       }
+-      snprintf(command, sizeof(command),
++      err = asprintf(&command,
+                "%s %s%s --start-address=0x%016" PRIx64
+                " --stop-address=0x%016" PRIx64
+                " -l -d %s %s -C \"%s\" 2>/dev/null|grep -v \"%s:\"|expand",
+@@ -1509,12 +1509,17 @@ int symbol__disassemble(struct symbol *s
+                symbol_conf.annotate_src ? "-S" : "",
+                symfs_filename, symfs_filename);
++      if (err < 0) {
++              pr_err("Failure allocating memory for the command to run\n");
++              goto out_remove_tmp;
++      }
++
+       pr_debug("Executing: %s\n", command);
+       err = -1;
+       if (pipe(stdout_fd) < 0) {
+               pr_err("Failure creating the pipe to run %s\n", command);
+-              goto out_remove_tmp;
++              goto out_free_command;
+       }
+       pid = fork();
+@@ -1541,7 +1546,7 @@ int symbol__disassemble(struct symbol *s
+                * If we were using debug info should retry with
+                * original binary.
+                */
+-              goto out_remove_tmp;
++              goto out_free_command;
+       }
+       nline = 0;
+@@ -1570,6 +1575,8 @@ int symbol__disassemble(struct symbol *s
+       fclose(file);
+       err = 0;
++out_free_command:
++      free(command);
+ out_remove_tmp:
+       close(stdout_fd[0]);
+@@ -1583,7 +1590,7 @@ out:
+ out_close_stdout:
+       close(stdout_fd[1]);
+-      goto out_remove_tmp;
++      goto out_free_command;
+ }
+ static void insert_source_line(struct rb_root *root, struct source_line *src_line)
diff --git a/queue-4.14/perf-tools-fix-python-extension-build-for-gcc-8.patch b/queue-4.14/perf-tools-fix-python-extension-build-for-gcc-8.patch
new file mode 100644 (file)
index 0000000..4378b76
--- /dev/null
@@ -0,0 +1,79 @@
+From b7a313d84e853049062011d78cb04b6decd12f5c Mon Sep 17 00:00:00 2001
+From: Jiri Olsa <jolsa@kernel.org>
+Date: Mon, 19 Mar 2018 09:29:02 +0100
+Subject: perf tools: Fix python extension build for gcc 8
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Jiri Olsa <jolsa@kernel.org>
+
+commit b7a313d84e853049062011d78cb04b6decd12f5c upstream.
+
+The gcc 8 compiler won't compile the python extension code with the
+following errors (one example):
+
+  python.c:830:15: error: cast between incompatible  function types from              \
+  ‘PyObject * (*)(struct pyrf_evsel *, PyObject *, PyObject *)’                       \
+  uct _object * (*)(struct pyrf_evsel *, struct _object *, struct _object *)’} to     \
+  ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _objeuct \
+  _object *)’} [-Werror=cast-function-type]
+     .ml_meth  = (PyCFunction)pyrf_evsel__open,
+
+The problem with the PyMethodDef::ml_meth callback is that its type is
+determined based on the PyMethodDef::ml_flags value, which we set as
+METH_VARARGS | METH_KEYWORDS.
+
+That indicates that the callback is expecting an extra PyObject* arg, and is
+actually PyCFunctionWithKeywords type, but the base PyMethodDef::ml_meth type
+stays PyCFunction.
+
+Previous gccs did not find this, gcc8 now does. Fixing this by silencing this
+warning for python.c build.
+
+Commiter notes:
+
+Do not do that for CC=clang, as it breaks the build in some clang
+versions, like the ones in fedora up to fedora27:
+
+  fedora:25:error: unknown warning option '-Wno-cast-function-type'; did you mean '-Wno-bad-function-cast'? [-Werror,-Wunknown-warning-option]
+  fedora:26:error: unknown warning option '-Wno-cast-function-type'; did you mean '-Wno-bad-function-cast'? [-Werror,-Wunknown-warning-option]
+  fedora:27:error: unknown warning option '-Wno-cast-function-type'; did you mean '-Wno-bad-function-cast'? [-Werror,-Wunknown-warning-option]
+  #
+
+those have:
+
+  clang version 3.9.1 (tags/RELEASE_391/final)
+
+The one in rawhide accepts that:
+
+  clang version 6.0.0 (tags/RELEASE_600/final)
+
+Signed-off-by: Jiri Olsa <jolsa@kernel.org>
+Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+Cc: David Ahern <dsahern@gmail.com>
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
+Link: http://lkml.kernel.org/r/20180319082902.4518-2-jolsa@kernel.org
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Cc: Ignat Korchagin <ignat@cloudflare.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ tools/perf/util/setup.py |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/tools/perf/util/setup.py
++++ b/tools/perf/util/setup.py
+@@ -28,6 +28,8 @@ class install_lib(_install_lib):
+ cflags = getenv('CFLAGS', '').split()
+ # switch off several checks (need to be at the end of cflags list)
+ cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter' ]
++if cc != "clang":
++    cflags += ['-Wno-cast-function-type' ]
+ src_perf  = getenv('srctree') + '/tools/perf'
+ build_lib = getenv('PYTHON_EXTBUILD_LIB')
index 0784fad1fe3d1edd9cacaf09b5d47ddd5990151e..e1f6938efaad6c3680a781e48dd4e84e2dc69ed1 100644 (file)
@@ -23,3 +23,6 @@ usb-xhci-mtk-resume-usb3-roothub-first.patch
 usb-serial-simple-add-motorola-tetra-mtp6550-id.patch
 usb-cdc_acm-do-not-leak-urb-buffers.patch
 tty-drop-tty-count-on-tty_reopen-failure.patch
+of-unittest-disable-interrupt-node-tests-for-old-world-mac-systems.patch
+perf-annotate-use-asprintf-when-formatting-objdump-command-line.patch
+perf-tools-fix-python-extension-build-for-gcc-8.patch