Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2007496ybh; Sun, 8 Mar 2020 19:23:58 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtczNg8qFJujH7Rw/MtwgAmkVvCO184Y0JQAXu7bdkB5daJoJcEWlwceKiWZrZgQU0czhNM X-Received: by 2002:a9d:554a:: with SMTP id h10mr10973295oti.344.1583720637936; Sun, 08 Mar 2020 19:23:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583720637; cv=none; d=google.com; s=arc-20160816; b=W0DCRriLS6x+IQBwvFxh4M0FVtk3YjdPQXi/1s7aUQfSJm6qoO9yG5dYLATPQZfnbg slfkxolMxnUA1i0IV/NsDBepxXgI7lpjoPkdRuOw1jNGU4p0+xqlJyfpjboySuA0gkfJ XVgw2BlMOw77YbvcJGCIDtmRmyZLlUuR+VKECsm6R0QlfOk/cODKyEvDJdj+4Cc9F6Ml CaWXkrgxN+xktcixUsg78V1ZX+MIkDMnjKxxZoKcg9YTiSuii3BxjToGulrN/D3byIWO Zynuh3W3z2owkKKtuw2lcyklf6p74m5Qz+YiLFWPakpeq9l2zPRSHJ6HsZD6cAYDqp7t hwIw== 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:from:references:cc:to:subject:dkim-signature; bh=sah9gLZTqUqU0I81LxravMIHbnOhX63QQcmQKAkQUow=; b=QuzksNXY1ha+Pj/rP8J9e+O54n20fyvwOuoIjXMl/CgKVkP4Xmf/uripJoR/VGlCb7 FzXambQbSAbDmKiatFqIvSZpYL4PDe9Ba7//E7wK3Wojqezp5mcEJoJ4XmnjorUNDI12 64PtLBr2ZC1iJwO6DRjqkLS56DZUz2rkvnmA/siQJZcbh7FkKD1AymTQTHGun3oyJUrk au+3Asrfk0hHdP6v5GwoS1G2uo2BU16X3xK3+G2ELBGkRai40oDoXhFWtI2jGCKuY7FX X23qzkS9uTPkDJ6GpxX9arLFEhXXN2cXBOK52vfmVA/y9OLCF8AdFcYac/9uJ8qEFAN9 5lgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=K9clpEC4; 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 h13si5448827otk.167.2020.03.08.19.23.46; Sun, 08 Mar 2020 19:23:57 -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=K9clpEC4; 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 S1727030AbgCICRG (ORCPT + 99 others); Sun, 8 Mar 2020 22:17:06 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:38528 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726677AbgCICRG (ORCPT ); Sun, 8 Mar 2020 22:17:06 -0400 Received: by mail-pf1-f195.google.com with SMTP id g21so4111500pfb.5 for ; Sun, 08 Mar 2020 19:17:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=sah9gLZTqUqU0I81LxravMIHbnOhX63QQcmQKAkQUow=; b=K9clpEC4mqCP5m3LggsyttZ5WLsNeKIvPLMMUCLdxJZB+8pDr5uWeG3j6p2+ShXZZY lU45Nx0lqjLQePc8KH+C4xw7Hg59WYZnDVhmi2GwfH9+4zIRXAWeQ/wzzhDxJLR8zaRu fH3/z0wchAbfhXgEmkf4AipB/eJ2quqZ7qJmh18STmzHcLjhBaQlRxqL1TAVAkPH2/Sa g+CRXoP3ARKEOj/slFdjrSMQgJANqhs7AAJ8gAtKK0JSUUZlc2ajd/bUs8i7CZmzl5VL q+vtjr+ELeDmqlFq+rw5jaDEzDJxMkYAWpElVNV9CJMWqZ127Mtdw9QcdaqghrmxXpDp 5cuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=sah9gLZTqUqU0I81LxravMIHbnOhX63QQcmQKAkQUow=; b=cCu2iyX47SccW6b34dOJZXt8Z0bbaBCMjsZtXgjv5B1jcWG2mpM0eKWkGyjMEKMIp/ iNmYeCE9Yo00hYFo3X9G4Mur/PXzEhbeJXasWcr6yNcZev3UavbRKKibjWpxmynmUCZn kxi/bmH+9ghPCqwNRZ5asFSa39IoOQRC1bbpccvw8dah3fU7OYd4zo78yDRjs+/HKKcP 00NRAD83mJUlLsyL+wai9p8hiRZajJEBahyJq8vIHSbykawgUKU9PgWGKViG3E6FCIvl Rf9grg7VL7/dhFF6e8iT0Bxufb0jy01MQgRvD/2tfRRZvE8Yygp1i02Yhnts0J390Zvc h+Hg== X-Gm-Message-State: ANhLgQ2bXtpXy0WF4uIVG14LzFI4yto06+ANN0m3BzhDlqAhBgBSqJ3V McZsQOR/zBjBMdR31NyxPi5ULg== X-Received: by 2002:a63:485f:: with SMTP id x31mr12381883pgk.347.1583720223731; Sun, 08 Mar 2020 19:17:03 -0700 (PDT) Received: from [192.168.1.188] ([66.219.217.145]) by smtp.gmail.com with ESMTPSA id o19sm15830487pjr.2.2020.03.08.19.17.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 08 Mar 2020 19:17:03 -0700 (PDT) Subject: Re: general protection fault in __queue_work (2) To: Hillf Danton , syzbot Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, schatzberg.dan@gmail.com, sfr@canb.auug.org.au, syzkaller-bugs@googlegroups.com References: <20200308094448.15320-1-hdanton@sina.com> <20200309020900.16756-1-hdanton@sina.com> From: Jens Axboe Message-ID: <092fab4c-5308-4a14-ab3d-e63707efa2f6@kernel.dk> Date: Sun, 8 Mar 2020 20:17:01 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200309020900.16756-1-hdanton@sina.com> 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 3/8/20 8:09 PM, Hillf Danton wrote: > > On Sun, 8 Mar 2020 10:17:33 -0600 Jens Axboe wrote: >> On 3/8/20 3:44 AM, Hillf Danton wrote: >>> @@ -1208,8 +1211,16 @@ static int __loop_clr_fd(struct loop_dev >>> * >>> * 3) unlock, del_timer_sync so if timer raced it will be a no-op >>> */ >>> - loop_unprepare_queue(lo); >>> spin_lock_irq(&lo->lo_lock); >>> + do { >>> + struct workqueue_struct *wq = lo->workqueue; >>> + >>> + lo->workqueue = ERR_PTR(-EINVAL); >>> + spin_unlock_irq(&lo->lo_lock); >>> + destroy_workqueue(wq); >>> + spin_lock_irq(&lo->lo_lock); >>> + } while (0); >> >> This looks highly suspicious, what's the point of this loop? > > It is a while(0) loop that just gives me the chance for adding the > transient local variable wq. I think that adds more confusion than what is necessary, and I don't think the approach is great to begin with as you now need various checks as well for the workqueue pointer. We're freezing the queue right after anyway, which will ensure that nobody is going to hit an invalid workqueue pointer in terms of queueing. This looks more like an ordering issue. >> Also think this series a) might not be fully cooked, and b) really >> should have gone through the block tree. > > Gavel in your hand, Sir. Andrew, can you please drop this series so we can work out the kinks and get it properly queued up after? -- Jens Axboe