Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1751108imm; Thu, 18 Oct 2018 03:42:25 -0700 (PDT) X-Google-Smtp-Source: ACcGV63Inap1pFVfia4HYxIs3CfBo+cnBHnBlCRrouCp9W0pPFdN+pn1MydxR9cI2bhSSFEJuyBD X-Received: by 2002:a63:b305:: with SMTP id i5-v6mr27514791pgf.46.1539859345777; Thu, 18 Oct 2018 03:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539859345; cv=none; d=google.com; s=arc-20160816; b=wKZtwyLhhiTep7ljLFcx41IADFMEkaZT7MdBxqnl4AChMfRz8p8MU3fBjPtilI6QF5 8t7Sr0Cal0Ce6sDMVPkV6ZHRvs4DGNXeO1CTvqfSR2Pu1m8Frv91dhSYtJaDmABStgk3 IuAInXU3QRTzEkkbnxWDXwJzD+3qZoKbSqULSTT0eW9lc4329pg9Jkkxla0pc+RuDG3K kpZR2xFjiYBEMudmzMUFvpZ4UXLfyjEs9TQeQce4B766deSowEVR4jOVuzhUShb9SmBd uJCdnGPT9ArotkH7W+q/OOSE8CTAkOfZDcBG+1tnuv823LE3ydjuV8GxckQFMJ7HT0yr 7xqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=NXu/nYYgcDQv8yZ4XAj8qVRukxFFEM18pKUyS+dvjyE=; b=d6+tSg9432arpphv+Qir08sG3MdUDFM/m91mF7zWv1VMqta+iRU5VgWgoKqiDE1Mkj JvMG+xUtvGZKY79cvqF5fjzxENvKEbt8pzqQdbQC2Heyv2FwmZg2uuF6z2D9GPdMyez0 4B1KrliFuYSiVYmsAsc3qd0bYLreuHm8b60DPSmcx1nUCNZtNTAtcMgBJgTBXfAdBOW8 WCp+N0dDO9CBYG1ffHl2UdMX2+LVb6SzJPGa/rBYkL3RqDI5xd8Ta/toaVMLHs2mEYyp NFnGQXtRte845vV033zQMtcwMTvaxgCR2znnoggR2X/8lmisqPyRV+xRiX2k3iwfCFV8 n/UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=er3KY5cR; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b127-v6si21136135pga.153.2018.10.18.03.42.09; Thu, 18 Oct 2018 03:42:25 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=er3KY5cR; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728104AbeJRSkt (ORCPT + 99 others); Thu, 18 Oct 2018 14:40:49 -0400 Received: from mail-yw1-f53.google.com ([209.85.161.53]:44717 "EHLO mail-yw1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727519AbeJRSkt (ORCPT ); Thu, 18 Oct 2018 14:40:49 -0400 Received: by mail-yw1-f53.google.com with SMTP id s73-v6so11585925ywg.11; Thu, 18 Oct 2018 03:40:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NXu/nYYgcDQv8yZ4XAj8qVRukxFFEM18pKUyS+dvjyE=; b=er3KY5cRYcxLF5QanysKTg9ymNMYs8lpTBBR/bTG6PwINnEYTO1ljEohAs6xNAJPPU f/S2xNsU6IqiJL8uxpbEXEdquIchzCqXCu+2x/NxUUrUDAXoz59Xtv0ArcPuzkYbH9c/ dlpf7vjSKcFBECjPyrbXl+rbYRRU04BPJ0iz6xECUy6Jwmvi0+OfMLq+dCNyz0uYxLk+ DpLhKmg9wT2kive8JvGfqN8LY8SNPXbuJO766ycQkCbLC2+vNj+d9w1rv9vfFB9A2X8b UfhS/o/N5CFKthArKZbEkiM1FZwA9I2jGZlQr6L61Rz6tBYwzbddgXdoQAgn/GZGiFKN 9Mfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NXu/nYYgcDQv8yZ4XAj8qVRukxFFEM18pKUyS+dvjyE=; b=SRrN8+p17K4sx8FxIJEBgU0M/RJIfkFqHi/k0yS/5CUcyUdvqzO5+sv2mSQIWzt0bN zr8Tft23l0NSFUeUuIQRbpNJJ3DzxMAgfelXO+z33UUmnHnF3/UN5M8yBexydGtqgTmX +KK/1ZcU/eqVLi1x8Ws0FWrLGALHg+k+DTbMMzAtRMKbKmDhYcvhBC2hanRraECIl6+4 rJXPXcDs87OrpEd0wM26TpJm1/CixZbc2Nkkf95fDonbMAiWVi4qXlpOPGBnkNugKNZq l2IG1ph/zLxvJWX91J5cjUXDl9W+o//NwAIg1+ZYF3Ym5U4WS5R+YONxVvXjU5os11hU l7IA== X-Gm-Message-State: ABuFfohFTYSORixMH07rbG+ddRam8OvROw0N54Ktx+9K2Y/qNC3Rexgu oHLxR3l2Vgtfeu6LSpuIvdwxod5zX4Fg3vIv8O8= X-Received: by 2002:a81:ae4e:: with SMTP id g14-v6mr17762553ywk.248.1539859225759; Thu, 18 Oct 2018 03:40:25 -0700 (PDT) MIME-Version: 1.0 References: <00000000000058404b0578797a9d@google.com> In-Reply-To: From: Amir Goldstein Date: Thu, 18 Oct 2018 13:40:14 +0300 Message-ID: Subject: Re: possible deadlock in ovl_copy_up_start To: Miklos Szeredi Cc: syzbot+3ef5c0d1a5cb0b21e6be@syzkaller.appspotmail.com, linux-kernel , overlayfs , syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 18, 2018 at 11:41 AM Miklos Szeredi wrote: > > On Thu, Oct 18, 2018 at 8:26 AM, Amir Goldstein wrote: > > > Can someone tell me what the expected behavior of a nested > > mutex_lock_interruptible(&lock); ? > > > > Why does the reproducer only warn and not really deadlock. > > It is because that is considered the lesser evil? > > and obviously, then inner unlock releases the outer lock? > > No, it's not the same lock, just the same lock class (first one is > OVL_I(d_inode(old))->lock, the other is > OVL_I(d_inode(new->d_parent)))->lock). Doh! of course. > > So we could possibly get away with annotating with > mutex_lock_nested(). Is this the only place that ovl_i_lock is > nested? > As far as I can see it is. But how would we annotate it for consistent and clear locking order? NLINK/COPYUP? if we want this annotation to maintain locking order we need to patch I posted (does copyup of new->parent prior to nlink_start), so then we don't need nested annotations anymore. Nah, I don't think we need to add nested annotations. FYI, I am working on a small cleanup series for ovl_nlink_start/end and ovl_inode_lock/unlock, but it is independent of the fix patch I posted for this bug. Thanks, Amir.