Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3425764pxb; Wed, 13 Oct 2021 05:54:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4xSz/dh8u7HRu4ppHkfxplMFPl525LKgZpdjOOJvjL4Yv5lmrf3vy/pDKTFIOUBDoZRaq X-Received: by 2002:a17:906:c1c9:: with SMTP id bw9mr40545127ejb.3.1634129670016; Wed, 13 Oct 2021 05:54:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634129670; cv=none; d=google.com; s=arc-20160816; b=cKXL+BeOdL1cU/WSqeEZsGyc91Ax/Fa2UnD6T3jj8Oc8JaJvHJ9a8+XSiGSD6sJv+1 reGUBKzxB410XrfORkelntN/ofs/3JCakH8YUuzkzlrzgMoaHvQDh0JVI7tKIfacA47j tlsgbx2VcotQQaVn8QByt2Cg+WEV5vfioR1KTr56BEorBnI7akfWC4w9ToDR9ztW3GYR JA2+dmhueNEdYr6WrYE85Nuj55W7MoAYPp4eIS3n91ogU/6Pe+rNFSj+Ag5mhrld+A2t YelV2mRURPNdbfufAYK0Jxcsh49pT5pGlsDKyAafHtxOMQs3eRqu0IohJiG+tLtfBI6i 2Rgg== 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=T/7FiCB1ISKOEoQmv0h0vU/4qoNS1mIBBsK6BA/38aI=; b=IYVnIa+vvqtADnYnmnNTxIS7PpesmS8KAeCJ8/AaZb8B1VflaPXSP26rXQmT3egJXP 7Kpxms+Gk+7YBA59upY3jTz6pOZ9u5iKn9fIHGG7FcKxI2GKE0cmKr7nEuleKmuVrB6T wx4z7yEjSHGK8nHpBgeKzLt5ioeeo3hw59bGyFMgc/b7EtzkAc5hQ2ekNyOrVpxJq2IT mO1UfFIOmT6fuixQNHpo2HOn/8x71lVfZEOsvTY/6E7+4gin+UcSLo/zjd79JtpJt6FF 3jo+CgiDnF29h+vzUzc8W1jd43Q3t0uq1IsDS1JmDhGnyL+N+QCiACB6XDREzcchYjiF ym4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eQS7Da+m; 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 e8si19909020ejh.79.2021.10.13.05.54.01; Wed, 13 Oct 2021 05:54: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=eQS7Da+m; 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 S233580AbhJMMxr (ORCPT + 99 others); Wed, 13 Oct 2021 08:53:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32526 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232486AbhJMMxq (ORCPT ); Wed, 13 Oct 2021 08:53:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634129503; 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=T/7FiCB1ISKOEoQmv0h0vU/4qoNS1mIBBsK6BA/38aI=; b=eQS7Da+meQrkDunshiehhtY1ofFpXtpZtF/twq99yQcJcmUJMxuoTZ2UJsa0BHsLHc8jj/ ZHCTLf0Ko/8V4tFPq3QoU4wsxJ2TWm1Isj2B8XxVKp/xSLwGWxUy/RKoFQlTWKnwGYkTK7 Xyfex4ajtKs1xhO/X87muA8CgVTcxv4= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-93-344-8gWyMqKmd-56IGmDXw-1; Wed, 13 Oct 2021 08:51:41 -0400 X-MC-Unique: 344-8gWyMqKmd-56IGmDXw-1 Received: by mail-wr1-f69.google.com with SMTP id d13-20020adf9b8d000000b00160a94c235aso1916324wrc.2 for ; Wed, 13 Oct 2021 05:51:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=T/7FiCB1ISKOEoQmv0h0vU/4qoNS1mIBBsK6BA/38aI=; b=VU1umoWIPVQORbIPzMZk1q9SwZOk96tTjxfWNsLpbHNRIWX8/h2JvqnrT50tvmcVTt HFR4UbRzbV+3ImrlFvBpi/PMtaK06hYEiqX7ZlzpmMm6/M9aq5tnENS9XHjzdtzwscFp NGXR+9DbzMkKEtcrR4HCBZWmsVI7tL8KvktPGON8KBQZGH99W8Ka8wwOnU5jpEykLQqK VFm6izIRiID57ZzZ1aZ6kOFUd1RnN4dISGwiS3cx7wWdUnvHgv9wL/JU/lQLf2Oow6P6 F7gAwh1RICuiYnec9UOAVlKSb3Z+gBVnGfQH89XizXPkK8FXN2i9zDgbZG/ifvF7zNVp F+zQ== X-Gm-Message-State: AOAM5311b1hanjxGM7BFvdtVhOkfig6FfeyXU0e+pyV9urdDPJIo1wo3 hiXrmd3k2ZVGHzQ8Kk9tllp0IEmOauotV2MtRpiNekede0nPRifmBsjTtxEPWooBtfnzTWYIRmU tAT+PRWmNskhk/eKun6ggw/0y X-Received: by 2002:a1c:29c7:: with SMTP id p190mr12443695wmp.65.1634129500756; Wed, 13 Oct 2021 05:51:40 -0700 (PDT) X-Received: by 2002:a1c:29c7:: with SMTP id p190mr12443682wmp.65.1634129500615; Wed, 13 Oct 2021 05:51:40 -0700 (PDT) Received: from redhat.com ([2.55.30.112]) by smtp.gmail.com with ESMTPSA id j1sm16548759wrb.56.2021.10.13.05.51.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Oct 2021 05:51:40 -0700 (PDT) Date: Wed, 13 Oct 2021 08:51:36 -0400 From: "Michael S. Tsirkin" To: Yongji Xie Cc: Christoph Hellwig , Jason Wang , Stefan Hajnoczi , virtualization , linux-block@vger.kernel.org, linux-kernel , Kevin Wolf , Jens Axboe Subject: Re: [PATCH v5] virtio-blk: Add validation for block size in config space Message-ID: <20211013084711-mutt-send-email-mst@kernel.org> References: <20210809101609.148-1-xieyongji@bytedance.com> <20211004112623-mutt-send-email-mst@kernel.org> <20211005062359-mutt-send-email-mst@kernel.org> <20211011114041.GB16138@lst.de> <20211013082025-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 Wed, Oct 13, 2021 at 08:34:22PM +0800, Yongji Xie wrote: > On Wed, Oct 13, 2021 at 8:21 PM Michael S. Tsirkin wrote: > > > > On Mon, Oct 11, 2021 at 01:40:41PM +0200, Christoph Hellwig wrote: > > > On Tue, Oct 05, 2021 at 06:42:43AM -0400, Michael S. Tsirkin wrote: > > > > Stefan also pointed out this duplicates the logic from > > > > > > > > if (blksize < 512 || blksize > PAGE_SIZE || !is_power_of_2(blksize)) > > > > return -EINVAL; > > > > > > > > > > > > and a bunch of other places. > > > > > > > > > > > > Would it be acceptable for blk layer to validate the input > > > > instead of having each driver do it's own thing? > > > > Maybe inside blk_queue_logical_block_size? > > > > > > I'm pretty sure we want down that before. Let's just add a helper > > > just for that check for now as part of this series. Actually validating > > > in in blk_queue_logical_block_size seems like a good idea, but returning > > > errors from that has a long tail. > > > > Xie Yongji, I think I will revert this patch for now - can you > > please work out adding that helper and using it in virtio? > > > > Fine, I will do it. > > Thanks, > Yongji Great, thanks! And while at it, pls research a bit more and mention in the commit log what is the result of an illegal blk size? Is it memory corruption? A catastrophic failure? If it's one of these cases, then it's ok to just fail probe. -- MST