Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1374016pxk; Mon, 31 Aug 2020 18:13:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNuClc5LaSGCFFCXVCs2EJMCGsEn5WmRXnsVKl9maOWpO/SrJjJu99Km4cP29uDSQvoQ7c X-Received: by 2002:a17:906:6415:: with SMTP id d21mr3524648ejm.550.1598922780651; Mon, 31 Aug 2020 18:13:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598922780; cv=none; d=google.com; s=arc-20160816; b=atW14L5plDy0p43atF9O/979jzGQpNABygNqxdX/h8m5kgj4vL1AfPKt8LinQUEfjN MOPSFxt/12v6fxDMtyA1E8YAohWjqQ0gE1ZgLUnEMwMKA3UUaLzcVqCreyfcG+daAVu5 PFQtRYYIiyFSmM6xNdWG1PkNhRWSiUWag4jsFGI11U7dRZKw+DztNhml0Mhr/049tnV2 ksgFuz5eggWlMYUzg9Q96Fsw2B3drB/uIwKHQNB2qakdy0pAgNn0BkNMRWqZ3lBOl3cC 3BVaYByRgPb+X9z0Jgfh8dEyHh6uprbRQieerqCPbevCxjUQ/h1ubCKVr9yfXM9ylage sRKA== 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=SLItMwpds8PvPU4P2sv7HLwrxBWiBP0Um7y+hmraGk4=; b=PmPWsE280WwI99z0YdLqTMuUdRNQ5ZEFbPMK7IWzD4M0vQOUW+mASToteJngI0511I whH7jtjxTZpVtEdvQvw1fOJbZPUfsOp1cRlvfouJF7ggKhxlOk5IrPpERk3AD+eTkWEZ hBTYwa4TauOtkdSUp/1ZKegTPW0Ky7HsNwkav0dBNLoMfePZYLGxvZDOldNuiJ9yIog4 UfZSnOURzOOqwnPHl5vLs4vCv5kemQv5q/sT9ThwGE+HtTMNY3DHeqprPEeuAep+Sbwm xrVWmMyI0iDkPV/OHuWSSAtc9BaAIzslZcLM/szOCWVfVBUYKRQB5pl1ueQIa+mTl98b Z+sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Hs1BdaBW; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b5si5729840edu.163.2020.08.31.18.12.37; Mon, 31 Aug 2020 18:13:00 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Hs1BdaBW; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726226AbgIABKU (ORCPT + 99 others); Mon, 31 Aug 2020 21:10:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725929AbgIABKS (ORCPT ); Mon, 31 Aug 2020 21:10:18 -0400 Received: from mail-yb1-xb41.google.com (mail-yb1-xb41.google.com [IPv6:2607:f8b0:4864:20::b41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06B37C061757; Mon, 31 Aug 2020 18:10:18 -0700 (PDT) Received: by mail-yb1-xb41.google.com with SMTP id h126so2998594ybg.4; Mon, 31 Aug 2020 18:10:17 -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=SLItMwpds8PvPU4P2sv7HLwrxBWiBP0Um7y+hmraGk4=; b=Hs1BdaBWzOjEbPg2cphBXMN4RraVXJKEmo1h3dT7eY9IU1SX6amhN0wtHTFz+YD+WA FsItNSY2k3iRFTBmYJb1KjzYDHnIbmNM8Cxrr7dc0Nw95Tl8+S44dxcXFX6lj2zHZCtS eTdLiV6p/Os8AHbr+bDGP4j18paY0f3bAn/mDR8f+ajo3Wf4lzA/pN2QFkyICdFfdA6Z uO4libdvdiNOuLBBBP/TZqF2dWQlOk5qwrdxEQsvymhnKGwp9UTEQWNt2feRrjpUQgb9 OoQYG2cGd+Y+BROyWk1OQC4wVSXVm631n1k3s8PWB28A/ePX03NYRP5oZxthuq8KdKyz g9+w== 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=SLItMwpds8PvPU4P2sv7HLwrxBWiBP0Um7y+hmraGk4=; b=rGIKKDEWej2p8WlL49BkOIrlTSYVOy8VmC1GL4tebeSRAj9KJcNes83Apil2xeJCJO GQ7googO1KP5JL78uF6y9UUompqQNMMVZu3YI89Rl8n8k1TIaNePTDTJmylfr+nM8/5j pLhHkYWpYNOHyC+r+fAYPwpDbUdSTSZk7mPfHDxVzmxI+lEGDBGkmMkKNfs7Mw7PyDT5 aT8pUbAvEN7Wut1fexRiXBt+HEek+aRPkhr/EVlFK15SorrfkEFVUpZ6FOproGU25kN8 OctU3zRDfjiubcCHrmDcTbpZPBjBdg/KjCMw7TWS6L2F8G/bRE6nrhmbkUQ79s+MT7eD dtZg== X-Gm-Message-State: AOAM532Og2ylLCexd2d4Fd/c/BGpr/BHvmIdDFCKIlYVV/8iQjv89Sv1 +xe2JBNJYhVHq3ldNslgw9pUL6Nszlkgw2VvLSVU+XudDCmJig== X-Received: by 2002:a5b:38a:: with SMTP id k10mr6694048ybp.428.1598922616582; Mon, 31 Aug 2020 18:10:16 -0700 (PDT) MIME-Version: 1.0 References: <00000000000084b59f05abe928ee@google.com> <29de15ff-15e9-5c52-cf87-e0ebdfa1a001@I-love.SAKURA.ne.jp> <20200807122727.GR1236603@ZenIV.linux.org.uk> <20200901005131.GA3300@lca.pw> In-Reply-To: <20200901005131.GA3300@lca.pw> From: Ming Lei Date: Tue, 1 Sep 2020 09:10:05 +0800 Message-ID: Subject: Re: splice: infinite busy loop lockup bug To: Qian Cai Cc: Tetsuo Handa , Al Viro , syzkaller-bugs@googlegroups.com, syzbot , Linux FS Devel , Linux Kernel Mailing List , Ming Lei , paulmck@kernel.org 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 Tue, Sep 1, 2020 at 8:53 AM Qian Cai wrote: > > On Fri, Aug 07, 2020 at 09:34:08PM +0900, Tetsuo Handa wrote: > > On 2020/08/07 21:27, Al Viro wrote: > > > On Fri, Aug 07, 2020 at 07:35:08PM +0900, Tetsuo Handa wrote: > > >> syzbot is reporting hung task at pipe_release() [1], for for_each_bvec() from > > >> iterate_bvec() from iterate_all_kinds() from iov_iter_alignment() from > > >> ext4_unaligned_io() from ext4_dio_write_iter() from ext4_file_write_iter() from > > >> call_write_iter() from do_iter_readv_writev() from do_iter_write() from > > >> vfs_iter_write() from iter_file_splice_write() falls into infinite busy loop > > >> with pipe->mutex held. > > >> > > >> The reason of falling into infinite busy loop is that iter_file_splice_write() > > >> for some reason generates "struct bio_vec" entry with .bv_len=0 and .bv_offset=0 > > >> while for_each_bvec() cannot handle .bv_len == 0. > > > > > > broken in 1bdc76aea115 "iov_iter: use bvec iterator to implement iterate_bvec()", > > > unless I'm misreading it... > > I have been chasing something similar for a while as in, > > https://lore.kernel.org/linux-fsdevel/89F418A9-EB20-48CB-9AE0-52C700E6BB74@lca.pw/ > > In my case, it seems the endless loop happens in iterate_iovec() instead where > I put a debug patch here, > > --- a/lib/iov_iter.c > +++ b/lib/iov_iter.c > @@ -33,6 +33,7 @@ > if (unlikely(!__v.iov_len)) \ > continue; \ > __v.iov_base = __p->iov_base; \ > + printk_ratelimited("ITER_IOVEC left = %zu, n = %zu\n", left, n); \ > left = (STEP); \ > __v.iov_len -= left; \ > skip = __v.iov_len; \ > > and end up seeing overflows ("n" supposes to be less than PAGE_SIZE) before the > soft-lockups and a dead system, > > [ 4300.249180][T470195] ITER_IOVEC left = 0, n = 48566423 > > Thoughts? Does the following patch make a difference for you? https://lore.kernel.org/linux-block/20200817100055.2495905-1-ming.lei@redhat.com/ thanks, Ming Lei