From: tip-bot for Chen Jie <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mingo@kernel.org, linux-kernel@vger.kernel.org,
dvhart@infradead.org, hpa@zytor.com, tglx@linutronix.de,
peterz@infradead.org, chenjie6@huawei.com, zengweilin@huawei.com
Subject: [tip:locking/urgent] futex: Ensure that futex address is aligned in handle_futex_death()
Date: Fri, 22 Mar 2019 05:10:18 -0700 [thread overview]
Message-ID: <tip-5a07168d8d89b00fe1760120714378175b3ef992@git.kernel.org> (raw)
In-Reply-To: <1552621478-119787-1-git-send-email-chenjie6@huawei.com>
Commit-ID: 5a07168d8d89b00fe1760120714378175b3ef992
Gitweb: https://git.kernel.org/tip/5a07168d8d89b00fe1760120714378175b3ef992
Author: Chen Jie <chenjie6@huawei.com>
AuthorDate: Fri, 15 Mar 2019 03:44:38 +0000
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 22 Mar 2019 13:05:26 +0100
futex: Ensure that futex address is aligned in handle_futex_death()
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
---
kernel/futex.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/futex.c b/kernel/futex.c
index c3b73b0311bc..9e40cf7be606 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -3436,6 +3436,10 @@ static int handle_futex_death(u32 __user *uaddr, struct task_struct *curr, int p
{
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;
prev parent reply other threads:[~2019-03-22 12:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-15 3:44 [PATCH] futex:fix robust futex alignment exception chenjie6
2019-03-15 8:41 ` Peter Zijlstra
2019-03-17 14:36 ` Thomas Gleixner
2019-03-18 10:48 ` Peter Zijlstra
2019-03-18 11:35 ` Chenjie (K)
2019-03-22 12:10 ` tip-bot for Chen Jie [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-5a07168d8d89b00fe1760120714378175b3ef992@git.kernel.org \
--to=tipbot@zytor.com \
--cc=chenjie6@huawei.com \
--cc=dvhart@infradead.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=zengweilin@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.