Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp21761pxf; Wed, 10 Mar 2021 19:21:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJxYxpF4YhIpU2b5kRwljWVHuYhuCUtFTejb9Sr+Mfx/DD1Xz3cRuzG0RDO5UKyu2tKQPI8R X-Received: by 2002:a17:906:2816:: with SMTP id r22mr995465ejc.2.1615432882036; Wed, 10 Mar 2021 19:21:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615432882; cv=none; d=google.com; s=arc-20160816; b=iIOCSum9fpwiKPkp39eHbU97tiWvecf0aXoF8Z36HRYAi3XX3BnIEif0jRcCUBFFl8 65dwthC/jvAFk9GGb3m9wOjLVooi5Qq8OoKYQ3mIhpjVVfAF5J2BVibIUURK3qBbYui9 voRRYqFt/TOQ39BsmBsUQpx/xWYNqizgU5LjAL9mGHuVbFHc0pQGUlkrsqwQQn7IcF7Q WnVybISfyns/gJJBysAzBHRXu15dD3oNxwUckLuU+aseqCiO37NBMcqvk46myjMDF1Bz BVy7w0Ui4XRsZG7b9oWW0VcBOSGYWdsIy8Uq25JoOieQK08Qca41seounVkA+yrVPQj5 zPZQ== 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 :message-id:date:subject:cc:to:from; bh=bNvV+CNJjXIeawNh5i1eAQVB0VOvtjS9zygsc+DrNaI=; b=JaR14FJUC6beEE9apTsCsdYwcoq3khEnGPy85DmD+RHpcmUNEeBQHvbdQVGdHD3yUp ohyvwVMZ7UuZIfObpRZySzVNePhO9hgMKi3owOl97q6rhZbm+RMWTCrsCe1+E8jcqQT+ qy1djz0zCpyN95BbIjSrBy28Ea941bMDlBRv0q7CMAbfgX8rHzViN4yHnBDVwEMcwrDY yqq8YRJ9KDI19v4ABB6tquKYEQ/kF9ag7/NDJUEGRahWHtJhpbeEHv0rvnQiXjs9f6ER 7T+WArGApInGUP4l0/LL7oNLUO5n2U84FHqT9JJjDQNAjFbV5csdGNbGhXfUl95p0hhb cG9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kd10si879976ejc.41.2021.03.10.19.20.59; Wed, 10 Mar 2021 19:21:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230516AbhCKDT3 (ORCPT + 99 others); Wed, 10 Mar 2021 22:19:29 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:13083 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230506AbhCKDTR (ORCPT ); Wed, 10 Mar 2021 22:19:17 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4DwvHs1sQ2zNl1n; Thu, 11 Mar 2021 11:16:57 +0800 (CST) Received: from code-website.localdomain (10.175.127.227) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.498.0; Thu, 11 Mar 2021 11:19:05 +0800 From: Zheng Yejian To: , , , CC: , , , , Subject: [PATCH 4.4 v2 0/3] Backport patch series to update Futex from 4.9 Date: Thu, 11 Mar 2021 11:25:57 +0800 Message-ID: <20210311032600.2326035-1-zhengyejian1@huawei.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Changelog for 'v2': Complete commit messages with needed git commit ids as Greg and Lee suggested. Lee sent a patchset to update Futex for v4.9, see https://www.spinics.net/lists/stable/msg443081.html, Then Xiaoming sent a follow-up patch for it, see https://lore.kernel.org/lkml/20210225093120.GD641347@dell/. These 3 patches is directly picked from v4.9, and they may also resolve following issues in 4.4.260 which have been reported in v4.9, see https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/?h=linux-4.4.y&id=319f66f08de1083c1fe271261665c209009dd65a > /* > * The task is on the way out. When the futex state is > * FUTEX_STATE_DEAD, we know that the task has finished > * the cleanup: > */ > int ret = (p->futex_state = FUTEX_STATE_DEAD) ? -ESRCH : -EAGAIN; Here may be: int ret = (p->futex_state == FUTEX_STATE_DEAD) ? -ESRCH : -EAGAIN; > raw_spin_unlock_irq(&p->pi_lock); > /* > * If the owner task is between FUTEX_STATE_EXITING and > * FUTEX_STATE_DEAD then store the task pointer and keep > * the reference on the task struct. The calling code will > * drop all locks, wait for the task to reach > * FUTEX_STATE_DEAD and then drop the refcount. This is > * required to prevent a live lock when the current task > * preempted the exiting task between the two states. > */ > if (ret == -EBUSY) And here, the variable "ret" may only be "-ESRCH" or "-EAGAIN", but not "-EBUSY". > *exiting = p; > else > put_task_struct(p); Since 074e7d515783 ("futex: Ensure the correct return value from futex_lock_pi()") has been merged in 4.4.260, I send the remain 3 patches. Peter Zijlstra (1): futex: Change locking rules Thomas Gleixner (2): futex: Cure exit race futex: fix dead code in attach_to_pi_owner() kernel/futex.c | 209 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 177 insertions(+), 32 deletions(-) -- 2.25.4