Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2694734ybi; Thu, 4 Jul 2019 17:20:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwV1RYe0bGk9s7Kv4lp+6J91cxU/xgJ/GAWOGAwO+e8oXhuiso3k1V9vWYWdzN2QRwws5d X-Received: by 2002:a17:902:2808:: with SMTP id e8mr919757plb.317.1562286051578; Thu, 04 Jul 2019 17:20:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562286051; cv=none; d=google.com; s=arc-20160816; b=Z/KyadCxPf9c+ZsRpUacMzgDyElRR+Knk4Uhtx/qWQeNApp/RJec7++hoSCOqNmG1L yX6TF0nGz6Ozw2WPKKHu3hMyHLYYVrBZ9xmEBGGu08sy0nwOfGhKldyBlRV0zmnZphM2 Dk4BwPzof2PKwmaCBr8jm4webstZAq/t7qJDBJfMePprahHuvXIDTrpZKL4Y1QadH8Cu jHXkWjuMnZ+ECm9ue80v4LYkViIWqed4sCfHB//R17iuGW1JH7uOT5lxhLrTOxUyhoBv 7qzMpxT8s7XzI22vm17FbAfNZttCphqPp4yB6NM1gsG6Gbx9Ju8D1ZUvjkklln4xQwLG OEqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Mdnyveha/RWDLJ5/jRVhL1EwqowOMa3QT4sgefQcrrA=; b=L2tUS1aq5UuR45vb6D2W7dCEjaIWS8OEQO0Tx+0ajzQbZTjd8xkXPmBtaUCBJRLP4O Yb5Zm0ZWKJe17jBsPBmCZvKBypcaA+yFDaNY8UEJ0Fiq3h0jqSPp23q2PWbwauPzu/wp 8LjlT70EAOC5hqXHo9R2FjwOP+TNFFvUjP7pi80s2WNWVvIcp4MTFQ1XITXO+Fa0rnDQ jmh7rhNRMlN2ndzMzgK2U3D8F1hi79rHP0b0Oy5RKNVcszNw/IEB+ymHa7mkPFvsrE26 ZCQKd11yo95mu352RNueXmtoHwQ7RPyp2Km1qwX+1zzcDQX7e6ivLqbeTthkG2wMjSBO h0Bw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 102si6770028plf.250.2019.07.04.17.20.36; Thu, 04 Jul 2019 17:20: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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727778AbfGEAS5 (ORCPT + 99 others); Thu, 4 Jul 2019 20:18:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43802 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727246AbfGEAS4 (ORCPT ); Thu, 4 Jul 2019 20:18:56 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B0D8530001E2; Fri, 5 Jul 2019 00:18:56 +0000 (UTC) Received: from [10.72.12.202] (ovpn-12-202.pek2.redhat.com [10.72.12.202]) by smtp.corp.redhat.com (Postfix) with ESMTP id 81CA517795; Fri, 5 Jul 2019 00:18:45 +0000 (UTC) Subject: Re: [PATCH v2 1/3] vsock/virtio: use RCU to avoid use-after-free on the_virtio_vsock To: Stefano Garzarella Cc: Stefan Hajnoczi , netdev@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, "Michael S. Tsirkin" , "David S. Miller" , linux-kernel@vger.kernel.org References: <20190628123659.139576-1-sgarzare@redhat.com> <20190628123659.139576-2-sgarzare@redhat.com> <05311244-ed23-d061-a620-7b83d83c11f5@redhat.com> <20190703104135.wg34dobv64k7u4jo@steredhat> <07e5bc00-ebde-4dac-d38c-f008fa230b5f@redhat.com> <20190704092044.23gd5o2rhqarisgg@steredhat.homenet.telecomitalia.it> From: Jason Wang Message-ID: <23c014de-90b5-1de2-a118-63ec242cbf62@redhat.com> Date: Fri, 5 Jul 2019 08:18:37 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190704092044.23gd5o2rhqarisgg@steredhat.homenet.telecomitalia.it> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 05 Jul 2019 00:18:56 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/7/4 下午5:20, Stefano Garzarella wrote: >>>> This is still suspicious, can we access the_virtio_vsock through vdev->priv? >>>> If yes, we may still get use-after-free since it was not protected by RCU. >>> We will free the object only after calling the del_vqs(), so we are sure >>> that the vq_callbacks ended and will no longer be invoked. >>> So, IIUC it shouldn't happen. >> Yes, but any dereference that is not done in vq_callbacks will be very >> dangerous in the future. > Right. > > Do you think make sense to continue with this series in order to fix the > hot-unplug issue, then I'll work to refactor the driver code to use the refcnt > (as you suggested in patch 2) and singleton for the_virtio_vsock? > > Thanks, > Stefano Yes. Thanks