Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp501052yba; Mon, 1 Apr 2019 10:33:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqzRt+6kAX2/Cbfs9A6Mk2QP3NqUZf+edfWqCQkjKkifBSt4MIwkuCyHxA08igUdehqNpCMS X-Received: by 2002:a17:902:bd90:: with SMTP id q16mr59212604pls.162.1554140008922; Mon, 01 Apr 2019 10:33:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554140008; cv=none; d=google.com; s=arc-20160816; b=FXKqaHwB+zCOp/ZkqUMcdNN+IBzn4wRkU3qi6Z3BzA5Hyzo9b7MBoYPS0P43JYzzKv Gy5Kl1zXJgWU4dWLmQEzzVWT0kph9LhzI+DuU69psORVvXARcAevlkjzJFZ/AihSC/ro iYOYcLoZ+Z1AVL9W7e+44sfiOXct3h6/OzPiwETuwAlUiGIRleiMPweDgYQkiVZInX34 vx5z0Id84o7F5txhlrBRw9qPzkDm75PlNa/6kw3hd4+vP5RPGuVl1XkB5eS9RH1NfZCb q20McojruPhrH/z9mABE0Au0pibZc1sHWOZpxc7uzU//yBsldL2CFMNUiU03/9J/h4ZB urUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=T3zcV8/u+GfVVI63h1jy6vWUjsC8HR50jGELJj3aqFk=; b=cFAje9dKEbV3/ARIY+e8o69EaxzA3aOGuDXnXg4SuvleAl3boneP0i2x+9aez+sPfa 1+1ayy8J0hciVnC9IzTarkgxFAmE4RoqWqsScwdKg7hQzZi5b9h5rOBiwWIRPoVyvvaH qwSr/gSuHF17kQ0a++HYn3mV4W5aLkIehFrRV6ts1cnIDrf0R6P2IcGRC8E2NHL3I4XF rlF8+0Zvg7KO/EnsL/qL0xkuEAfuK/MHFwmMaPtVGqucHY0jEFuGDaVnMoetxTgzxpMA PnDAwU/uU5uVPfeNePGZwec0sNVgUGnCg7fdYbJdTRNhAcs7h/1Muw0hmYrcEL7DljDt w/Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=B+g6bz5m; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r12si9307088pgl.108.2019.04.01.10.33.13; Mon, 01 Apr 2019 10:33:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=B+g6bz5m; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733014AbfDARbW (ORCPT + 99 others); Mon, 1 Apr 2019 13:31:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:38788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732999AbfDARbS (ORCPT ); Mon, 1 Apr 2019 13:31:18 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 33F5520830; Mon, 1 Apr 2019 17:31:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554139877; bh=k4ND06gsM1/Dua9235Pk3AQzRbNoww13hLNjH0AQpDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B+g6bz5mAAfXkvK7yeSWD3mSBoqV6je+MCjedKlqnYh/SwLD7PXQ0D+w8L57oHEcE zf2WkXqzgjkLWWhzuQtIiTwaQmGT8LarsnV9KHoz6Sr65v/hND95thQvewfEROh3Su +xCNgJ4K4qyM7gd7Mnj2YPg9DeonMIgnkGRnGktQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen Jie , Thomas Gleixner , dvhart@infradead.org, peterz@infradead.org, zengweilin@huawei.com Subject: [PATCH 4.4 006/131] futex: Ensure that futex address is aligned in handle_futex_death() Date: Mon, 1 Apr 2019 19:01:16 +0200 Message-Id: <20190401170052.257032724@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190401170051.645954551@linuxfoundation.org> References: <20190401170051.645954551@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chen Jie 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 Signed-off-by: Thomas Gleixner Cc: Cc: Cc: 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 --- 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;