Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5334954ybi; Wed, 12 Jun 2019 00:25:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwU0b6cRYC3Wr4RKP1MTOldEMfMJoIMdGR6Jft5YZDo5IACnAZwuXDlw6SAgXT6RSmVvy6X X-Received: by 2002:a63:8bc7:: with SMTP id j190mr23828940pge.104.1560324357165; Wed, 12 Jun 2019 00:25:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560324357; cv=none; d=google.com; s=arc-20160816; b=R4WBq4vtccvHkVBvqukOkwUOpY1yRZ2ZOT9VC8gRg6QsfCqWk7n9rdAo0NErNtbHSD V155GEFkbkNuHX5f4NJrm1fcEgab/qnPecgkPDDsLJgLQcDKXHoXx/WdjMvljPKg6FAo dMhfP9CVEuZSIbOBnfN205AlCtm0PD0Ha6H8Wgsus/J/d3MnaWDyPttLt94l5QaAdNqF j5d3J+H/oYh4sZCE8nmgM299pyImtxlAkRqo82G+sdVUJ9+o4thmguoRGP73aLbiuMsA ZVW4/YOPUxYIN9dyh6mB0fIe98FffLeqNWnCnNJA1UapoLFHDMqPpO/oso5E4s9MCeys rPRw== 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:in-reply-to :mime-version:user-agent:date:message-id:from:references:to:subject; bh=z8SKvzO4/ULQy0nHVdB5wJc+5sRHqlBt2MGcJz8nYO0=; b=Ojuyjg5bCg11WnC6+/fmCjJ/WiWxP617JVUzBw3USee4TtKUmOXETWGzsVdFAO67FE 7RDtaFqDJZfoNJEN598JajQQ2zeZLRVZCdqLAIMPyCHbuqv1vHN3w8YIcuNCs1X4Budo x+54DxjRCK9XRT4KQmP4ciOyf7GBciHCOMFdsK+il44PLgBycGdj/xpuMU4kJnyfsxlv +NSFpG4KXzsKfwzq9ohtJjfZtMDVRrzzp5GOT3KfVONGhRe7Q7Sga7USjNujoemGW1Cy LxBExpXSZ4M9AUnFoNGkjFnrxu2gf/Muo821i6WwnOZQj0P+FpFiD2gmrQUgsPTtK5o+ NU8Q== 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 q7si14403354pgp.245.2019.06.12.00.25.41; Wed, 12 Jun 2019 00:25:57 -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; 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 S2407608AbfFLBwA (ORCPT + 99 others); Tue, 11 Jun 2019 21:52:00 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:18132 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2406607AbfFLBwA (ORCPT ); Tue, 11 Jun 2019 21:52:00 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 37B9F17F8941DD2D9381; Wed, 12 Jun 2019 09:51:58 +0800 (CST) Received: from [127.0.0.1] (10.184.189.120) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.439.0; Wed, 12 Jun 2019 09:51:54 +0800 Subject: Re: [PATCH] futex: Fix futex lock the wrong page To: , , , , , References: <1560304465-68966-1-git-send-email-zhangxiaoxu5@huawei.com> From: "zhangxiaoxu (A)" Message-ID: Date: Wed, 12 Jun 2019 09:50:25 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <1560304465-68966-1-git-send-email-zhangxiaoxu5@huawei.com> Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.184.189.120] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch is for stable branch linux-4.4-y. On 2019/6/12 9:54, ZhangXiaoxu wrote: > The upstram commit 65d8fc777f6d ("futex: Remove requirement > for lock_page() in get_futex_key()") use variable 'page' as > the page head, when merge it to stable branch, the variable > `page_head` is page head. > > In the stable branch, the variable `page` not means the page > head, when lock the page head, we should lock 'page_head', > rather than 'page'. > > It maybe lead a hung task problem. > > Signed-off-by: ZhangXiaoxu > Cc: stable@vger.kernel.org > --- > kernel/futex.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/futex.c b/kernel/futex.c > index ec9df5b..15d850f 100644 > --- a/kernel/futex.c > +++ b/kernel/futex.c > @@ -593,8 +593,8 @@ again: > * applies. If this is really a shmem page then the page lock > * will prevent unexpected transitions. > */ > - lock_page(page); > - shmem_swizzled = PageSwapCache(page) || page->mapping; > + lock_page(page_head); > + shmem_swizzled = PageSwapCache(page_head) || page_head->mapping; > unlock_page(page_head); > put_page(page_head); > >