[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1565469607.880857944@decadent.org.uk>
Date: Sat, 10 Aug 2019 21:40:07 +0100
From: Ben Hutchings <ben@...adent.org.uk>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
CC: akpm@...ux-foundation.org, Denis Kirjanov <kda@...ux-powerpc.org>,
"" <peterz@...radead.org>, "Chen Jie" <chenjie6@...wei.com>,
"" <dvhart@...radead.org>, "" <zengweilin@...wei.com>,
"Thomas Gleixner" <tglx@...utronix.de>
Subject: [PATCH 3.16 039/157] futex: Ensure that futex address is aligned
in handle_futex_death()
3.16.72-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Chen Jie <chenjie6@...wei.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@...wei.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Cc: <dvhart@...radead.org>
Cc: <peterz@...radead.org>
Cc: <zengweilin@...wei.com>
Link: https://lkml.kernel.org/r/1552621478-119787-1-git-send-email-chenjie6@huawei.com
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
kernel/futex.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -2909,6 +2909,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;
Powered by blists - more mailing lists