From patchwork Mon Feb 1 10:01:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 374223 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1120291jah; Mon, 1 Feb 2021 02:04:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJzj3zYNmTp7VogW4nrKCq7LsIlRvzzMnvgtc2fgRUvRxzh0+gOJkpVy2Z0uM/oduLcM85Kk X-Received: by 2002:a17:906:82c9:: with SMTP id a9mr6267037ejy.547.1612173896134; Mon, 01 Feb 2021 02:04:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612173896; cv=none; d=google.com; s=arc-20160816; b=HzToEqcMnxuB70jObnpy1RWOzMPUDbMd4SzLi8mSuhFIoZAorh9Fjc7MAliTwiNtze TB9+UUz4ZX18hkg2+RYXoKkalzrUEUMq51NS3TwWaRqjf5YQ42zvhNn6XF6zCFreBWLp ODooxxmE7jr0OZIXIYhXNTXJaowvAFb0wyR00233dO3YO6RqQIbhXTiCSY9A3+EGYpGu 1O2qXjy+m8msAuqVUvlGW/paHFJILkPAsQA/7dxkrSgJCuKRJ5sLicUrssRYLkMk3Hbl vbEcefwzkF8wSaNFy9O0O5t3YZ7gkEq+he0Ix1BzCEceE7vEZZZbdTHj2GVOAgDeGs1C 84lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AWHPQeLileZutTX3lhjpX/znrmKRPfFsORf0TLQerQ4=; b=fbwSpENvRJOPRiHIARuZEK/pJSQCRlAawwr2VZHQZ3pwpnUg32XpHs8YJEhhIOpAgx 99CVidlyShSYLOdX0romedfbWyq2hVJzzKPGMhui825b8qpTJqWNU7tvqpg7BWqC9t9p /tKSeDO3hH25UePUIIEzaRV64fjQqV7UEfnxK0hru+jT2H/SAf25Z2arkz8VyYtWfaBd oEBOn90z+D7sv5NWa6LThbzPTx1JlEa9fRLQGUYXPOZeq5ALY8bK1Iuj4Kpk81VZ9Q8d 9/tMOhb4hUL2mrRqn8/woq0MPeDglqqOnWqo27OXCVgDsnCyhgF2gPRXgUEGZziseJaz TlgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JXsktWtI; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m6si13120787ejl.643.2021.02.01.02.04.55; Mon, 01 Feb 2021 02:04:56 -0800 (PST) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JXsktWtI; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232893AbhBAKDe (ORCPT + 13 others); Mon, 1 Feb 2021 05:03:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232995AbhBAKDc (ORCPT ); Mon, 1 Feb 2021 05:03:32 -0500 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 366F8C06178A for ; Mon, 1 Feb 2021 02:02:19 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id 6so15866126wri.3 for ; Mon, 01 Feb 2021 02:02:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AWHPQeLileZutTX3lhjpX/znrmKRPfFsORf0TLQerQ4=; b=JXsktWtI4N+2CsLZCZ4Gdc9iJ0cpbUsmX60SKgfItYjkzRz0DkuW6MIl/Gz2r4H0+/ fMPJGiN3w7h1jzaY7NoZr9GH80QOY4BASXdGeJgw0Mi2ppH36QxZ5J0kRQsE7eU7Vd1k roQv1l3Q8INz1WUK8/RyzYyohB7kpqwv+nDkuc/hWCr11HRDVJT4Udf3Yq3ibjbV6UIT kRJ1eOCZxQKi0UDSMpvIDLaTqrWU/ZW7O0Va0utcLZ/+IS7JmImmKIG9KHCm/83q/VhO j88USs0Y3eMpbrUcOmNDeEWgtTa9csc6Vujr2d24UpJAYYdLaQhMHm5yLll4UfFlrXIB tSXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AWHPQeLileZutTX3lhjpX/znrmKRPfFsORf0TLQerQ4=; b=CXmrDBqxlw5VBp1/t9/Dt9EZrMOzDLmZOib2eqHUq9F7B6F3rAscjvmsQgvL833vb5 UEZLhdHSd/OYnMazQEy0FPoFm9PIzKm2vySCZbUGWfKFJXOVmv+I5d/V+CQdol0wqGwW js+iwJLdeWQ7bPkT9Lt1ojNNprgTvS7Ry+OV0KcOiK4AzuWuT5ljdgo+rDuMaruEJMqU o7QfOdNXnExj/1daHYfJ7xUowSsFqwsSnFMdIsXjJbe6rv3S1Oc5DakQW+VHmNMhzMaD O2o9z7Aswk0vhl9TB8KUL9NuhptllADgeV0DRNzK9VCxZE0gTokTRX+3WFnp5dF7pk9S V6rA== X-Gm-Message-State: AOAM5336tFxGa0ERpyKBRM1kn2NOT5cn1wwQuylrP1LIYwCBqbDZzLx9 Po1W04+CKLIZUtgeHoi7aO+AggoNCaaEvbLm X-Received: by 2002:adf:dfc7:: with SMTP id q7mr17239970wrn.153.1612173737649; Mon, 01 Feb 2021 02:02:17 -0800 (PST) Received: from dell.default ([91.110.221.188]) by smtp.gmail.com with ESMTPSA id p15sm26151387wrt.15.2021.02.01.02.02.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 02:02:16 -0800 (PST) From: Lee Jones To: stable@vger.kernel.org Cc: Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Greg Kroah-Hartman , Lee Jones Subject: [PATCH 06/12] futex: Set task::futex_state to DEAD right after handling futex exit Date: Mon, 1 Feb 2021 10:01:37 +0000 Message-Id: <20210201100143.2028618-7-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210201100143.2028618-1-lee.jones@linaro.org> References: <20210201100143.2028618-1-lee.jones@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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 Signed-off-by: Lee Jones --- kernel/exit.c | 1 - kernel/futex.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) -- 2.25.1 diff --git a/kernel/exit.c b/kernel/exit.c index b65285f5ee0c9..e87ab2ec654bc 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -867,7 +867,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); diff --git a/kernel/futex.c b/kernel/futex.c index 902ce420c4ba0..e8322c3208a44 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -3290,6 +3290,7 @@ void futex_exec_release(struct task_struct *tsk) 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,