Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2199201ybc; Wed, 20 Nov 2019 10:19:44 -0800 (PST) X-Google-Smtp-Source: APXvYqwFZ9j+C85O+y8BwawqYjuXQMdXjfTZzbk8Lyu+EtZO58kuTo0XJCh36eXXM4EN6YGWxX/P X-Received: by 2002:adf:fbc1:: with SMTP id d1mr5370223wrs.267.1574273983872; Wed, 20 Nov 2019 10:19:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574273983; cv=none; d=google.com; s=arc-20160816; b=iUAn0m1ols7HVNAUf7VVrWL/jzrZY+zA5ppjdb1Uex9qir/yo486B+i+GjfAIls8vr 3dScg+aYxheENVx7OqiEuwhmVCi5qiBmg7p5CnhvyTrl6wAyHjWZQHci8748x0zBq6OG 9XsSmKYCaqyyvlHNWax5fhXjL6blK4HKb2VaZWbpCKokA6UKvt19552TTV1of4jg9m1F Y7gX643h/kr6uFiq+MmN1lMR9SfHKEYHn8d0hJdKl4MaHrMk8OUf41CoJQ2NCP3PIKkD Tkl7NRN1pUwhjoY1NfdYGETNghNv6zXTJmKq7tuuVrTh9MmRJFxbnBiAcsRWZHDl0CQO eHZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=lVd1X7a2M3jI8OS8rjkfZu6B8EnHKZ0eJkdBsI2LS6E=; b=JxLTED//Rqazugq0kus2AZAZCV8M5opVuQrla9/0IZd9oAz/6kCsBoCu+fYimU1D29 1tjYuYPewgPGFH6N55uLfDl22AAKqGpjMGWT9uWsqpFblEW9yPcO/95sndV2gJWbClj+ FZlqFXVbcRJXh+jNZhoPt155xX9Hx0bm6oRaQneBUZfzfXh5LIU8ilg99EazCS3mV12b rg8pi8k46ZFzN3pvqXJofTHb3ufs6WiXQqrYeR+0iIuMQOV+oNTjUNFFIbTD/0TJMPfB ybP0ency2Lcf2TG+Q81FMd8kHTqsVF9WAp1dpbjx/w713Z9hOxKQ1xKCCIOoL5DZFHXZ 2Z6g== ARC-Authentication-Results: i=1; mx.google.com; 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 35si147922edj.185.2019.11.20.10.19.17; Wed, 20 Nov 2019 10:19:43 -0800 (PST) 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; 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 S1727988AbfKTSSI (ORCPT + 99 others); Wed, 20 Nov 2019 13:18:08 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:34910 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1727671AbfKTSSI (ORCPT ); Wed, 20 Nov 2019 13:18:08 -0500 Received: (qmail 4222 invoked by uid 2102); 20 Nov 2019 13:18:07 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 20 Nov 2019 13:18:07 -0500 Date: Wed, 20 Nov 2019 13:18:07 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Pete Zaitcev cc: syzbot , , , , , , Kernel development list , USB list , , , Subject: Re: possible deadlock in mon_bin_vma_fault In-Reply-To: <20191120113314.761fce32@suzdal.zaitcev.lan> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 20 Nov 2019, Pete Zaitcev wrote: > On Wed, 20 Nov 2019 11:14:05 -0500 (EST) > Alan Stern wrote: > > > As it happens, I spent a little time investigating this bug report just > > yesterday. It seems to me that the easiest fix would be to disallow > > resizing the buffer while it is mapped by any users. (Besides, > > allowing that seems like a bad idea in any case.) > > > > Pete, does that seem reasonable to you? > > Actually, please hold on a little, I think to think more about this. > The deadlock is between mon_bin_read and mon_bin_vma_fault. > To disallow resizing isn't going to fix _that_. As I understand it (and my understanding is pretty limited, since I only started to look seriously at the code one day ago), the reason why mon_bin_vma_fault acquires fetch_lock is to prevent a resize from happening while the fault is being handled. Is there another reason? If you disallow resizing while the buffer is mapped then mon_bin_vma_fault won't need to hold fetch_lock at all. That would fix the deadlock, right? Alan Stern