From 93ad44838a02389c5cd1b8824ece1a81f46f21c9 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sun, 2 Aug 2020 09:03:30 +0200 Subject: [PATCH] 4.9-stable patches added patches: install-several-missing-uapi-headers.patch uapi-includes-linux-types.h-before-exporting-files.patch xfs-fix-missed-wakeup-on-l_flush_wait.patch --- ...install-several-missing-uapi-headers.patch | 92 +++++++++++++++++++ queue-4.9/series | 3 + ...linux-types.h-before-exporting-files.patch | 87 ++++++++++++++++++ ...fs-fix-missed-wakeup-on-l_flush_wait.patch | 90 ++++++++++++++++++ 4 files changed, 272 insertions(+) create mode 100644 queue-4.9/install-several-missing-uapi-headers.patch create mode 100644 queue-4.9/uapi-includes-linux-types.h-before-exporting-files.patch create mode 100644 queue-4.9/xfs-fix-missed-wakeup-on-l_flush_wait.patch diff --git a/queue-4.9/install-several-missing-uapi-headers.patch b/queue-4.9/install-several-missing-uapi-headers.patch new file mode 100644 index 00000000000..a86c4539612 --- /dev/null +++ b/queue-4.9/install-several-missing-uapi-headers.patch @@ -0,0 +1,92 @@ +From eb@emlix.com Sun Aug 2 09:02:43 2020 +From: Rolf Eike Beer +Date: Thu, 30 Jul 2020 15:01:45 +0200 +Subject: install several missing uapi headers +To: stable@vger.kernel.org +Cc: Nicolas Dichtel +Message-ID: <2892097.ECyh5nn9PN@devpool35> + +From: Rolf Eike Beer + +Commit fcc8487d477a3452a1d0ccbdd4c5e0e1e3cb8bed ("uapi: export all headers +under uapi directories") changed the default to install all headers not marked +to be conditional. This takes the list of headers listed in the commit message +and manually adds an export for those that are already present in this kernel +version. + +Found during an attempt to build mtd-utils 2.1.2 as it wants hash_info.h, which +exists since 3.13 but has not been installed until the above mentioned commit, +which ended up in 4.12. + +Signed-off-by: Rolf Eike Beer +Signed-off-by: Greg Kroah-Hartman +--- + arch/mips/include/uapi/asm/Kbuild | 3 +++ + arch/powerpc/include/uapi/asm/Kbuild | 1 + + include/uapi/drm/Kbuild | 3 +++ + include/uapi/linux/Kbuild | 20 ++++++++++++++++++++ + include/uapi/linux/cifs/Kbuild | 1 + + include/uapi/linux/genwqe/Kbuild | 1 + + 6 files changed, 29 insertions(+) + create mode 100644 include/uapi/linux/cifs/Kbuild + create mode 100644 include/uapi/linux/genwqe/Kbuild + +--- a/arch/mips/include/uapi/asm/Kbuild ++++ b/arch/mips/include/uapi/asm/Kbuild +@@ -39,3 +39,6 @@ header-y += termbits.h + header-y += termios.h + header-y += types.h + header-y += unistd.h ++header-y += hwcap.h ++header-y += reg.h ++header-y += ucontext.h +--- a/arch/powerpc/include/uapi/asm/Kbuild ++++ b/arch/powerpc/include/uapi/asm/Kbuild +@@ -45,3 +45,4 @@ header-y += tm.h + header-y += types.h + header-y += ucontext.h + header-y += unistd.h ++header-y += perf_regs.h +--- a/include/uapi/drm/Kbuild ++++ b/include/uapi/drm/Kbuild +@@ -20,3 +20,6 @@ header-y += vmwgfx_drm.h + header-y += msm_drm.h + header-y += vc4_drm.h + header-y += virtgpu_drm.h ++header-y += armada_drm.h ++header-y += etnaviv_drm.h ++header-y += vgem_drm.h +--- a/include/uapi/linux/Kbuild ++++ b/include/uapi/linux/Kbuild +@@ -475,3 +475,23 @@ header-y += xilinx-v4l2-controls.h + header-y += zorro.h + header-y += zorro_ids.h + header-y += userfaultfd.h ++header-y += auto_dev-ioctl.h ++header-y += bcache.h ++header-y += btrfs_tree.h ++header-y += coresight-stm.h ++header-y += cryptouser.h ++header-y += hash_info.h ++header-y += kcm.h ++header-y += kcov.h ++header-y += kfd_ioctl.h ++header-y += lightnvm.h ++header-y += module.h ++header-y += nilfs2_api.h ++header-y += nilfs2_ondisk.h ++header-y += nsfs.h ++header-y += pr.h ++header-y += qrtr.h ++header-y += stm.h ++header-y += wil6210_uapi.h ++header-y += cifs/ ++header-y += genwqe/ +--- /dev/null ++++ b/include/uapi/linux/cifs/Kbuild +@@ -0,0 +1 @@ ++header-y += cifs_mount.h +--- /dev/null ++++ b/include/uapi/linux/genwqe/Kbuild +@@ -0,0 +1 @@ ++header-y += genwqe_card.h diff --git a/queue-4.9/series b/queue-4.9/series index 5450272978b..22863f2c774 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -23,3 +23,6 @@ x86-build-lto-fix-truncated-.bss-with-fdata-sections.patch x86-vmlinux.lds-page-align-end-of-.page_aligned-sect.patch fbdev-detect-integer-underflow-at-struct-fbcon_ops-c.patch rds-prevent-kernel-infoleak-in-rds_notify_queue_get.patch +xfs-fix-missed-wakeup-on-l_flush_wait.patch +uapi-includes-linux-types.h-before-exporting-files.patch +install-several-missing-uapi-headers.patch diff --git a/queue-4.9/uapi-includes-linux-types.h-before-exporting-files.patch b/queue-4.9/uapi-includes-linux-types.h-before-exporting-files.patch new file mode 100644 index 00000000000..dd57f08033f --- /dev/null +++ b/queue-4.9/uapi-includes-linux-types.h-before-exporting-files.patch @@ -0,0 +1,87 @@ +From 9078b4eea119c13d633d45af0397c821a517b522 Mon Sep 17 00:00:00 2001 +From: Nicolas Dichtel +Date: Mon, 27 Mar 2017 14:20:11 +0200 +Subject: uapi: includes linux/types.h before exporting files + +From: Nicolas Dichtel + +commit 9078b4eea119c13d633d45af0397c821a517b522 upstream. + +Some files will be exported after a following patch. 0-day tests report the +following warning/error: +./usr/include/linux/bcache.h:8: include of is preferred over +./usr/include/linux/bcache.h:11: found __[us]{8,16,32,64} type without #include +./usr/include/linux/qrtr.h:8: found __[us]{8,16,32,64} type without #include +./usr/include/linux/cryptouser.h:39: found __[us]{8,16,32,64} type without #include +./usr/include/linux/pr.h:14: found __[us]{8,16,32,64} type without #include +./usr/include/linux/btrfs_tree.h:337: found __[us]{8,16,32,64} type without #include +./usr/include/rdma/bnxt_re-abi.h:45: found __[us]{8,16,32,64} type without #include + +Signed-off-by: Nicolas Dichtel +Signed-off-by: Masahiro Yamada +reb: left out include/uapi/rdma/bnxt_re-abi.h as it's not in this kernel version +Signed-off-by: Rolf Eike Beer +Signed-off-by: Greg Kroah-Hartman + +--- + include/uapi/linux/bcache.h | 2 +- + include/uapi/linux/btrfs_tree.h | 2 ++ + include/uapi/linux/cryptouser.h | 2 ++ + include/uapi/linux/pr.h | 2 ++ + include/uapi/linux/qrtr.h | 1 + + 5 files changed, 8 insertions(+), 1 deletion(-) + +--- a/include/uapi/linux/bcache.h ++++ b/include/uapi/linux/bcache.h +@@ -5,7 +5,7 @@ + * Bcache on disk data structures + */ + +-#include ++#include + + #define BITMASK(name, type, field, offset, size) \ + static inline __u64 name(const type *k) \ +--- a/include/uapi/linux/btrfs_tree.h ++++ b/include/uapi/linux/btrfs_tree.h +@@ -1,6 +1,8 @@ + #ifndef _BTRFS_CTREE_H_ + #define _BTRFS_CTREE_H_ + ++#include ++ + /* + * This header contains the structure definitions and constants used + * by file system objects that can be retrieved using +--- a/include/uapi/linux/cryptouser.h ++++ b/include/uapi/linux/cryptouser.h +@@ -18,6 +18,8 @@ + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + */ + ++#include ++ + /* Netlink configuration messages. */ + enum { + CRYPTO_MSG_BASE = 0x10, +--- a/include/uapi/linux/pr.h ++++ b/include/uapi/linux/pr.h +@@ -1,6 +1,8 @@ + #ifndef _UAPI_PR_H + #define _UAPI_PR_H + ++#include ++ + enum pr_type { + PR_WRITE_EXCLUSIVE = 1, + PR_EXCLUSIVE_ACCESS = 2, +--- a/include/uapi/linux/qrtr.h ++++ b/include/uapi/linux/qrtr.h +@@ -2,6 +2,7 @@ + #define _LINUX_QRTR_H + + #include ++#include + + struct sockaddr_qrtr { + __kernel_sa_family_t sq_family; diff --git a/queue-4.9/xfs-fix-missed-wakeup-on-l_flush_wait.patch b/queue-4.9/xfs-fix-missed-wakeup-on-l_flush_wait.patch new file mode 100644 index 00000000000..982ee09bdc7 --- /dev/null +++ b/queue-4.9/xfs-fix-missed-wakeup-on-l_flush_wait.patch @@ -0,0 +1,90 @@ +From cdea5459ce263fbc963657a7736762ae897a8ae6 Mon Sep 17 00:00:00 2001 +From: Rik van Riel +Date: Thu, 5 Sep 2019 17:32:48 -0700 +Subject: xfs: fix missed wakeup on l_flush_wait + +From: Rik van Riel + +commit cdea5459ce263fbc963657a7736762ae897a8ae6 upstream. + +The code in xlog_wait uses the spinlock to make adding the task to +the wait queue, and setting the task state to UNINTERRUPTIBLE atomic +with respect to the waker. + +Doing the wakeup after releasing the spinlock opens up the following +race condition: + +Task 1 task 2 +add task to wait queue + wake up task +set task state to UNINTERRUPTIBLE + +This issue was found through code inspection as a result of kworkers +being observed stuck in UNINTERRUPTIBLE state with an empty +wait queue. It is rare and largely unreproducable. + +Simply moving the spin_unlock to after the wake_up_all results +in the waker not being able to see a task on the waitqueue before +it has set its state to UNINTERRUPTIBLE. + +This bug dates back to the conversion of this code to generic +waitqueue infrastructure from a counting semaphore back in 2008 +which didn't place the wakeups consistently w.r.t. to the relevant +spin locks. + +[dchinner: Also fix a similar issue in the shutdown path on +xc_commit_wait. Update commit log with more details of the issue.] + +Fixes: d748c62367eb ("[XFS] Convert l_flushsema to a sv_t") +Reported-by: Chris Mason +Signed-off-by: Rik van Riel +Signed-off-by: Dave Chinner +Reviewed-by: Darrick J. Wong +Signed-off-by: Darrick J. Wong +Cc: stable@vger.kernel.org # 4.9.x-4.19.x +[modified for contextual change near xlog_state_do_callback()] +Signed-off-by: Samuel Mendoza-Jonas +Reviewed-by: Frank van der Linden +Reviewed-by: Suraj Jitindar Singh +Reviewed-by: Benjamin Herrenschmidt +Reviewed-by: Anchal Agarwal +Signed-off-by: Greg Kroah-Hartman + +--- + fs/xfs/xfs_log.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +--- a/fs/xfs/xfs_log.c ++++ b/fs/xfs/xfs_log.c +@@ -2634,7 +2634,6 @@ xlog_state_do_callback( + int funcdidcallbacks; /* flag: function did callbacks */ + int repeats; /* for issuing console warnings if + * looping too many times */ +- int wake = 0; + + spin_lock(&log->l_icloglock); + first_iclog = iclog = log->l_iclog; +@@ -2836,11 +2835,9 @@ xlog_state_do_callback( + #endif + + if (log->l_iclog->ic_state & (XLOG_STATE_ACTIVE|XLOG_STATE_IOERROR)) +- wake = 1; +- spin_unlock(&log->l_icloglock); +- +- if (wake) + wake_up_all(&log->l_flush_wait); ++ ++ spin_unlock(&log->l_icloglock); + } + + +@@ -4002,7 +3999,9 @@ xfs_log_force_umount( + * item committed callback functions will do this again under lock to + * avoid races. + */ ++ spin_lock(&log->l_cilp->xc_push_lock); + wake_up_all(&log->l_cilp->xc_commit_wait); ++ spin_unlock(&log->l_cilp->xc_push_lock); + xlog_state_do_callback(log, XFS_LI_ABORTED, NULL); + + #ifdef XFSERRORDEBUG -- 2.47.3