Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp1310135rdb; Fri, 20 Oct 2023 15:07:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHXYPqAmqlILl53WfkcnYRwI2qDshXI0tTS41BUMMK5+r8r1aJ9Jb9UTsLo+cbn9sd/hgMn X-Received: by 2002:a17:902:f542:b0:1ca:1c89:9acf with SMTP id h2-20020a170902f54200b001ca1c899acfmr3514819plf.53.1697839647864; Fri, 20 Oct 2023 15:07:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697839647; cv=none; d=google.com; s=arc-20160816; b=atjBY9tqQKoyB5JPGST3rVbxtxHeH13G2deBfIZl+L2J/uFPbO3EXsMT0JLoD0M3bX XUW34oOiMO/uZx/668U6VxXsow4dO57McZQG1u+3jcj4URUOud97zE7GPV9w4lEiQkrW bb39apQdvD52Ks8N4Yt6fiIeXoX+CNOzsfQt8CkhPiBWXsJBpr1KivGY1TK7LXPSwkNb SRg/IZX+1+enOmblgqoXdjiaFitb98nbji4r4X6NKr3jehTgnYHJOrxgs2KSbp86M2tZ ukMY3EBWZTEpVJDeCBZesN9tkMvZZMrxymxOhy//FWn2qwn517F1niOCMFBb8THINZtE LmHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=0ziqnC6GtzppY59+9/AQV5xoPS6hUBAE5tIKAAtv07A=; fh=AAH6ifJ1zCmYk+RthDf7mRyyELU6m8yYJd5Wrwi2l1w=; b=rfohu+OLN8X9qVy4MRMZJw5JswQzxcRfBQq1+qR31hGqQWLnJmG1P3iyfpfM/UFIRh Ae8f6SoFmEGTvQYjmAY15dD+4u+g/QppDtK1nKxiOukpo2XaUfxJ70llsok4iGcDBNQf i7zxzpS6q3wviolGg9nnncqmv2CLs4Yr++hvcdHPpuCL9TAfpWqab5urXuVp6s1bgTzh MabtYFe9CZuM1Dg4QOclr2TKOEvZQP1oJl9hTDVc/LVbmECeDrwG61kXQLqTAkiO7fBr NtDLxJMJYuls5jmAs3PxCbaJyaIiVcTVnlk2o772h1+wgiWAPdXKXXQwLIDCfvDBjSCN fGGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=WxUl7WlF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id d10-20020a170902c18a00b001befd0512e8si2483300pld.303.2023.10.20.15.07.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 15:07:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=WxUl7WlF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 1AD2E808A41E; Fri, 20 Oct 2023 15:07:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230196AbjJTWHK (ORCPT + 99 others); Fri, 20 Oct 2023 18:07:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230021AbjJTWHJ (ORCPT ); Fri, 20 Oct 2023 18:07:09 -0400 Received: from sonic315-27.consmr.mail.ne1.yahoo.com (sonic315-27.consmr.mail.ne1.yahoo.com [66.163.190.153]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44410D5A for ; Fri, 20 Oct 2023 15:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1697839624; bh=0ziqnC6GtzppY59+9/AQV5xoPS6hUBAE5tIKAAtv07A=; h=Date:Subject:To:References:From:In-Reply-To:From:Subject:Reply-To; b=WxUl7WlF4yZKsC600cW2yjh3Lmn9uAVCLv2BZa9S1lt+vtHHkcxbfPS6yNZNvw6bQoka/VUDbjpLcCVOKLVY3P56s6v0PWUAe6nfjyVv6rcybsfX6Dcot8QzGj4FzWEExYa3mVe3twhxW6AVNcs9J26rFOYXQRE/1aV9vg3vnqB9+gtADmKqXd5J3lgWL2w5ef3v7oVITLsVJtGBTWc5L+sMoavT32+5fKhCa0p3mWL2jljkmAgRbfGvx8A8FpKKK9FJUwpTVKSL/HfVi3giko+d2W5/okd7xsJumpsoH7UegrH8ktywlp4d1bRHH6eNlLt1uOSNNvz2Txd+oXY5YQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1697839624; bh=oQqhBinfNM6VlQ1VEno3Uml3fC6K79cvhV4wwFgAV33=; h=X-Sonic-MF:Date:Subject:To:From:From:Subject; b=VvSPdmLyeEoH8RUfpG/6fKY9ooE7mZ8VW4c/d/yPuYXzpjBYvh5uNXebA6lSDbNIMSRNlaXCRVdK4gFCKRChSGnn9MAwbO1a8duksk8UwhJZ/y+DbPPAdB5l57HXooeug+KbKIlkRFF3gN+mRdnr6yhP3sz6hTaczu56IHwEYDGOmQ5bkk6SzC1PxhXEoiLLXuDw2AR4bZ3WiAExDtGDXatf5jCvUoDueOXk9QsfDa1BIIDahwWBN2HipMkxXbyeQwkw2tOFbTZpD+s6AQkhPmX/DPZEqcucjZt51DxRHZnPY6kgc8A4QeVt1Kcff1ZBDpi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UaMHVdwXzaCr N.w1FHciMr_cTvTBtqQsHPx8drEoCcObLAs00pSuBaBFj2lZszjbfg0wBjiU5eEwzAE27aCje_j8 MIYWMwxYCCZKC0m2fcbT1nvvuPtcjQdq8idMXPsCCAp5k5Xp7SA0Sc_QF7QO6jF8EMPL7S_1.CGw 7Iv13vBaJmCLAPeDJFjhkc4YvAu54SRY09OBizuiY_bL1tIFXEUcFEGPcg0EgQ3fL_jwrKOYcBtK vt.rqQao8eA-- X-Sonic-MF: X-Sonic-ID: cb3359e9-1952-4f3d-9dbe-04a415f4cd58 Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.ne1.yahoo.com with HTTP; Fri, 20 Oct 2023 22:07:04 +0000 Received: by hermes--production-ne1-68668bc7f7-bm5xs (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 8af551ea7d173eec0b0ab5b18ea32b26; Fri, 20 Oct 2023 22:07:03 +0000 (UTC) Message-ID: <499aa925-f1fc-43de-ad5c-2fab28fb38e7@schaufler-ca.com> Date: Fri, 20 Oct 2023 15:07:01 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 1/4] vduse: validate block features only with block devices Content-Language: en-US To: Maxime Coquelin , mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com, stephen.smalley.work@gmail.com, eparis@parisplace.org, xieyongji@bytedance.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, selinux@vger.kernel.org, david.marchand@redhat.com, lulu@redhat.com, Casey Schaufler References: <20231020155819.24000-1-maxime.coquelin@redhat.com> <20231020155819.24000-2-maxime.coquelin@redhat.com> From: Casey Schaufler In-Reply-To: <20231020155819.24000-2-maxime.coquelin@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Mailer: WebService/1.1.21797 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 20 Oct 2023 15:07:20 -0700 (PDT) On 10/20/2023 8:58 AM, Maxime Coquelin wrote: > This patch is preliminary work to enable network device > type support to VDUSE. > > As VIRTIO_BLK_F_CONFIG_WCE shares the same value as > VIRTIO_NET_F_HOST_TSO4, we need to restrict its check > to Virtio-blk device type. > > Acked-by: Jason Wang > Reviewed-by: Xie Yongji > Signed-off-by: Maxime Coquelin > --- > drivers/vdpa/vdpa_user/vduse_dev.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c > index df7869537ef1..5b3879976b3d 100644 > --- a/drivers/vdpa/vdpa_user/vduse_dev.c > +++ b/drivers/vdpa/vdpa_user/vduse_dev.c > @@ -1662,13 +1662,14 @@ static bool device_is_allowed(u32 device_id) > return false; > } > > -static bool features_is_valid(u64 features) > +static bool features_is_valid(struct vduse_dev_config *config) This should either be features_are_valid() or feature_is_valid(). Correct pluralization is important in the English language. > { > - if (!(features & (1ULL << VIRTIO_F_ACCESS_PLATFORM))) > + if (!(config->features & (1ULL << VIRTIO_F_ACCESS_PLATFORM))) > return false; > > /* Now we only support read-only configuration space */ > - if (features & (1ULL << VIRTIO_BLK_F_CONFIG_WCE)) > + if ((config->device_id == VIRTIO_ID_BLOCK) && > + (config->features & (1ULL << VIRTIO_BLK_F_CONFIG_WCE))) > return false; > > return true; > @@ -1695,7 +1696,7 @@ static bool vduse_validate_config(struct vduse_dev_config *config) > if (!device_is_allowed(config->device_id)) > return false; > > - if (!features_is_valid(config->features)) > + if (!features_is_valid(config)) > return false; > > return true;