Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5095528rdb; Sat, 16 Sep 2023 02:47:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHJyLJvz4+7n4VIgjAWyve78b2v1Yg4TkclBjWZVNKSsGYfiuzPDZl3d3uI3bETj1K4PeOz X-Received: by 2002:a17:902:e886:b0:1bf:349f:b85c with SMTP id w6-20020a170902e88600b001bf349fb85cmr4511920plg.1.1694857661373; Sat, 16 Sep 2023 02:47:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694857661; cv=none; d=google.com; s=arc-20160816; b=yRBaGvPM4ivd5rttZdRlEVp6MPASPE8TxjSIUJTQ/GFzw3EJ1Nl4/GbKFb2zIxHaJr ohItSw5GEiM3hEc3KXilXPhw0C442HN7fr8iNjR6g6nz8TgpyHZlbMaY9I1k51ZpnFw/ 5OoHnhUi/slXssvYjxrC4cSqbnrO2EpJF78qW+j9GhRnYSwvdkPk+c+vOwyx0spt5+Hc s+7AywtbWkOz0wXkTJJ6US6Jgq/NyVBUPAioRu7vjS9mMTzddHfhIfM1MQVRTvtTVE3D Z0aX42NPuOa9XPBxwwOfxsBXTOWFGxoj7po2ssIaBU8civ+soGRoJEr3s2u2xOZ75nSM dMwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=JJMWKG5nVw0rOZdlDWduF6hIwAWfXWswjHwiBK07s/o=; fh=ZyGohffqRDwpNztx73eKYGHQwsOqBOgfUQ8+g1maWO0=; b=zxeQKweZBrI/2t4dRWt01rZeM7VgjB7wbU2XDQqjlxF/7oeQkzmim2fUCK4VkHQZPl gMfMmmta3cFMPs/PDAT/dq34X2UaCnCGfA00zOxqxDVYMXk0msuc3ZLEMkA4wOTUPBMn 6nAcmDzNCeruW1qeCPlN74dWbGcmZvQUko70ZVvgF1zNOhvZDKx1S3XFb12aRxnCM8IG r+2i+D3HczcUBs4Bd+vS4w3zSnDlYhlQmg6lxmJv1klwEUihYclPKTol8JuwnQ3vy8f4 uPvYuVVts8DCtSaqCxvXwbzwTuf5RjrGgEn+f+1RbwuYjXouqn+XmRyapsasbbJXJzaB HDoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mojatatu-com.20230601.gappssmtp.com header.s=20230601 header.b=VjQxiWjX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ij6-20020a170902ab4600b001bee6def27dsi4764547plb.235.2023.09.16.02.47.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 02:47:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@mojatatu-com.20230601.gappssmtp.com header.s=20230601 header.b=VjQxiWjX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 7FE8D83896E2; Fri, 15 Sep 2023 15:55:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237824AbjIOWz1 (ORCPT + 99 others); Fri, 15 Sep 2023 18:55:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237996AbjIOWzW (ORCPT ); Fri, 15 Sep 2023 18:55:22 -0400 Received: from mail-yw1-x1130.google.com (mail-yw1-x1130.google.com [IPv6:2607:f8b0:4864:20::1130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 624CFE7 for ; Fri, 15 Sep 2023 15:55:17 -0700 (PDT) Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-59be8a2099bso27502607b3.0 for ; Fri, 15 Sep 2023 15:55:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20230601.gappssmtp.com; s=20230601; t=1694818516; x=1695423316; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=JJMWKG5nVw0rOZdlDWduF6hIwAWfXWswjHwiBK07s/o=; b=VjQxiWjXnsngN09wdDGilt/VL7IE8eyAvBXFTzWS0Q7IBnZJ6j3oe8ccihpmXlAYIR QkBhnWWPqRsDUHGQ5S44ywKPLmhGehUYMKMnYvI2tBD9AkcTp+7b8P3+ljisKDqy95vw iE5Og1VQj4C7asn9ggtaImmovkDNSSIR/qhRQSA7rksqYfnpAPvIC9PRGmOoC6IxXv5d eiOrA2sWpPSBvqjWSfKi4pn4KNAw8+huzofQ9ubkz0ocmKf+fQ/yNO96Vu5Cx1qE08k+ XcQ9XUWsiUdDWA7UilZs3l2LeCUBrfNDPGzXisY8xZIeyDI72hzA/JtryL6TmLJ3ti8J J39g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694818516; x=1695423316; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JJMWKG5nVw0rOZdlDWduF6hIwAWfXWswjHwiBK07s/o=; b=AzwASIRm3b1lPS/FGxkqdwcG6AXOS1V4JlTV03cTkSpKJOQs0WnYRAqCkH72PKLbOx I1Y2DhUhYSGjdN87c9TQ3exh5nqli8mCjYnYhK/VHfet+qsxRC9KgDv/Gwe4waRcENRI Pe5DYHeU/I2Z8LM0AZqCllUePd+9dh74dvHeNjQ09QxjHWdkJbMaMJx8dzGyb1KS+Jfq 1RfvlocigZ17QihsJ9xg3024JvrPz4SVd1vCxZOijRN5OB3cAo5MTQNylFn0Y9TuvCON 81y2aQ8aCHQjUZwclvk82wNwGwJZsCdmfKJ9RgcWgIgCkJ/Z6xQsMHcGs5ea2cSTgEFO xGog== X-Gm-Message-State: AOJu0YzQHD8Hmwdj5z+ulBRNuykMzPk02jDREqd6b4F4KyBzWtnp3ekb icZNw/1Jt9HJkDLtSBr1CZMhWC/ZRsBQnfIG0HzKrQ== X-Received: by 2002:a81:918c:0:b0:58c:b845:e4d6 with SMTP id i134-20020a81918c000000b0058cb845e4d6mr3269532ywg.4.1694818516624; Fri, 15 Sep 2023 15:55:16 -0700 (PDT) MIME-Version: 1.0 References: <20230915104156.3406380-1-make_ruc2021@163.com> <16461255-c2c0-2ffd-f031-5b7a1f67bf7e@mojatatu.com> In-Reply-To: From: Jamal Hadi Salim Date: Fri, 15 Sep 2023 18:55:05 -0400 Message-ID: Subject: Re: [PATCH] net: sched: drr: dont intepret cls results when asked to drop To: Eric Dumazet Cc: Pedro Tammela , Ma Ke , xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Victor Nogueira Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 15 Sep 2023 15:55:54 -0700 (PDT) On Fri, Sep 15, 2023 at 11:06=E2=80=AFAM Eric Dumazet = wrote: > > On Fri, Sep 15, 2023 at 5:03=E2=80=AFPM Pedro Tammela wrote: > > > > On 15/09/2023 09:55, Eric Dumazet wrote: > > > On Fri, Sep 15, 2023 at 12:42=E2=80=AFPM Ma Ke = wrote: > > >> > > >> If asked to drop a packet via TC_ACT_SHOT it is unsafe to > > >> assume res.class contains a valid pointer. > > >> > > >> Signed-off-by: Ma Ke > > >> --- > > >> net/sched/sch_drr.c | 2 ++ > > >> 1 file changed, 2 insertions(+) > > >> > > >> diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c > > >> index 19901e77cd3b..2b854cb6edf9 100644 > > >> --- a/net/sched/sch_drr.c > > >> +++ b/net/sched/sch_drr.c > > >> @@ -309,6 +309,8 @@ static struct drr_class *drr_classify(struct sk_= buff *skb, struct Qdisc *sch, > > >> *qerr =3D NET_XMIT_SUCCESS | __NET_XMIT_BYPASS; > > >> fl =3D rcu_dereference_bh(q->filter_list); > > >> result =3D tcf_classify(skb, NULL, fl, &res, false); > > >> + if (result =3D=3D TC_ACT_SHOT) > > >> + return NULL; > > >> if (result >=3D 0) { > > >> #ifdef CONFIG_NET_CLS_ACT > > >> switch (result) { > > >> -- > > >> 2.37.2 > > >> > > > > > > I do not see a bug, TC_ACT_SHOT is handled in the switch (result) j= ust fine > > > at line 320 ? > > > > Following the code path (with CONFIG_NET_CLS_ACT=3Dn in mind), it looks > > like there are a couple of places which return TC_ACT_SHOT before > > calling any classifiers, which then would cause some qdiscs to look int= o > > a uninitialized 'struct tcf_result res'. > > I could be misreading it... But if it's the problem the author is tryin= g > > to fix, the obvious way to do it would be: > > struct tcf_result res =3D {}; > > CONFIG_NET_CLS_ACT=3Dn, how come TC_ACT_SHOT could be used ? > > Can we get rid of CONFIG_NET_CLS_ACT, this seems obfuscation to me at > this point. The problem is the verdict vs return code are intermixed - not saying this was fixing anything useful. We discussed this in the past after/during commit caa4b35b4317d5147b3ab0fbdc9c075c7d2e9c12 Victor worked on a patch to resolve that. Victor, maybe revive that patch and post as RFC? cheers, jamal