From patchwork Sat May 6 00:09:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peilin Ye X-Patchwork-Id: 8983 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp784076vqo; Fri, 5 May 2023 17:57:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4ytQCRalChzGuHG0gVN7m+ncMquGDiFcecvooMKHAD8R1E8lBGiIRfFHM+U148vvaikPZx X-Received: by 2002:a17:90a:2981:b0:247:6be7:8cc0 with SMTP id h1-20020a17090a298100b002476be78cc0mr3206268pjd.35.1683334651928; Fri, 05 May 2023 17:57:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683334651; cv=none; d=google.com; s=arc-20160816; b=hOjX+JHml5kYGAXZb4YAcbecrjpGLE7aOWhTrW3S95C/da8OA1uo9h3j7iEAe7Lnsy Pa8DN5c1qylu+L3XB9U9bcd7rR5eZVQ6PisiPukuazYovOpY+6+xhjIXs8cHIRk+pJbn yymi4GLgjZtwvDw/AJ9tDJShpAVnHUfYOxFeZSPXcHynJaqE6E0AxxyOPlWU9N7rWzvp 18/fD9dPruPJAHsPzYNMZN7JyP/JaS1H7k3N1x7XN2Q482zqGzvrCjxPnp+ARXiZpoiB /iuLxPS9ZrN50xIVfkd8q/hVw11Szq7FsgTGh8N9ClWEeTOaLt0jmLoNjvHxvo4zRFDZ wipg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Z1tFG7m2xfEcAcR8LZf/choHnP0WMR/Vlxqt/wj5I9k=; b=rB9/wneJjrsRv+mtM+/y6FrTGq3MH24UIdl90KMAMDUqyk4xyARrA2akeEOpv83i7V 0CWXvdMa20K1bEnXn6r623ynykCAectU2VntITl8qZl1zYDPV970gTvcRefr6aSmjQgB 14/UcvhkpM2yPyFxeRgNomVHghKyiwor6XpLircZzprYSV6rUyUPzTj0CBb3yYmL9pD+ c1he9KYvE2Fh6reSEkARI201rCRFCYiBvWynZnzXHfVHCx1XxH8PMeMAiU1QQxoD1hEd OMCwWeHPrHvzNPTdlcwKXnJLQ4+GanEoSqtQ8AwqWBxsFnmcyu6IUwcdJXmeSPFHPbY+ ngUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Y1BAYKAZ; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t5-20020a63b705000000b0051b9d096f3csi3150235pgf.881.2023.05.05.17.57.19; Fri, 05 May 2023 17:57:31 -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=Y1BAYKAZ; 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 S229668AbjEFAKH (ORCPT + 99 others); Fri, 5 May 2023 20:10:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229649AbjEFAKG (ORCPT ); Fri, 5 May 2023 20:10:06 -0400 Received: from mail-yw1-x1132.google.com (mail-yw1-x1132.google.com [IPv6:2607:f8b0:4864:20::1132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08D6B65AB; Fri, 5 May 2023 17:10:05 -0700 (PDT) Received: by mail-yw1-x1132.google.com with SMTP id 00721157ae682-55d2e87048cso35886777b3.1; Fri, 05 May 2023 17:10:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683331804; x=1685923804; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z1tFG7m2xfEcAcR8LZf/choHnP0WMR/Vlxqt/wj5I9k=; b=Y1BAYKAZPrs/r9CdIQJ4lL/ATT93ESaJ8SStXZHLiUp+eEJBc2P5/x3DKuJE7NzV8S kKOkQMinSf9ffc308+ftL8tChQaEUlc3j/Kz1+Z+rLDFdIx67rQfrLbQN+DK6Jw9E/hd DCfG7flWsAAAM94A9upHXkqA1AskeBXV33AZfpZS5v2S57gNP1cSLOOd+9b3wb137WXU a+nDr9lxYBJdrV9Gx2psyMth769F7G1kdwHhVJuRmzemZa1FkTodLXXK1T7jMMeZDana OgdcoWkhFQjyQ7AFMlSty+/XF/W0lgMl++5giQjyzKMddV2DfmitZryrMTxwa45sx2ma QyfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683331804; x=1685923804; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z1tFG7m2xfEcAcR8LZf/choHnP0WMR/Vlxqt/wj5I9k=; b=bq1evU4xMIiqGyud2Uv2Xs6UT+QfmRg0iwsbxD7acMf920NiF9Brev1gdwGnewh4QK cWha4Wzl7ZV1d+dgFBUhKaxO3Oi9Ubvl67F4b+EskG8c5O84yeH+QLB81/Mwb4a/oGT0 W1bge7wPvghVGwJNgQK9apYF5fDOcTPGj4R4gvaSX9e5cFSawHSkGwHc5FrMofU+9HXm EdFL4wvIIZyIqE6Is8Q0G5P2jv7+iUj/2Cn6HiDu/WVIK7qzGKBEDdwq3pGqcxEaW7aj NXquB0FrKB6gV74jYK92aH1l1bsJxNtHJhwUPMYNB9/lg80hCzEO6xPpi1AaJhOElayp J5MQ== X-Gm-Message-State: AC+VfDwh3LLSicJl3PKCcjnVaipyVTBlNYHQFyP2xa6d16EJykxShfBz XNcaHmn038lOytm6+l3o1Q== X-Received: by 2002:a0d:d703:0:b0:55a:8b02:1d8f with SMTP id z3-20020a0dd703000000b0055a8b021d8fmr3411898ywd.49.1683331804016; Fri, 05 May 2023 17:10:04 -0700 (PDT) Received: from C02FL77VMD6R.attlocal.net ([2600:1700:d860:12b0:5c3e:e69d:d939:4053]) by smtp.gmail.com with ESMTPSA id h188-20020a0dc5c5000000b00545c373f7c0sm791849ywd.139.2023.05.05.17.10.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 May 2023 17:10:03 -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 net 0/6] net/sched: Fixes for sch_ingress and sch_clsact Date: Fri, 5 May 2023 17:09:39 -0700 Message-Id: X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20230426233657.GA11249@bytedance> References: <20230426233657.GA11249@bytedance> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765104316262460729?= X-GMAIL-MSGID: =?utf-8?q?1765104316262460729?= Hi all, These are fixes for ingress and clsact Qdiscs: [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() Please review (especially [6/6]), thanks! Other tasks, including: - prohibiting sch_ingress, sch_clsact etc. in default_qdisc - more cleanups for qdisc_graft() Will be done in separate patches. [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 | 54 +++++++++++++++++++++++++++++---------- net/sched/sch_generic.c | 14 +++++++--- net/sched/sch_ingress.c | 10 ++++++-- 4 files changed, 67 insertions(+), 19 deletions(-)