Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp746859ybl; Wed, 4 Dec 2019 10:10:59 -0800 (PST) X-Google-Smtp-Source: APXvYqwJiI0BRLMQwi270VDw/qwBOM4dW3RGY92jjYCrlVeyWNFXES3ftpNAPokAAwVhynvmFO2i X-Received: by 2002:a9d:774e:: with SMTP id t14mr3411539otl.358.1575483059437; Wed, 04 Dec 2019 10:10:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575483059; cv=none; d=google.com; s=arc-20160816; b=TkDYtOSXHMuxgjO8fxezvMTJWhGydCd3mtNStk6JiLTuC+mPUXarR58lFT50nQMyNJ O7yok5L/5gKP/wQlCBOLGgnFD2J7Ja5EStRkg/ebk6qJL3rRhAHBpRhWqiQi4vTORUP9 J0y6P9VgzRVjUCqJLAwq61BzHPg1n0OT+lXUtv43/jVB42yoAXfsoUswnuI9FSvlKWbE bX9oPdtV3esPxhVXhiXh0naoe4ekZ/AJgN5KUC2Oqd7HpJp3gbZXxGZG9NjIHoWDBfGp OCHZyqz43VQHh2L8Sx6L6vw+N/XbwYHKvsRQgtec1EhmQh2UFNc8xxP6CMgTun3lGCZk tSxg== 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=G5OjrBSaageqX8fLrGE+gJxNEvMCL2Upjt87UFI/0m0=; b=QE2OxvHDgUE+JCqxlVEWcYFKzU6BqvIWyenlA61tfcxMPNEHjXbNb0mk6Sffk9NZz3 7wJ2FLR0MffJrQp+bbOEOOZ8D89inroIx+W+3WGToCpCuYNGUTTXUEwQaBd4Od7X5fFo xhHubbiwd22cUKkJZW3yrv/1KeMsa4k9dlf9dzaZ9n16z+CQ0C2budLnINU3FqjuUl38 68+w89pFXSBuWAaC5HGSwqrR2a6ECR8QI+s+fiKvcoBnY1zPXyxYMRwuGHMMivUuXA6M f7TKJGHZ5cQ5IbXUgF4G0gAyWDi6raWnglqX1qwGuVjodAh9WkvSh2dc2hsEitGFyrt8 3nCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="0N/3Hbaq"; 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 i11si3742957otc.105.2019.12.04.10.10.46; Wed, 04 Dec 2019 10:10:59 -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; dkim=pass header.i=@kernel.org header.s=default header.b="0N/3Hbaq"; 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 S1728598AbfLDSJn (ORCPT + 99 others); Wed, 4 Dec 2019 13:09:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:35686 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730809AbfLDSJk (ORCPT ); Wed, 4 Dec 2019 13:09:40 -0500 Received: from localhost (unknown [217.68.49.72]) (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 AB03C20862; Wed, 4 Dec 2019 18:09:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482980; bh=TwRb2Jo2UO6eKV3XNXiuSSacNPsSiJZvcfN6vNluiqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0N/3HbaqIReTq/o+KFh9F164+Ah489n5yGckI5EAMhVLdOspaWXjko/CRURtCl+dQ zLd6RbruESwXZKe1XJimVC8iWpHOxAmW9ev3qX98/SjpZtqNCZO2FPym+pT6uXRGm8 xukQP+YMqiV4maFHHzyxk6xqQIptgfnuxwQf2Zxw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Ingo Molnar , "Peter Zijlstra (Intel)" Subject: [PATCH 4.14 191/209] futex: Set task::futex_state to DEAD right after handling futex exit Date: Wed, 4 Dec 2019 18:56:43 +0100 Message-Id: <20191204175336.636498362@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204175321.609072813@linuxfoundation.org> References: <20191204175321.609072813@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Thomas Gleixner commit f24f22435dcc11389acc87e5586239c1819d217c upstream. Setting task::futex_state in do_exit() is rather arbitrarily placed for no reason. Move it into the futex code. Note, this is only done for the exit cleanup as the exec cleanup cannot set the state to FUTEX_STATE_DEAD because the task struct is still in active use. Signed-off-by: Thomas Gleixner Reviewed-by: Ingo Molnar Acked-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20191106224556.439511191@linutronix.de Signed-off-by: Greg Kroah-Hartman --- kernel/exit.c | 1 - kernel/futex.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) --- a/kernel/exit.c +++ b/kernel/exit.c @@ -893,7 +893,6 @@ void __noreturn do_exit(long code) * Make sure we are holding no locks: */ debug_check_no_locks_held(); - futex_exit_done(tsk); if (tsk->io_context) exit_io_context(tsk); --- a/kernel/futex.c +++ b/kernel/futex.c @@ -3705,6 +3705,7 @@ void futex_exec_release(struct task_stru void futex_exit_release(struct task_struct *tsk) { futex_exec_release(tsk); + futex_exit_done(tsk); } long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,