Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1735741imm; Thu, 27 Sep 2018 01:28:51 -0700 (PDT) X-Google-Smtp-Source: ACcGV62s5TS+MQxHSOktld2EpfnK4CsO+iUObspBTaVPC4bhA4muWQmamLgRW4VV+sCUkTQj/Po7 X-Received: by 2002:a17:902:566:: with SMTP id 93-v6mr9947224plf.184.1538036931248; Thu, 27 Sep 2018 01:28:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538036931; cv=none; d=google.com; s=arc-20160816; b=ez+GQry2i8bqvHv2GQqkcj/H0wsToUaw96qVfBs3gMoknHheFAYgf2UGywuvsaszeR LBshMbngNO/9o2YIjYfPS7e85J0aHa19/wotg5umHt9yEpa5Jx0wVeGVpqFB7+ATs0iG w7z56v5qHyARF52tM58W97KV9SVhToxbWqaL9lWKR86vvR3gGCYmEO86QsRqifEcaXMx y9i9eSrVM7eJHChFxa+pH+ZuH+lkOnRvLgc8dO3dBj+Uzvjn1lrf2NnKOOEaIGqW7V2k xtwfduHqszxsSSFIT5o3W97enTPRkTi2U9ApSVxuqF6k8jaIp2POqvFEIekLHgbSY8ei wayw== 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=I0di2wCwN9xA1x+FqtSSlVhpzhb6fEeSlsdksxG6vgI=; b=YB66P/jD6os8Fjj10FOyqcSlIVC9JUMImFK07qYc8GiwZFotb14wQSc/d958hXiLGg 1qXwAfdZLObcthOYOBE3UtowWimVSc2sY4hxLOmYWkOjjwZoiOjaJ8MAA6bl62vhR8zR sdv6502jNsApzxbajzoTiNRNZxsXrsxRnXCbeK3aUvgAXMIcTVEGpmLWStGdxOeeQYwS 49b6+NMcmEHt+cra+X0Rlke1VXz4TmybLVXu8YhH+yZ+uJ0KhRwadNQcSssX44Nuul6n 7zjwMjqYsO0htDJ+I9PAuGoFkL3RbFv9LOhjUi5NfxdlRQeJnQ1iq6Gv4Md73I5YWbmt j2oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ErIh6E4N; 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 j124-v6si1496219pfb.191.2018.09.27.01.28.34; Thu, 27 Sep 2018 01:28:51 -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=ErIh6E4N; 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 S1726962AbeI0OoN (ORCPT + 99 others); Thu, 27 Sep 2018 10:44:13 -0400 Received: from mail-yw1-f49.google.com ([209.85.161.49]:43202 "EHLO mail-yw1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726760AbeI0OoM (ORCPT ); Thu, 27 Sep 2018 10:44:12 -0400 Received: by mail-yw1-f49.google.com with SMTP id k66-v6so719652ywa.10; Thu, 27 Sep 2018 01:27:08 -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=I0di2wCwN9xA1x+FqtSSlVhpzhb6fEeSlsdksxG6vgI=; b=ErIh6E4NR+JKxu+G1ksC5QaTHpmeKkFwbHhI2dBVmNtKBRmEeq2zOnK076upMr4pF6 x7BGojfri5BMuCMwphIem3bhvsEt12amzMp78whjH6HfdhtKUNibr4Nyg5L9ELKLD+zP 5E0EcKtx4xOipyzBT8Z4W/vhfLCzWVZmrmDcRkHgZyedvQE1Sg/z5Mu7sCzBFIPvdJpG SOJp/m5aWqdZHPM8dyCiCyjkfZjgl4ofdMHKkURtJ9nOL2xSTIVDrVTySSbqMiuqnjn+ qYoVFDv5hIOKk94TIBN9HakmjS0iflcLKe92bq5hl2FsSDBAXzLrvHojA1cQ3g47U2Qx WcyQ== 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=I0di2wCwN9xA1x+FqtSSlVhpzhb6fEeSlsdksxG6vgI=; b=q5bdXx195EAMP9oL2ISlXY/frmrHEaThnv/7wetbWumCqtgFMG+XfR6FpjkI8ihfKI KBNZCiBLXSzjmtqZw0LGO7cmsNvOaDcksFhxhj9yJGt0g53SdPLTYpV+SWz467k3KkJ0 9Q3fM9zYhFPgIan+xlnNQRZh0LhaJwOyZyzufPE6QhdTXMbDe4jWO0Oq51rLS1piZ9Cr x/oXIaZ2ub65bYmcArRnmYABGwqfgEbyhEiJeGpu6NdXS85QHCWrrwEajBs7rbLrt8tv 2/1l4n2DI/dkcdrdw2kjZk4SFjkorTWVNhJ8YcyKNmLRttTjzqmUm/TdLh6+c1xoz+G2 bSOw== X-Gm-Message-State: ABuFfoiuI7r0crTkhP9l2nzorzrFVKCJ2pX4hNy3wSrd05E2bxN5yONc 3fM1vWxmx8uN0ipcQ7ZQhqRWUqz0ARO0+yla8Fk= X-Received: by 2002:a0d:c947:: with SMTP id l68-v6mr5011032ywd.404.1538036828195; Thu, 27 Sep 2018 01:27:08 -0700 (PDT) MIME-Version: 1.0 References: <00000000000044cbf80576baaecd@google.com> In-Reply-To: From: Amir Goldstein Date: Thu, 27 Sep 2018 11:26:56 +0300 Message-ID: Subject: Re: possible deadlock in path_openat To: Miklos Szeredi Cc: syzbot+a55ccfc8a853d3cff213@syzkaller.appspotmail.com, linux-fsdevel , linux-kernel , syzkaller-bugs@googlegroups.com, Al Viro , overlayfs 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, Sep 27, 2018 at 9:36 AM Miklos Szeredi wrote: > > On Thu, Sep 27, 2018 at 8:05 AM, Amir Goldstein wrote: > > > So this is interesting... if there is a file in overlayfs lower layer with > > the f_op read = seq_read then &p->lock in the chain above could be > > takes after ovl locks and that is in reveres order to the order of locks > > in execve on an overlayfs file. > > > > On the one hand, it is possible (not sure if desirable) to use filesystems > > with seq_file like debugfs as overlay lower fs, but on the other hand, > > it is not possible to copy up a debugfs file with its original content > > because (at least for most files I looked) the inode size is reported as 0. > > > > Also, from v4.19-rc1, with stacked f_op, ovl_read_iter() calls vfs_iter_read(), > > so overlayfs is no longer tolerant to underlying files that implement f_op read > > (and not read_iter), thus, it is no longer possible to read lower debugfs files. > > > > That said, if there are files in lower layer that user seq_read f_op and have > > non zero inode size, the deadlock reported above might be possible. > > > > Miklos, > > > > What do you recon we should do? > > Blacklist debugfs just like procfs was blacklisted from fs stacking? > > Improve the heuristics of ovl_dentry_weird() to cover debugfs and friends? > > I think that's the best plan. There doesn't seem to be any sense in > supporting debugfs and similar weirdness as lower layer, so the best > course of action would be to deny at the earilest possible point in > time. > OK. I will leave to you to find the Weirdest Common Denominator of debugfs and friends. But there could also be a filesystem with sporadic special files with seq_read (or no read_iter f_op), or maybe our Weird heuristics didn't catch the filesystem. We might want to block those files from being copied up on the grounds that they cannot be read from overlay before copy up anyway. Thanks, Amir.