Received: by 10.223.176.5 with SMTP id f5csp1044903wra; Fri, 2 Feb 2018 10:12:29 -0800 (PST) X-Google-Smtp-Source: AH8x227fCPVkSNBRCcQa2C5D9hDTK0vtDCr0Us2xI7ryyBZqpmKStSVqCWH+dAjgTjZVenasGUSb X-Received: by 2002:a17:902:781:: with SMTP id 1-v6mr35278489plj.411.1517595149869; Fri, 02 Feb 2018 10:12:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517595149; cv=none; d=google.com; s=arc-20160816; b=Tjkm5WFGM9pOMbkhe10sda+MxZHhB2oipaZyE8+X+1GsCTUbx8Pxy/YdnABsOUJmT+ 6hcsDqKhIH+9TjCZ+w4eunEboNewioOuMPAZgRKAjiOEP7S81wE/Xb2t+Dd6TQIo+Kwn UqGRB3P9Br9IWE7zYzLbHx+Vhn5D3SVdA/wee6heYyeI7vSfqf4QzOmLNh0TmrsXNZks KV4INcWWudICwH/02JU7XlhjzbvsDjx03iiOJpePGVWmHcNtjwR3f8b044pH6SjMTQlX /FhEVF4YJLTBtZaIzJuftvbOQPruzlRiRJKmaAQ3alj4KX6NbafTO5aa7m4DbbTsKNae 3Xgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=XdiWZ+m4ySFt9SVnLEkwxZCbK0SBRW3shFR6WCqoOFs=; b=cvrlZXH2zut3x8HcKUGh8Ou/O987JgTu0hjult/khHFqhxsKuCoYKLboaDyPXBTn69 0kioZT/pjaxdshkZXeVKPp4nO/ev44WKG7wylECeuapEj1HEcGzYPfmm3bANaNK3Kn+M seWf7AMywIsJ5MqtyZvJ3cBswDGMNoauK96BzjdC8ItNWwLQRiS316XHs9OA1BSV1n3C QtykI0lHHGXHY8ktZE55cnO0lo7AHOWmlEmHalb7bOiUVexAAdagWLalAiq7mtKa53v/ qiO+T3pfDj7Q4Pk7dc7htfV+gNsuew4cx9Z1PUXOG6hCxlyQ1+hTXCZv+SCPRzg5gX2V m2xg== ARC-Authentication-Results: i=1; mx.google.com; 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 94-v6si2293543ple.298.2018.02.02.10.12.14; Fri, 02 Feb 2018 10:12:29 -0800 (PST) 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; 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 S1754102AbeBBSLW (ORCPT + 99 others); Fri, 2 Feb 2018 13:11:22 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:36948 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753120AbeBBRHH (ORCPT ); Fri, 2 Feb 2018 12:07:07 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 02DDCE8D; Fri, 2 Feb 2018 17:07:07 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Dave Jones , "Peter Zijlstra (Intel)" , Andrew Morton , Linus Torvalds , "Paul E. McKenney" , Thomas Gleixner , Ingo Molnar , Ozkan Sezer Subject: [PATCH 4.14 001/156] futex: Fix OWNER_DEAD fixup Date: Fri, 2 Feb 2018 17:56:22 +0100 Message-Id: <20180202140840.309210764@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140840.242829545@linuxfoundation.org> References: <20180202140840.242829545@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Peter Zijlstra commit a97cb0e7b3f4c6297fd857055ae8e895f402f501 upstream. Both Geert and DaveJ reported that the recent futex commit: c1e2f0eaf015 ("futex: Avoid violating the 10th rule of futex") introduced a problem with setting OWNER_DEAD. We set the bit on an uninitialized variable and then entirely optimize it away as a dead-store. Move the setting of the bit to where it is more useful. Reported-by: Geert Uytterhoeven Reported-by: Dave Jones Signed-off-by: Peter Zijlstra (Intel) Cc: Andrew Morton Cc: Linus Torvalds Cc: Paul E. McKenney Cc: Peter Zijlstra Cc: Thomas Gleixner Fixes: c1e2f0eaf015 ("futex: Avoid violating the 10th rule of futex") Link: http://lkml.kernel.org/r/20180122103947.GD2228@hirez.programming.kicks-ass.net Signed-off-by: Ingo Molnar Cc: Ozkan Sezer Signed-off-by: Greg Kroah-Hartman --- kernel/futex.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/kernel/futex.c +++ b/kernel/futex.c @@ -2311,9 +2311,6 @@ static int fixup_pi_state_owner(u32 __us raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); oldowner = pi_state->owner; - /* Owner died? */ - if (!pi_state->owner) - newtid |= FUTEX_OWNER_DIED; /* * We are here because either: @@ -2374,6 +2371,9 @@ retry: } newtid = task_pid_vnr(newowner) | FUTEX_WAITERS; + /* Owner died? */ + if (!pi_state->owner) + newtid |= FUTEX_OWNER_DIED; if (get_futex_value_locked(&uval, uaddr)) goto handle_fault;