Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2641494yba; Mon, 22 Apr 2019 10:19:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxaILYR1tLsWTBn0Uz70q6CygwGhQJ+Z/Ur39a8GamSQ38KOTuGaVePUtid7U994aarHT88 X-Received: by 2002:a65:4341:: with SMTP id k1mr19570287pgq.88.1555953555774; Mon, 22 Apr 2019 10:19:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555953555; cv=none; d=google.com; s=arc-20160816; b=0OxinPSslxG6ZfZ14cUiGn9vqWEbp2yzvQugqvuNsbu+fe3fcNF4xSv8OBYFUMtj1m YPTT6+IJQEOYi7vQ882TlMFwYc3aEwHcSAVzHylBCdZ/QnEVEKHg8k2OytBxQbg8daHv aGUs0eeRgAVkU00okutAJXNhY3Hc3hlPe5p/r7ep0RL49FKQVNYZGEFgGrqEOU8oZBO1 BzudZ+w2wBN+ohqrcyMl7DgEvRZWXzqDeNZEwakZpFbw2u7qu0P+cM9l68I+lVuN4yEz ao0sToPvQQyofkQcB33+zGyxiThYr07Go/N1kPe8utiEe9iCs2ueir1Rerjk9LZ2ESmH J5Sg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:dkim-signature; bh=hMF4Llv/Z7HnWPfu2XvWsN+C90/8jjRyDuPzjCOXXM4=; b=hbRWwl8o/iRKfB2+KyWhOqPBwBcXBMhi+1aeJ+wVuiDxEJ4WoSkfTYzqq/g2PKzR4/ dnBItlACKDJ4+MFdkW2i5OX4P5hKu++KNYqnv1izZ0a/RRyVtxdi1qBDWqjAjKUNfjGp II7sRj3+8VSf8U7cVzORAjyeBKBPsru7NtvJCdv8Emzp76uzadZCvnurdxOESgN1WjfC DVMHE9BNPuH4cjgQbdy6HYPxCY4qW307LbWbqXfzxkYalZQQ5rm7eg6ykP4K6MKcmCVS AxYQAeY1y91DQEp3YhLygA4Tlfd2HIrbdDTkL808f6EKU7xZb3CpmQ8BfrH16r+ow5gy BBWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=MjaOFfbe; 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 m3si13872064plb.245.2019.04.22.10.19.00; Mon, 22 Apr 2019 10:19:15 -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=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=MjaOFfbe; 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 S1728314AbfDVQig (ORCPT + 99 others); Mon, 22 Apr 2019 12:38:36 -0400 Received: from mail-it1-f196.google.com ([209.85.166.196]:38327 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728300AbfDVQif (ORCPT ); Mon, 22 Apr 2019 12:38:35 -0400 Received: by mail-it1-f196.google.com with SMTP id q19so1016458itk.3 for ; Mon, 22 Apr 2019 09:38:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=hMF4Llv/Z7HnWPfu2XvWsN+C90/8jjRyDuPzjCOXXM4=; b=MjaOFfbedO013k2srZ8PF1vBifNNhn9MfMSoSQofF/cG66ZP5WdX1h+G1WlfFZlCFH 17EMInn5tLJ2wcevRz0uk5Eg2t8rcJo+6+Jxj9NFtZQEjruHrc+oYrE0hWB3PkgYkBH6 8fQXdJ6a6XV5d2bX73/HVNKZT08BIHlYq9TjzEWwwXJA7XuqN0k2OKO4it2LtmtgMWZk iNc+hnGqSXIaBTDgRFODB4+JjCL/Fz4/mfS4guGDtmPAOK3D3WgSs+Q1/RAA7W8B7dsa idY2tFKMtBb+M8pWTZ+yiKcGitzempUL29mSy5XCUikjl87Sz89IxlyRNuQlpxqhdNc5 7egA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=hMF4Llv/Z7HnWPfu2XvWsN+C90/8jjRyDuPzjCOXXM4=; b=Z3mHOob7Wgacie9nbZJe3uMJXASlT105bvzmzQl7se+bmXrtXU7/oBpfYGXp42kr6o D1mViKOAxfvh8AIAipz0bYabqUPfGW5gMAcPnZQQr1GBAOMONg4z+vlanLdquRpjHyMw R0W7MVlEd/8RrMdx3MPYJpBqcsg5arEEyKEingSGE8qzpsAnmmXs8PYxDspdZ/k9YHCp Phum3zjhnrlKWTl8BIX0ttgMi9bOz8BUEiqTg7dj+BVbBQiHPq1QMRdfBeTxN8aKDcMk v0WuiUredkHB6QGiqOAkbb9ArqU4PiHNbZ8mcU43NjRyEnKOWdGd4UKTubP+1nfriRlF tTSA== X-Gm-Message-State: APjAAAVBv9zx88pgUl6t/ff/sIKwdi2E/5lel/mFp9LBpsA1srjYUv0t 1gNNfGWuukmuNxKjzq86MpRSCA== X-Received: by 2002:a24:3246:: with SMTP id j67mr14307483ita.70.1555951115051; Mon, 22 Apr 2019 09:38:35 -0700 (PDT) Received: from [192.168.1.158] ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id b82sm6441693itd.12.2019.04.22.09.38.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Apr 2019 09:38:33 -0700 (PDT) Subject: Re: WARNING in percpu_ref_kill_and_confirm From: Jens Axboe To: Linus Torvalds Cc: syzbot , Arnd Bergmann , Borislav Petkov , "Darrick J. Wong" , Greg Kroah-Hartman , Peter Anvin , Linux API , linux-arch , linux-block , linux-fsdevel , Linux List Kernel Mailing , Andrew Lutomirski , Mathieu Desnoyers , Ingo Molnar , Michael Ellerman , syzkaller-bugs , Thomas Gleixner , Al Viro , the arch/x86 maintainers References: <00000000000043fe9c058720a5d3@google.com> <53a17444-9539-5810-82a0-ceeefa742508@kernel.dk> Message-ID: Date: Mon, 22 Apr 2019 10:38:32 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <53a17444-9539-5810-82a0-ceeefa742508@kernel.dk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/22/19 10:32 AM, Jens Axboe wrote: > On 4/22/19 10:27 AM, Linus Torvalds wrote: >> [ Crossed emails ] >> >> On Mon, Apr 22, 2019 at 9:23 AM Jens Axboe wrote: >>> >>> I think the below should fix this. Very early versions of io_uring didn't >>> have this issue, since we did the percpu ref tryget for io_uring_register(). >> >> Ok, so I like your patch better than mine, but note how syzbot >> bisected this to the initial merge of the io_uring code. > > Yes, I did think about that too... > >> I agree that code shouldn't have had this particular issue, but it >> looks like it does. >> >> Is there some way to race with io_ring_ctx_wait_and_kill(), which >> _also_ does that ref_kill() thing? I'm not seeing how that could >> happen, but maybe if the file ref counts get screwed up you have >> ->release() called early.. > > I just tried on the current code and it triggers easily, but that's > with that mutex patch in there. I agree it should not trigger before > that, unless something is wonky. I'll try and play around with it a bit > and see what is going on (or if I can trigger it at all with the mutex > change reverted). With the mutex change in, I can trigger it in a second or so. Just ran the reproducer with that change reverted, and I'm not seeing any badness. So I do wonder if the bisect results are accurate? I think the dying check should cover it, and then marked with fixing that mutex commit. -- Jens Axboe