Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp940786pxp; Wed, 16 Mar 2022 22:03:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyT+8XXBrKKkE6oo3kfb6BB/nGltPBIdCJb7rrIpU1Z4GtUDsXksEGHZr2kzvNg1H9PS57s X-Received: by 2002:a17:902:f68f:b0:151:fbf5:db45 with SMTP id l15-20020a170902f68f00b00151fbf5db45mr2901788plg.60.1647493399921; Wed, 16 Mar 2022 22:03:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647493399; cv=none; d=google.com; s=arc-20160816; b=wjynq3+kiFBjY3+n0W1TRDTshIAQ41Iu5d+tVrfjGsf9Q7fs8kMpbJOWk/OPUWYMtd u7xMu+mp5YU8Ydus3zPVK0PD7ziG8CqcwlQAhsACWkFvRZlwl2xe0HXpO2iE7vL+nTjG sAwg5iNroTMNC4WjLpRA4L3n1ppsIFQU2iaGJhA2PEk4ziqRGK6jIbBfdgD2gx8QhK8K eEHtvBhgBSTa+95cmeIw/dlUYVckB36vMlsMvysW3WuXreMrCcSOK5JDIWSMWkP0+q1W WkKC8uUptKFN3bYvjhmUlxr1Nie4jxn5uJ+nANTmHbQF7XSJOkfxJldk1TJJ0o9C2HyP tyGw== 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:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=VdVjoDE29GDbc12Kq0tQIJLAtpcchS7GkEgyQYamOlM=; b=zcXAeNmDwKSmh+JZpRzOUGENwWY52LZtuam5avUxeCDR0/6qycN/bGOTQeWRBfTLP9 KfUx5gSp5c4rFawfdmmiyfdV2cqaaJa/VdWpzZoGxeIU0FEdsopc/fGlYeUcXOsazE5c L2xcyeEX2E3xHv0hXbsTHLJQJK+LOXRrd7zLuoPF6c8waDG0E14QSWVI5KCgY8ATe3oa o3YT/M1nCBLDkL2GgIQLFTxsj2dJca4ZNWSXqA1f6uffJpa7l6oV9PwPXXHwXlovNTVC DPxg7WWTbEyJh/u3tdD0v1PEP9AbnRQKDPGEQzAYSXfEI9CH2tAH9ULJgwAFx/PO2HRo 8CcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PnmdovmZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id p22-20020a1709027ed600b001501c29b560si4227805plb.402.2022.03.16.22.03.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 22:03:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PnmdovmZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 652E319D601; Wed, 16 Mar 2022 21:16:44 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353492AbiCPDuY (ORCPT + 99 others); Tue, 15 Mar 2022 23:50:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353487AbiCPDuW (ORCPT ); Tue, 15 Mar 2022 23:50:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA97D26576; Tue, 15 Mar 2022 20:49:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6180DB81883; Wed, 16 Mar 2022 03:49:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20867C340EC; Wed, 16 Mar 2022 03:49:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647402546; bh=8Cz/B7fg9fX5P0J2gHVThCXGpy/dkB3BtfxpXeVzrOU=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=PnmdovmZqxb/vqdEiFUoPidYDz/m4hVUp3VYwHaCoobFRXd6AmdyKDNa8YIu3BOY6 roZ7qsE1eaFt4oQrA9FbBHPA9oTJKCckb2M+tqbzJ16U/RAhHW4s405ErVt2Lt9uc7 T4L8JvOm2lDEdfv4STZmbhz4q+S6RTzP8zGtm2tiT0oYlqaS54QQ4mSVRO5MNNNnhj wkyfWhTFgKKVNqKwpXH4zZ4JAZuZFLMuSZr2kirPnzZEs5EhoCurHsBwCnrI0iV4c/ QxVn/ROUl7z8pgc3hTZbvy3JR1hwDx8zMW2cfoZN3tEU1jaTT9dZdudn1s53Sf+HnZ dUnPaZCl3c4EA== Message-ID: Date: Tue, 15 Mar 2022 21:49:01 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Subject: Re: [PATCH net-next 1/3] net: gre_demux: add skb drop reasons to gre_rcv() Content-Language: en-US To: Jakub Kicinski , menglong8.dong@gmail.com Cc: rostedt@goodmis.org, mingo@redhat.com, xeb@mail.ru, davem@davemloft.net, yoshfuji@linux-ipv6.org, imagedong@tencent.com, edumazet@google.com, kafai@fb.com, talalahmad@google.com, keescook@chromium.org, alobakin@pm.me, flyingpeng@tencent.com, mengensun@tencent.com, dongli.zhang@oracle.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Biao Jiang References: <20220314133312.336653-1-imagedong@tencent.com> <20220314133312.336653-2-imagedong@tencent.com> <20220315200847.68c2efee@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> From: David Ahern In-Reply-To: <20220315200847.68c2efee@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 3/15/22 9:08 PM, Jakub Kicinski wrote: > On Mon, 14 Mar 2022 21:33:10 +0800 menglong8.dong@gmail.com wrote: >> + reason = SKB_DROP_REASON_NOT_SPECIFIED; >> if (!pskb_may_pull(skb, 12)) >> goto drop; > > REASON_HDR_TRUNC ? > >> ver = skb->data[1]&0x7f; >> - if (ver >= GREPROTO_MAX) >> + if (ver >= GREPROTO_MAX) { >> + reason = SKB_DROP_REASON_GRE_VERSION; > > TBH I'm still not sure what level of granularity we should be shooting > for with the reasons. I'd throw all unexpected header values into one > bucket, not go for a reason per field, per protocol. But as I'm said > I'm not sure myself, so we can keep what you have.. I have stated before I do not believe every single drop point in the kernel needs a unique reason code. This is overkill. The reason augments information we already have -- the IP from kfree_skb tracepoint. > >> goto drop; >> + } >> >> rcu_read_lock(); >> proto = rcu_dereference(gre_proto[ver]); >> - if (!proto || !proto->handler) >> + if (!proto || !proto->handler) { >> + reason = SKB_DROP_REASON_GRE_NOHANDLER; > > I think the ->handler check is defensive programming, there's no > protocol upstream which would leave handler NULL. > > This is akin to SKB_DROP_REASON_PTYPE_ABSENT, we can reuse that or add > a new reason, but I'd think the phrasing should be kept similar. > >> goto drop_unlock; >> + } >> ret = proto->handler(skb);