Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1978952pxb; Mon, 23 Aug 2021 09:05:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzP7xe5YgkQ7XG5VoNIrnjJVGzzV9D13Hq9h+C6J1ae+fKNeEpz/Q8EElT3yYJRXxLhmoSZ X-Received: by 2002:a17:906:6815:: with SMTP id k21mr36625914ejr.371.1629734728735; Mon, 23 Aug 2021 09:05:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629734728; cv=none; d=google.com; s=arc-20160816; b=v9e1w3wKEEcAI5kmMeClh4Ly42lVr3N18zKVh9M01r02bSzZ5jcb6N7fAQ3pnzVrqt gSDPglEGcVITyASOxZ1OvzCaE1fTHbZ4FQkp2LhHZGpww82aDh5hA1Ry4BpWqwvHuxzE tJoTKhpwyNxyXmnmxrvgiKtugoY+i4Auuf3MImB/XnkQHx4ZmhCEhveFVcxqB/yYrhBc KqaIfYn1jGUcIILZK81sTsU8xsa5Bg8hYC03dmI2L5lgqXnlrHsjG7EBvVMfuMn1KD1X claJgJeYhhQKu/qP8KfoyjxfIdNOVh5ot1ekIVS9C+SdVIs0mYK0I4mFBKXb0ImWrbUT /ZYQ== 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=VGHv+t7XJoBwzuDgFH5TfVqMsvYX/VooC0Y/PX4tAJg=; b=VjZriKMM3iS1irucm9A0cojPifDpzEbQ692wvktKGvP8JbBsisPFAeMPNR0xSRl00n 6c/DtPD1UgrkLGvpkJ1fqLBHfuquc/9BQvtAsKVJok5ArI4Mw70vZFzkDd/5I2m2kcTr 1Rl/tiC157X+Vg5KASOctoyYBGxc3nIf3nNL6orwKk+4CseDovEmHH5OB54klLy99wIR OPtfSl8ev67p0LYGVFm2R9aTLJ4kmwscV0uPhXkAfs8r+VGH4/KL0h7tc5THcnOBz6sG L8gaGORZlrOmNvti6kYaRAOVCg7K0wi5pspuxhkUWjlcqnAwv4qymM1pix2DK0xbAO9V ykzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=G7DcbcK+; 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 r8si10936336edh.510.2021.08.23.09.05.04; Mon, 23 Aug 2021 09:05:28 -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=G7DcbcK+; 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 S230418AbhHWQDt (ORCPT + 99 others); Mon, 23 Aug 2021 12:03:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:33087 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230241AbhHWQDs (ORCPT ); Mon, 23 Aug 2021 12:03:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629734585; 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=VGHv+t7XJoBwzuDgFH5TfVqMsvYX/VooC0Y/PX4tAJg=; b=G7DcbcK+yr8woorkZOtfubxTkFMR3gHlASe4k8l07BFzJ2E2nrHjwVyuTEhnyvmfsFMFc2 MEpzZ6nvo9WZzMtpf7TveF6PwL+97eIlORiaKKwF5kYPQAFFTN8Rew4UUfxoP74eg0Rqbm GWsGqITtCEN6wKeK2cCdjve1ikZGgQE= 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-528-GT8HftJuOSShlcHCagImGA-1; Mon, 23 Aug 2021 12:03:03 -0400 X-MC-Unique: GT8HftJuOSShlcHCagImGA-1 Received: by mail-ed1-f70.google.com with SMTP id s25-20020a50d499000000b003c1a8573042so3274244edi.11 for ; Mon, 23 Aug 2021 09:03:03 -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=VGHv+t7XJoBwzuDgFH5TfVqMsvYX/VooC0Y/PX4tAJg=; b=scb3Q6ZVqAPafNOo7TF69nOQkFBSzU5HrjyqTycxjbEQxdXHaiz55b1ng49uhPgWEu m/g8M4BH7nZ8PMQ+if77oXMJToccct8GxrJlJdeiLj3Eq0V1b+qT0JqwQE0R0a6YRzqK T9fTcZwHyINeuT+4HAU9YsTSkHZC1PxEM4JMo5eRneGK0eW3RzsU3/GIqkstKetHX5kO uihInh+iYJvCBNZ2AGd+j7NmQ3IuePz1OrC6m5oHGK0dFe5i4F5Vt6DfEN3nopr0J15G LOg6/7/YYlA2GA+TuKI25ibob1GuxzPkxSgK4QDg/IweEhAYOQ8Kq4S8gX+XHnDbIxG/ q+vQ== X-Gm-Message-State: AOAM530ZhlLtDvUPBZbVE60/FxjT6qonITCIVmO4ZF7ZbbUuLgztY/K3 V4q7kydtM61qgrBKhEBAs9FLbSLf7ufQHE7mahVXbxjLDALwMHYuf2qMvbPArkD+g0AZFgXLjte Drcyg3P+31syGgp5dl+ITDJUG X-Received: by 2002:a17:906:7d83:: with SMTP id v3mr36533886ejo.216.1629734582686; Mon, 23 Aug 2021 09:03:02 -0700 (PDT) X-Received: by 2002:a17:906:7d83:: with SMTP id v3mr36533860ejo.216.1629734582438; Mon, 23 Aug 2021 09:03:02 -0700 (PDT) Received: from redhat.com ([2.55.137.225]) by smtp.gmail.com with ESMTPSA id f8sm9832100edy.57.2021.08.23.09.03.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Aug 2021 09:03:01 -0700 (PDT) Date: Mon, 23 Aug 2021 12:02:58 -0400 From: "Michael S. Tsirkin" To: Yongji Xie Cc: Max Gurtovoy , 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: <20210823120229-mutt-send-email-mst@kernel.org> References: <06af4897-7339-fca7-bdd9-e0f9c2c6195b@nvidia.com> <6d6154d7-7947-68be-4e1e-4c1d0a94b2bc@nvidia.com> <7f0181d7-ff5c-0346-66ee-1de3ed23f5dd@nvidia.com> <20210823080952-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 23, 2021 at 08:40:30PM +0800, Yongji Xie wrote: > On Mon, Aug 23, 2021 at 8:13 PM Michael S. Tsirkin wrote: > > > > 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. > > > > OK, do I need to send a v6? This patch seems to be already merged into > Linus's tree. > > Thanks, > Yongji No, it's a comment for the future - I assume you will keep adding this kind of validation in other places. -- MST