Home Home > GIT Browse > SLE12-SP3-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavidlohr Bueso <dbueso@suse.de>2019-02-18 12:48:17 -0800
committerDavidlohr Bueso <dbueso@suse.de>2019-02-18 12:48:27 -0800
commitd81bb75167b0476f632d50581eb04f74af8dba3f (patch)
treef8efd3b80cd3e619dd1e3d4e02a5868a58861b39
parent5442adacb276e856b9dc7cdf4b7946a865889bcd (diff)
futex: Fix (possible) missed wakeup (bsc#1050549).
-rw-r--r--patches.fixes/0002-futex-Fix-possible-missed-wakeup.patch63
-rw-r--r--series.conf1
2 files changed, 64 insertions, 0 deletions
diff --git a/patches.fixes/0002-futex-Fix-possible-missed-wakeup.patch b/patches.fixes/0002-futex-Fix-possible-missed-wakeup.patch
new file mode 100644
index 0000000000..b28fc7ce1c
--- /dev/null
+++ b/patches.fixes/0002-futex-Fix-possible-missed-wakeup.patch
@@ -0,0 +1,63 @@
+From 521fa9e2590a78f9a71c71bf2ea2a1ad3669b8c0 Mon Sep 17 00:00:00 2001
+From: Peter Zijlstra <peterz@infradead.org>
+Date: Mon, 18 Feb 2019 09:50:26 -0800
+Subject: [PATCH 2/3] futex: Fix (possible) missed wakeup
+Git-commit: b061c38bef43406df8e73c5be06cbfacad5ee6ad
+Patch-mainline: v5.0-rc4
+References: bsc#1050549
+
+We must not rely on wake_q_add() to delay the wakeup; in particular
+Commit:
+
+ 1d0dcb3ad9d3 ("futex: Implement lockless wakeups")
+
+moved wake_q_add() before smp_store_release(&q->lock_ptr, NULL), which
+could result in futex_wait() waking before observing ->lock_ptr ==
+NULL and going back to sleep again.
+
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Fixes: 1d0dcb3ad9d3 ("futex: Implement lockless wakeups")
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
+
+---
+ kernel/futex.c | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/kernel/futex.c b/kernel/futex.c
+index 643d54f987ef..c3a7a434004e 100644
+--- a/kernel/futex.c
++++ b/kernel/futex.c
+@@ -1275,11 +1275,7 @@ static void mark_wake_futex(struct wake_q_head *wake_q, struct futex_q *q)
+ if (WARN(q->pi_state || q->rt_waiter, "refusing to wake PI futex\n"))
+ return;
+
+- /*
+- * Queue the task for later wakeup for after we've released
+- * the hb->lock. wake_q_add() grabs reference to p.
+- */
+- wake_q_add(wake_q, p);
++ get_task_struct(p);
+ __unqueue_futex(q);
+ /*
+ * The waiting task can free the futex_q as soon as
+@@ -1289,6 +1285,13 @@ static void mark_wake_futex(struct wake_q_head *wake_q, struct futex_q *q)
+ */
+ smp_wmb();
+ q->lock_ptr = NULL;
++
++ /*
++ * Queue the task for later wakeup for after we've released
++ * the hb->lock. wake_q_add() grabs reference to p.
++ */
++ wake_q_add(wake_q, p);
++ put_task_struct(p);
+ }
+
+ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this,
+--
+2.16.4
+
diff --git a/series.conf b/series.conf
index 196d23c39a..986551f5f3 100644
--- a/series.conf
+++ b/series.conf
@@ -24253,6 +24253,7 @@
patches.fixes/acpi-nfit-fix-command-supported-detection.patch
patches.fixes/0001-sched-wake_q-Document-wake_q_add.patch
patches.fixes/0002-sched-wake_q-Fix-wakeup-ordering-for-wake_q.patch
+ patches.fixes/0002-futex-Fix-possible-missed-wakeup.patch
patches.arch/x86-pkeys-properly-copy-pkey-state-at-fork
patches.drivers/iommu-amd-call-free_iova_fast-with-pfn-in-map_sg
patches.drivers/iommu-amd-unmap-all-mapped-pages-in-error-path-of-map_sg