Commit c5f75dd9 authored by Chen Jie's avatar Chen Jie Committed by Ben Hutchings
Browse files

futex: Ensure that futex address is aligned in handle_futex_death()

commit 5a07168d 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: 0771dfef

 ("[PATCH] lightweight robust futexes: core")
Signed-off-by: default avatarChen Jie <chenjie6@huawei.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: <dvhart@infradead.org>
Cc: <peterz@infradead.org>
Cc: <zengweilin@huawei.com>
Link: https://lkml.kernel.org/r/1552621478-119787-1-git-send-email-chenjie6@huawei.com

Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent b17048c5
linux-3.16.y Tags unavailable
No related merge requests found
Showing with 4 additions and 0 deletions
+4 -0
......@@ -2909,6 +2909,10 @@ int handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int pi)
{
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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment