Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5102073rwd; Tue, 23 May 2023 18:31:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4zckj4iDBx0WyecZyWe5tHsncGykdNYeumPRWVRo2wnd5OEGrOeHGk0asQL4EIh8NzxnCO X-Received: by 2002:a05:6a00:1a8f:b0:62d:cfd4:e440 with SMTP id e15-20020a056a001a8f00b0062dcfd4e440mr1191146pfv.8.1684891871342; Tue, 23 May 2023 18:31:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684891871; cv=none; d=google.com; s=arc-20160816; b=Q5D6up8vWrxMp/7E174upI8hEK6cWSHiyDboZIjVTr40YhbCK7GqyC3+VtOHpaVnGZ Imnwd4o6YfWFIyk8znASgg5lQtyK9cPG+WSr/uIyCZhS94aVokFYQ5ocbBzVn1bVpivo HuXZPtaPwyvfr/+hEj/h2ZSx5sjh1WPF+EuanFsIX39SNpsZQMIlt+mQAzeNRI7WMzxH /VCgJlB7jBfwVfDpnriXjV2zM08/p3B2lIKs68PtjmekuV3uorkbyOilS65eox3BdiWG BVm2qyLnfhnvlje1bHJjJYt4a3JWeSt5Np/NI2iCcannm9uow5WUwP955FuOPl9t2A46 GvAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=8Lfp3+dMXCvts3RRtwZyL54uqMM5sA4kXWO4EIcMZJo=; b=lG6kp0f9s2uwTQ+Q8OLTZyNocXs8oKkryWSxxYUcrY/sgVSHK6nfZ7bAm8vLwtnDz3 JZKpLEzFUjvDpegUNuttq5LCHByQB4GiaAFeSUB+YrJOTHWQoMc3+4S65eiF4s7wbC5D nShI4U6ErlWEQh4QcedCX/WFkfHnPan8ONqclNNl1b8ieaqhT0GjtYyVl4t7gJyJaUQb V3+2cf6y9AH77Mryi1pqvGciKsXEifiJdssqxSfPPTM692/u5bgHRtI2QTPnOSY69GGQ LjP0slzLnt6vEu6f+3Ybfc4pQZPc41mMr+0FHRu9oJlKQneCE93Bw9ZTU58/YGsF3oBt BkrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=VrAWuyX3; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z1-20020a633301000000b0050309caf60esi7553667pgz.750.2023.05.23.18.30.56; Tue, 23 May 2023 18:31:11 -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=@gmail.com header.s=20221208 header.b=VrAWuyX3; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238698AbjEXBQf (ORCPT + 99 others); Tue, 23 May 2023 21:16:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230480AbjEXBQe (ORCPT ); Tue, 23 May 2023 21:16:34 -0400 Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 286CDDA; Tue, 23 May 2023 18:16:33 -0700 (PDT) Received: by mail-qt1-x82f.google.com with SMTP id d75a77b69052e-3f392680773so3569171cf.0; Tue, 23 May 2023 18:16:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684890992; x=1687482992; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=8Lfp3+dMXCvts3RRtwZyL54uqMM5sA4kXWO4EIcMZJo=; b=VrAWuyX3D6A+MD/zUNY15G2S7wPKifPsc9GWv8BS9Op3UDJ3izFSGCnxvPRa44DVUl TjYC/HSvS2SCUaKd2HEVs4DxpMooJD1P1Ensp1kt8mlKlbo2fvWgCiILivMjtpZZNy1m 42QcxzGX3buObKded9kE8Ubz/+lBJDpyNmpGwjJoAjaLDG0ka+YAydTTY9dj0zKUBtaZ BQCP6iSr3D2BBvWAQkIXIKUCqbRQI1euymeN/URQ1wLwlw956mj76Y5DGKW8nUmaw9RK ZNiAVGwLajt7Fz+RpOs0pr/5sZeKcSbgzm7BPw/+650dl2dCHZNpm5G5fows1k055NY7 gatw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684890992; x=1687482992; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8Lfp3+dMXCvts3RRtwZyL54uqMM5sA4kXWO4EIcMZJo=; b=D//TwcCRzvzBTxwb2Pon4HWwHxJB9MByCkWUNakjzrUUE35Jci09LHSLkUVyGa68ie 9ApVKDl2ZINhUDI9ouf0H7RWkuk/03TycecS272UjOgKalgyLfcJxbz5OlvVLwUhmwwl u13FPNOEct5DlqiqapwlN6cstCV/f16raPr3VKxyC/tYhoc7JQpNTLO4uEd0YhOse/E/ tn3NolWWtCiKmxCTFkS6Yy3VSEzi3gWyMeEyYK3Pz3TdUrOS0+3zGP1/Pfks3rnKkXnN gePFZAZJmw79Qc3c4oOJdhCjBbd9pCBVplHpuloGFnOfTuW4sycDFDD1f7X1cfC7vJDA ZuIw== X-Gm-Message-State: AC+VfDyhPjmpyzkbg/vRTQLhmOQ3bed7Rr8stAgF6uoyJbShw408bN00 Bm2F5GX7Nct1NvbPl1QC9TlTOlKhtg== X-Received: by 2002:a05:622a:1487:b0:3f6:9bcc:4885 with SMTP id t7-20020a05622a148700b003f69bcc4885mr19979131qtx.50.1684890992209; Tue, 23 May 2023 18:16:32 -0700 (PDT) Received: from C02FL77VMD6R.bytedance.net ([2600:1700:d860:12b0:c32:b55:eaec:a556]) by smtp.gmail.com with ESMTPSA id z28-20020a05620a101c00b007579f89c0ccsm2930151qkj.29.2023.05.23.18.16.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 May 2023 18:16:31 -0700 (PDT) From: Peilin Ye X-Google-Original-From: Peilin Ye To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jamal Hadi Salim , Cong Wang , Jiri Pirko Cc: Peilin Ye , Daniel Borkmann , John Fastabend , Vlad Buslov , Pedro Tammela , Hillf Danton , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Cong Wang , Peilin Ye Subject: [PATCH v5 net 0/6] net/sched: Fixes for sch_ingress and sch_clsact Date: Tue, 23 May 2023 18:16:21 -0700 Message-Id: X-Mailer: git-send-email 2.30.1 (Apple Git-130) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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 Link to v4: https://lore.kernel.org/r/cover.1684825171.git.peilin.ye@bytedance.com/ Link to v3 (incomplete): https://lore.kernel.org/r/cover.1684821877.git.peilin.ye@bytedance.com/ Link to v2: https://lore.kernel.org/r/cover.1684796705.git.peilin.ye@bytedance.com/ Link to v1: https://lore.kernel.org/r/cover.1683326865.git.peilin.ye@bytedance.com/ Hi all, These are v5 fixes for ingress and clsact Qdiscs. Please take another look at patch 1, 2 and 6, thanks! Changes in v5: - for [6/6], reinitialize @q, @p (suggested by Vlad) and @tcm after the "replay:" tag - for [1,2/6], do nothing in ->destroy() if ->parent isn't ffff:fff1, as reported by Pedro Change in v3, v4: - add in-body From: tags Changes in v2: - for [1-5/6], include tags from Jamal and Pedro - for [6/6], as suggested by Vlad, replay the request if the current Qdisc has any ongoing (RTNL-unlocked) filter requests, instead of returning -EBUSY to the user - use Closes: tag as warned by checkpatch [1,2/6]: ingress and clsact Qdiscs should only be created under ffff:fff1 [3/6]: Under ffff:fff1, only create ingress and clsact Qdiscs (for now, at least) [4/6]: After creating ingress and clsact Qdiscs under ffff:fff1, do not graft them again to anywhere else (e.g. as the inner Qdisc of a TBF Qdisc) [5/6]: Prepare for [6/6], do not reuse that for-loop in qdisc_graft() for ingress and clsact Qdiscs [6/6]: Fix use-after-free [a] in mini_qdisc_pair_swap() [a] https://syzkaller.appspot.com/bug?extid=b53a9c0d1ea4ad62da8b Thanks, Peilin Ye (6): net/sched: sch_ingress: Only create under TC_H_INGRESS net/sched: sch_clsact: Only create under TC_H_CLSACT net/sched: Reserve TC_H_INGRESS (TC_H_CLSACT) for ingress (clsact) Qdiscs net/sched: Prohibit regrafting ingress or clsact Qdiscs net/sched: Refactor qdisc_graft() for ingress and clsact Qdiscs net/sched: qdisc_destroy() old ingress and clsact Qdiscs before grafting include/net/sch_generic.h | 8 +++++ net/sched/sch_api.c | 68 ++++++++++++++++++++++++++++----------- net/sched/sch_generic.c | 14 ++++++-- net/sched/sch_ingress.c | 16 +++++++-- 4 files changed, 83 insertions(+), 23 deletions(-) -- 2.20.1