Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp1903062rwo; Sun, 23 Jul 2023 03:28:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlGsj8eJ9TX+U4yHC0C3NwoZXnoP8Y5cs0OFG1RosYo7jp45/OGuQkrKbMCXFpus0extteV9 X-Received: by 2002:a05:6a20:7f9f:b0:135:8a65:a772 with SMTP id d31-20020a056a207f9f00b001358a65a772mr8945499pzj.50.1690108107394; Sun, 23 Jul 2023 03:28:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690108107; cv=none; d=google.com; s=arc-20160816; b=w2+4gIhaNyJfTT+aWxZjB1IHIGBNDFlDJLenwGhm0IimnzN7E4AkG08LEtb4pjBCGi vbBfZUM9KT7WuCFgPT0hCDQF5fbiC1lQJJ4U8wqGzxTcNMxArjibTpyJvikMFCNEIuwe ipw3mN8VLziR6OvRcLRgFYtURm5/a9ArKqh8qtKtGHScXVwXyRQjkqODi5YpWJtEFZxR ChZda6lpqv2weu4i5o805CbRnMclwDO26vjQgtWdgfCBycu0+9ktL8LKQ9dCDchinGFz TWxqO5y/lwAXLfaTjDgeN6dHxiDR+mmEYKLH7XYjHwVPb4iXgNkiGj1YYiJDJbbxefTc 3F0g== 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=MDsrxTSy5pdFtexf9LRIFDEmJDg8QkrIZ2QGbjkCzEg=; fh=UqhMZ5rcycIrYWvWtNhRXYEJ+xfF4CMhBx5RuIV3lw8=; b=0/JX/79P7WbO/Yc9IfK19KCWvJ1FdNfn8o9R7VWTIUBPcW1qLcOzl1e6Fd+vGjmzmO Jyvp88Vnlra7g+ZI5TBCjgrNE3JhGi6qDvrJYXvDP48m/0AIjTOzo9EDWKUf2+tI4+nc wPgA4m8huGTV8yqTtvMPkFfPXyBcy8ACTOwoWXyCRSEj6pQOoSJGoDpiWYy6Cu5CpL9e kFklDiyIFzMlMHxZQIpg1QPS37k3Ae/exldlH8va013ITA9QrJ0JdNDfrwA4j7y1jA+O 32BbxKVuH/rPB17hGNtkeqLzIwglRE3xl1zcjl7UpLDZWT+J2NS8sNkOv8haBe2pvLd9 GQdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RQgEjY65; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 36-20020a630f64000000b0055f8db24692si7030294pgp.624.2023.07.23.03.28.15; Sun, 23 Jul 2023 03:28:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RQgEjY65; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229703AbjGWKDE (ORCPT + 99 others); Sun, 23 Jul 2023 06:03:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbjGWKDD (ORCPT ); Sun, 23 Jul 2023 06:03:03 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31D9810FD for ; Sun, 23 Jul 2023 03:02:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690106543; 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=MDsrxTSy5pdFtexf9LRIFDEmJDg8QkrIZ2QGbjkCzEg=; b=RQgEjY65Tl+vU3AIDavcBi8L9yBZxBbQ9OW+cApPy2rPb0GAnglw3+TwiaUyN13wSGdl+V 7yNHaCnz3OznBW/GeCGWuV8VxmYz9uJ7CMDYrCtdtph8zTvvq7Ydwv5t/PN0/5V1c7bfx0 BmS2NLpq+qkAWlBGsIu9V0qc6KTGLdk= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-602-fntMUNwZPmqNizA8EJgRfQ-1; Sun, 23 Jul 2023 06:02:22 -0400 X-MC-Unique: fntMUNwZPmqNizA8EJgRfQ-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-314394a798dso1644080f8f.0 for ; Sun, 23 Jul 2023 03:02:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690106540; x=1690711340; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MDsrxTSy5pdFtexf9LRIFDEmJDg8QkrIZ2QGbjkCzEg=; b=exhZHKH6drSfCV7Tp6r1K0dF72iazvjgMUVliDv83SEvc8IEdDajNjRQuEl0T2nD6h QsA/a9m2mpNqtY9A76VDHTXewYUfLeGDDj/U+znnHxVnkMTgZZuwJ8bSugo6VNTBl7mT 6sPQjICmL9sELECmC6vtmPC95IudGozJ+gYupzzUjvx51pwiyX+fAS7OjRD1BDyvr8tk ghPZRwxwiQ13ZYsqKwP3PfoKpRq1N3cCwLPHmBZEQnmTCzemxhuofZmFfZP+eGZ8yFSd Si4xv53hhXdL61AAQiAiCYcIFdxV+ivQqFEyfs7Ajumb8TdZehC65FQq2gs2hPhUvrlg WwwQ== X-Gm-Message-State: ABy/qLZfgB9uR8BKNpGStPTHQt5yqaahSvp3Qcs6w4EiMPC2xLJw8YdM +CLmEirn3CJZn22B6huCwRdU+vDS/A855WgbSPDTteWHx//tQDNNpZopvkFJ1RsN4O4675MMsVV p9aStwyzpTLycquagyLb4A+J9aogQ2ExjA8U= X-Received: by 2002:adf:f586:0:b0:314:1f0:5846 with SMTP id f6-20020adff586000000b0031401f05846mr8129287wro.19.1690106540636; Sun, 23 Jul 2023 03:02:20 -0700 (PDT) X-Received: by 2002:adf:f586:0:b0:314:1f0:5846 with SMTP id f6-20020adff586000000b0031401f05846mr8129277wro.19.1690106540254; Sun, 23 Jul 2023 03:02:20 -0700 (PDT) Received: from redhat.com ([2.55.164.187]) by smtp.gmail.com with ESMTPSA id m12-20020adff38c000000b003145559a691sm9270907wro.41.2023.07.23.03.02.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jul 2023 03:02:19 -0700 (PDT) Date: Sun, 23 Jul 2023 06:02:16 -0400 From: "Michael S. Tsirkin" To: Lin Ma Cc: jasowang@redhat.com, xuanzhuo@linux.alibaba.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Parav Pandit , Eli Cohen Subject: Re: [PATCH v1] vdpa: Complement vdpa_nl_policy for nlattr length check Message-ID: <20230723055820-mutt-send-email-mst@kernel.org> References: <20230723080507.3716924-1-linma@zju.edu.cn> <20230723050656-mutt-send-email-mst@kernel.org> <729f5c17.e4079.18982192866.Coremail.linma@zju.edu.cn> <8ecec51.e40ad.1898226c545.Coremail.linma@zju.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8ecec51.e40ad.1898226c545.Coremail.linma@zju.edu.cn> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 23, 2023 at 05:48:46PM +0800, Lin Ma wrote: > > > Sure, that is another undergoing task I'm working on. If the nlattr is parsed with > > NL_VALIDATE_UNSPEC, any forgotten nlattr will be rejected, therefore (which is the default > > for modern nla_parse). > > For the general netlink interface, the deciding flag should be genl_ops.validate defined in > each ops. The default validate flag is strict, while the developer can overwrite the flag > with GENL_DONT_VALIDATE_STRICT to ease the validation. That is to say, safer code should > enforce NL_VALIDATE_STRICT by not overwriting the validate flag. > > Regrads > Lin Oh I see. It started here: commit 33b347503f014ebf76257327cbc7001c6b721956 Author: Parav Pandit Date: Tue Jan 5 12:32:00 2021 +0200 vdpa: Define vdpa mgmt device, ops and a netlink interface which did: + .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, which was most likely just a copy paste from somewhere, right Parav? and then everyone kept copying this around. Parav, Eli can we drop these? There's a tiny chance of breaking something but I feel there aren't that many users outside mlx5 yet, so if you guys can test on mlx5 and confirm no breakage, I think we are good. -- MST