Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1807129pxb; Mon, 23 Aug 2021 05:16:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYIeN+S/UwplNawjfpxpXgXfjE5TPoifGg0/pCOqWRZGeMG+/XbnvVSnortrpvhpY8CEFG X-Received: by 2002:a05:6e02:20cd:: with SMTP id 13mr22458764ilq.156.1629720990213; Mon, 23 Aug 2021 05:16:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629720990; cv=none; d=google.com; s=arc-20160816; b=K39mhkurxJKCPr0/PcNxKt3OX3Pt4xxDhQGFRs9+X+aIhr5hgyI7oiIfbE5Po7NQzT kdr8XbHv2mspvKYGMsB+Yc3YsWLjMrtYjwC5yDZGfLMKuKMHDEsYn4Q1+JMx/Ts1vy5r 1fgcgUBOVNwdcIeeeVi45Yme6uVgqAJpDrz0q5/Xx6S3zyIBzdt2zPZ097cBzR97Qqgn dad4J04gph+2kgxVj/5bq9RN2KVvUS/msAbagd0ZAkT5NoUxKcfJNsIyeg9VhUyN5fiQ UAcyyuRFmlnIs+digeXfBGfs4txisHAK8DOTxKaU3vZj0AT9scTpHBrH/wli80nccetZ 4YxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JT+bCKc38JLNC9Va4YKqVGOJW8N9pOWm+qNgeILEytE=; b=WjNjhLRo20j67FUFFnVK7Z67S6nr+8lGIXmWP8rPrH/MJdnM1+BiACL6W1s3Ysk/e5 SSSC5FJ9O/GggCzJhlm23ovGk0Abki5b3RUWcrmpTq1AQ2lCI9qKNyVysyg5pagN5u+K 9Urbyg7jZR79QsSU1deBYLllTzjUxueXIt5mc851uSmjQJDqqsWNWYzfFZ62MEntz+et MaK0F0u4pu4S3j/TfuwZDQTmEQOgo5X+vn3Jy4u/rXMiVj+7MP2v4mZ6hGRUY5NJsB7p UlRzs03j+dkm2sa/gznVDarjY37SbrQRiQnAI/R0rqoXNskAA0cWVMnPWnrfLZ2SMHeL sYSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YwZ3v4Ne; 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 a14si9708428iod.86.2021.08.23.05.16.17; Mon, 23 Aug 2021 05:16:30 -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=YwZ3v4Ne; 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 S237156AbhHWMOo (ORCPT + 99 others); Mon, 23 Aug 2021 08:14:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:59768 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237027AbhHWMOX (ORCPT ); Mon, 23 Aug 2021 08:14:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629720821; 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=JT+bCKc38JLNC9Va4YKqVGOJW8N9pOWm+qNgeILEytE=; b=YwZ3v4NepPpR5DvgJ0oMHzBNqV4/W0sQPte60wcwWwQZ8DhP3Yfbe4JolFjlogSyZUqupH TB6QZVIk9v1Ymxm/HLhstubWF/OcCRhElvUm+LMn2RForOP9qlk8Rwuj49ngmeR59ZAWqi QWIc4Z+V7FbulmwICP3gXlu0GY5TkXk= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-577-AF0kfUYRNLKyn3qtXFcNuQ-1; Mon, 23 Aug 2021 08:13:39 -0400 X-MC-Unique: AF0kfUYRNLKyn3qtXFcNuQ-1 Received: by mail-ed1-f70.google.com with SMTP id h4-20020aa7c604000000b003c423efb7efso74649edq.12 for ; Mon, 23 Aug 2021 05:13:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JT+bCKc38JLNC9Va4YKqVGOJW8N9pOWm+qNgeILEytE=; b=GTt7F5J1JBeXi8jPgZp4lO+t0nRjQb9B8NTPEhZ/H/WuSSl7Q2ApR4ppMkJZUAGGno XPlNWMOY9mPUebnbE7HM56BuUN3g54sQm1u3fueKH1jnrXxpiktopMmxux3OVUFmDuma sLEwKyCNJViThEsXajO6KLyVISedvKW+73BFt74Uyx7pJj8hxwoLepztsXm7PK0zG5du 9Djz1LaPeKxuZM47fWPRAqSuQSGFXbjN/aoZ8CaIqwNhMUxW3WdhtU14dsoqco3gW5DW Z+anZe+2TF2Bfc4yqahGwHMxeFEX+SGVw33Sr+Q4R4LBq9dTNoR8eERAush4dpoqZ9Sd XbyQ== X-Gm-Message-State: AOAM532EJd6ta91Gb7VXmBOk3EqSiDA4hg11OS8HCAHzXBqp5bOV5Lq2 HWJKeusiNIEtJQewgWQdmh8/lIcwE0D4HnUHvUhPYxIIZx/pcmByQMP5ux/pYjGsyNtpIpHA6UU zN43J/SqIilQua0+eWOuvDOAz X-Received: by 2002:a17:907:9602:: with SMTP id gb2mr36019877ejc.354.1629720818842; Mon, 23 Aug 2021 05:13:38 -0700 (PDT) X-Received: by 2002:a17:907:9602:: with SMTP id gb2mr36019860ejc.354.1629720818703; Mon, 23 Aug 2021 05:13:38 -0700 (PDT) Received: from redhat.com ([2.55.137.225]) by smtp.gmail.com with ESMTPSA id y32sm155000ede.22.2021.08.23.05.13.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Aug 2021 05:13:37 -0700 (PDT) Date: Mon, 23 Aug 2021 08:13:34 -0400 From: "Michael S. Tsirkin" To: Max Gurtovoy Cc: Yongji Xie , Jason Wang , Stefan Hajnoczi , virtualization , linux-block@vger.kernel.org, linux-kernel Subject: Re: [PATCH v5] virtio-blk: Add validation for block size in config space Message-ID: <20210823080952-mutt-send-email-mst@kernel.org> References: <20210809101609.148-1-xieyongji@bytedance.com> <06af4897-7339-fca7-bdd9-e0f9c2c6195b@nvidia.com> <6d6154d7-7947-68be-4e1e-4c1d0a94b2bc@nvidia.com> <7f0181d7-ff5c-0346-66ee-1de3ed23f5dd@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7f0181d7-ff5c-0346-66ee-1de3ed23f5dd@nvidia.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 23, 2021 at 01:45:31PM +0300, Max Gurtovoy wrote: > It helpful if there is a justification for this. > > In this case, no such HW device exist and the only device that can cause > this trouble today is user space VDUSE device that must be validated by the > emulation VDUSE kernel driver. > > Otherwise, will can create 1000 commit like this in the virtio level (for > example for each feature for each virtio device). Yea, it's a lot of work but I don't think it's avoidable. > > > > > > > > And regardless of userspace device, we still need to fix it for other cases. > > > > > which cases ? Do you know that there is a buggy HW we need to workaround ? > > > > > > > > > No, there isn't now. But this could be a potential attack surface if > > > > the host doesn't trust the device. > > > If the host doesn't trust a device, why it continues using it ? > > > > > IIUC this is the case for the encrypted VMs. > > what do you mean encrypted VM ? > > And how this small patch causes a VM to be 100% encryption supported ? > > > > Do you suggest we do these workarounds in all device drivers in the kernel ? > > > > > Isn't it the driver's job to validate some unreasonable configuration? > > The check should be in different layer. > > Virtio blk driver should not cover on some strange VDUSE stuff. Yes I'm not convinced VDUSE is a valid use-case. I think that for security and robustness it should validate data it gets from userspace right there after reading it. But I think this is useful for the virtio hardening thing. https://lwn.net/Articles/865216/ Yongji - I think the commit log should be much more explicit that this is hardening. Otherwise people get confused and think this needs a CVE or a backport for security. -- MST