From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3811CC4332D for ; Mon, 1 Mar 2021 21:54:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E492A601FD for ; Mon, 1 Mar 2021 21:54:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244796AbhCAVx4 (ORCPT ); Mon, 1 Mar 2021 16:53:56 -0500 Received: from mx2.suse.de ([195.135.220.15]:47642 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237838AbhCARYp (ORCPT ); Mon, 1 Mar 2021 12:24:45 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1614619438; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YlRwdOzbL8RLSRzwItUwbMXUiIvnCooahFkWHhdiBtc=; b=MWXMF20Pccl/hIQ2lCGRmBq7fMTaMeUrO+KuXsnVcTy+o9hQiUrLkZXo9F8qVhozNAa6m+ ZSkBPYoRNc2dSidzOllDOiVXOBtk6OpJbbgSStuS7IuDEpfALSHZ1fo7uc29pd4tKWMkBu oQAjAHny3QfxG0FhboYVzxSWP5PgsWo= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3B624B023; Mon, 1 Mar 2021 17:23:58 +0000 (UTC) Date: Mon, 1 Mar 2021 18:23:57 +0100 From: Michal Hocko To: Shakeel Butt Cc: Mike Kravetz , syzbot , Andrew Morton , LKML , Linux MM , syzkaller-bugs , Eric Dumazet , Mina Almasry Subject: Re: possible deadlock in sk_clone_lock Message-ID: References: <000000000000f1c03b05bc43aadc@google.com> <7b7c4f41-b72e-840f-278a-320b9d97f887@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 01-03-21 08:39:22, Shakeel Butt wrote: > On Mon, Mar 1, 2021 at 7:57 AM Michal Hocko wrote: [...] > > Then how come this can ever be a problem? in_task() should exclude soft > > irq context unless I am mistaken. > > > > If I take the following example of syzbot's deadlock scenario then > CPU1 is the one freeing the hugetlb pages. It is in the process > context but has disabled softirqs (see __tcp_close()). > > CPU0 CPU1 > ---- ---- > lock(hugetlb_lock); > local_irq_disable(); > lock(slock-AF_INET); > lock(hugetlb_lock); > > lock(slock-AF_INET); > > So, this deadlock scenario is very much possible. OK, I see the point now. I was focusing on the IRQ context and hugetlb side too much. We do not need to be freeing from there. All it takes is to get a dependency chain over a common lock held here. Thanks for bearing with me. Let's see whether we can make hugetlb_lock irq safe. -- Michal Hocko SUSE Labs