]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 24 Mar 2019 20:15:36 +0000 (21:15 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 24 Mar 2019 20:15:36 +0000 (21:15 +0100)
added patches:
futex-ensure-that-futex-address-is-aligned-in-handle_futex_death.patch

queue-4.4/futex-ensure-that-futex-address-is-aligned-in-handle_futex_death.patch [new file with mode: 0644]
queue-4.4/series

diff --git a/queue-4.4/futex-ensure-that-futex-address-is-aligned-in-handle_futex_death.patch b/queue-4.4/futex-ensure-that-futex-address-is-aligned-in-handle_futex_death.patch
new file mode 100644 (file)
index 0000000..b353ff1
--- /dev/null
@@ -0,0 +1,47 @@
+From 5a07168d8d89b00fe1760120714378175b3ef992 Mon Sep 17 00:00:00 2001
+From: Chen Jie <chenjie6@huawei.com>
+Date: Fri, 15 Mar 2019 03:44:38 +0000
+Subject: futex: Ensure that futex address is aligned in handle_futex_death()
+
+From: Chen Jie <chenjie6@huawei.com>
+
+commit 5a07168d8d89b00fe1760120714378175b3ef992 upstream.
+
+The futex code requires that the user space addresses of futexes are 32bit
+aligned. sys_futex() checks this in futex_get_keys() but the robust list
+code has no alignment check in place.
+
+As a consequence the kernel crashes on architectures with strict alignment
+requirements in handle_futex_death() when trying to cmpxchg() on an
+unaligned futex address which was retrieved from the robust list.
+
+[ tglx: Rewrote changelog, proper sizeof() based alignement check and add
+       comment ]
+
+Fixes: 0771dfefc9e5 ("[PATCH] lightweight robust futexes: core")
+Signed-off-by: Chen Jie <chenjie6@huawei.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: <dvhart@infradead.org>
+Cc: <peterz@infradead.org>
+Cc: <zengweilin@huawei.com>
+Cc: stable@vger.kernel.org
+Link: https://lkml.kernel.org/r/1552621478-119787-1-git-send-email-chenjie6@huawei.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/futex.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/kernel/futex.c
++++ b/kernel/futex.c
+@@ -3067,6 +3067,10 @@ int handle_futex_death(u32 __user *uaddr
+ {
+       u32 uval, uninitialized_var(nval), mval;
++      /* Futex address must be 32bit aligned */
++      if ((((unsigned long)uaddr) % sizeof(*uaddr)) != 0)
++              return -1;
++
+ retry:
+       if (get_user(uval, uaddr))
+               return -1;
index cdbe06ed287eaf2be00382a7419675e3882393ba..180a1c22487b3f746997354cd8f2b365203751ed 100644 (file)
@@ -3,3 +3,4 @@ drm-vmwgfx-don-t-double-free-the-mode-stored-in-par-set_mode.patch
 udf-fix-crash-on-io-error-during-truncate.patch
 mips-loongson64-lemote-2f-add-irqf_no_suspend-to-cascade-irqaction.patch
 mips-fix-kernel-crash-for-r6-in-jump-label-branch-function.patch
+futex-ensure-that-futex-address-is-aligned-in-handle_futex_death.patch