Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp270065pxj; Fri, 14 May 2021 03:04:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxPb+gvDxfFhUQPGs6a8X5Aw0zIPQ5WjhHiXZ/LFaKSXn8M2g3GpZTTRr3VIiiE7kiTeX4 X-Received: by 2002:a92:ab09:: with SMTP id v9mr21514346ilh.55.1620986669896; Fri, 14 May 2021 03:04:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620986669; cv=none; d=google.com; s=arc-20160816; b=lEUoo3gGVRwwwVSTq3K7UQdyqOVilu/Ok4oeLZYZ3REVRJc53SWMg+8FV4X/DcuNp/ mC9ppC0Dt6TZqLKNNtZbr44Jjw4Qw5YH6I+f6jMfsc9mzcK7iLyLmLoUvymsdAYkp3gb pTnKXJ1avbY3MirMYg2r4kCzG4MBV7WaYxatnqJNwDrYcszF8CrClAklYgbEEuRUuw3j 2zO24lG6Bf50OVJySMoscM2OJgF2Rdsk7lUgH/l5zXac4mZWnPVfddzuDhkWAAt5x7Sv oV96XzLzbfoXL4B4AGF4ZIVg/E6R/4uMqPrmC5pAfV1RNDkA44/ODFuDCYaLj0xnQZuc ytVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=qEwXortYNaxldB+sCYne8sqnUUpZSsLp70/SckpgE3s=; b=ZvWs77CwqeSdgYbP4gMlO6FJdiz+A277+lVmuT1rpDHBzHx9rMJwMtzRABpJcF2EIe BFbGDFiYIr5u45ko6hiHA28NGG02ICWRhKAzc++Qib5qStf+0OYW7tM22CFq1/Ot7MxB ztOJNFX3sihOHVCn7Yxc0xZW+uhNyma0wNO0Edwg1z8yo2Adh2fIuYkhQm4wGDtNCHLZ VBJqjoKF6arWLl8agZzcRMw1SWIY9iDY/jCJDvz3+4k1IIUiYug6iBKCg0qT0pYGRGbE jEQ54Ruw0dpLQQP64rcg0lRD1pejLKBC67TBIjwcPYwW7REb/OUcqszAmSlF0owtKjnq kqaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=R9AyFeji; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s8si6245711iop.88.2021.05.14.03.04.17; Fri, 14 May 2021 03:04:29 -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=@redhat.com header.s=mimecast20190719 header.b=R9AyFeji; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232979AbhENHc2 (ORCPT + 99 others); Fri, 14 May 2021 03:32:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:43971 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230462AbhENHc2 (ORCPT ); Fri, 14 May 2021 03:32:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620977477; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qEwXortYNaxldB+sCYne8sqnUUpZSsLp70/SckpgE3s=; b=R9AyFejiWPzfw8MvZfhImgAY1fhqGcfyoj0AYBWCXpx4jDlkasYVKhirI5F3EMxju16FoK oIKdUVPbaNlF7Q33lSKEaVREKfbBc4mASmNabLkfLFDUTdsstkrvKacwwfoPTvjOWs7aDp lQk/paMXyCjMTJ/tdDq790DTOZi+/8I= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-315-3TUcTjVlPJWIq_bO95hhPw-1; Fri, 14 May 2021 03:31:15 -0400 X-MC-Unique: 3TUcTjVlPJWIq_bO95hhPw-1 Received: by mail-wr1-f72.google.com with SMTP id r12-20020adfc10c0000b029010d83323601so12359055wre.22 for ; Fri, 14 May 2021 00:31:15 -0700 (PDT) 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=qEwXortYNaxldB+sCYne8sqnUUpZSsLp70/SckpgE3s=; b=o+IvgtgiI693VqW9d2rw56u9q566EPZFEAS66QpUCgG4I3G7y9OCj1niJ/cYt30Jxk sT81n6/AryohnE/H41oX4mPGMw2qOeOBAkD+cbHUA+afMsBbOhTi0njukKv5ZBO82wRx 2tszFSgPylpQyEysv8WKZk2KOI5tYmOLburWd3JGrNLJeKpSXE4Cv9J/T05oSqCd/FO1 K7+NNgNvDq3RkLVfC6T4f7GCmvTyuAGL+hoeVahG4SeGp2B6CfOXeGHJaoB7RAQsm3mz fYE2IswYRtcOn2mifq//fHNOKte5Sh+MRHzACqq6/res9MGWF5Z9LnIYCdNStWr63YVE ExyA== X-Gm-Message-State: AOAM530MF96tSlrpMDW+qr+U/lQXUWYv+C92aH2aa5lhc76Eoe9I74iM 0tD4pLjAOKX74GD9la3ouzIrTl4VbPpx77AmuXIL8T4N/5DzRhIT/YSw6xV5iGjkD4PcfizL0dZ vgfrFAX1dwmLnGWOlix38t7DG+LzadMVJhQ38ml+b X-Received: by 2002:adf:ef8f:: with SMTP id d15mr56793933wro.326.1620977474226; Fri, 14 May 2021 00:31:14 -0700 (PDT) X-Received: by 2002:a2e:9c91:: with SMTP id x17mr24353676lji.385.1620977463809; Fri, 14 May 2021 00:31:03 -0700 (PDT) MIME-Version: 1.0 References: <20210423080942.2997-1-jasowang@redhat.com> In-Reply-To: From: Jason Wang Date: Fri, 14 May 2021 15:30:52 +0800 Message-ID: Subject: Re: Re: [RFC PATCH V2 0/7] Do not read from descripto ring To: Yongji Xie Cc: Stefan Hajnoczi , "Michael S. Tsirkin" , virtualization , linux-kernel , file@sect.tu-berlin.de, ashish.kalra@amd.com, konrad.wilk@oracle.com, kvm , Christoph Hellwig Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 14, 2021 at 2:07 PM Yongji Xie wrote: > > On Fri, May 14, 2021 at 12:27 AM Stefan Hajnoczi wrote: > > > > On Fri, Apr 23, 2021 at 04:09:35PM +0800, Jason Wang wrote: > > > Sometimes, the driver doesn't trust the device. This is usually > > > happens for the encrtpyed VM or VDUSE[1]. > > > > Thanks for doing this. > > > > Can you describe the overall memory safety model that virtio drivers > > must follow? For example: > > > > - Driver-to-device buffers must be on dedicated pages to avoid > > information leaks. > > > > - Driver-to-device buffers must be on dedicated pages to avoid memory > > corruption. > > > > When I say "pages" I guess it's the IOMMU page size that matters? > > > > What is the memory access granularity of VDUSE? > > > > Now we use PAGE_SIZE as the access granularity. I think it should be > safe to access the Driver-to-device buffers in VDUSE case because we > also use bounce-buffering mechanism like swiotlb does. > > Thanks, > Yongji > Yes, while at this, I wonder it's possible the re-use the swiotlb codes for VDUSE, or having some common library for this. Otherwise there would be duplicated codes (bugs). Thanks