From patchwork Sun Jun 11 03:29:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peilin Ye X-Patchwork-Id: 10595 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1861505vqr; Sat, 10 Jun 2023 21:42:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4xq79Hw/pVxoQrdk/VWGfyEGYdV1QbleWAzl5yeAU4eT9VzV+AaxYZFxQEUBN+1heJQEYc X-Received: by 2002:a17:902:c407:b0:1ac:5717:fd5 with SMTP id k7-20020a170902c40700b001ac57170fd5mr4627116plk.60.1686458553929; Sat, 10 Jun 2023 21:42:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686458553; cv=none; d=google.com; s=arc-20160816; b=TRNIT69ZUmA579ALWn1E+aOEj3IkddKN+nAKglp+gYvfsNR9/wGzCzJpff57LEzrlP OxvNN+78TX8gAuFtd6uIEbvtIDhJtaHStXvHu7eDKNKwq3E3BX7RgASrGH3OL4ttmPc1 8lFhO5g8eDUe/VJYqvVjX3KXBpRDZNt3OFPi7XXtR3+lEfo7Mtsu2pH3k4Fef2QPbQat 7UfYTPb3xeAuZ56OuMYycr5tM6vjOXJps2X360NlU/wxY/wdWe+VPCqU8YO4zwOrzFWc Phzm90+cpkO6lSFwwsitvl1vH5yJYpc+Z3B4uaBbKAYh5a51xIoJwDrIlFNdkQZOhrnT cRSg== 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=rdbwCfJP0fRhUMDyPqmQQA9434sxRWUVYDLaUn3QYpA=; b=RHh38b+fJE8yM5Q6JV2KVJsdPZDsEkEeus8TJr15Ym05GRnTp64eTlLxhRMpl/jnYv jb5fxTJzUj8kh2OjZiDkYPMJLjeQGnfXt7Q5xadp6ewGL5qnK/gIvnwBlbXXnlXSG6E7 JFIvylPUyuNCupQgJ9uhsVbptwv9WTk3yOWbx+3aockUjZ8+zbIXK7/V8pWJBjYdRSDQ z7UA+eIyXLXYPEUlNp2ckUDiSzWdnsJQKqZTE90n2gl/ZAyUw/EeMJSjHKyZ0N2I2g01 3E3r15Fwxdljg67+klUw2MoPMvbBkkRdoOUgrtgTy0j0x1lPbtWUfuuFOxS80ZttATKP m7gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=JdBnK8RW; 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 j14-20020a170903024e00b001ac6e1fd203si1959631plh.180.2023.06.10.21.42.11; Sat, 10 Jun 2023 21:42:33 -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=JdBnK8RW; 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 S231480AbjFKD35 (ORCPT + 99 others); Sat, 10 Jun 2023 23:29:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231387AbjFKD3z (ORCPT ); Sat, 10 Jun 2023 23:29:55 -0400 Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5046B131; Sat, 10 Jun 2023 20:29:54 -0700 (PDT) Received: by mail-qk1-x72d.google.com with SMTP id af79cd13be357-75ec6ae7ffaso245187985a.2; Sat, 10 Jun 2023 20:29:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686454192; x=1689046192; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=rdbwCfJP0fRhUMDyPqmQQA9434sxRWUVYDLaUn3QYpA=; b=JdBnK8RWMwzM9FvTKYnYU+l7dKyIDGgBpEb3IuWMGMH04P2z4usCkiYHF1tMTv5Rqg 9vy4dOVceZKFjtG9CNMhAJdslHedaYg55wn/0C7oEC5bBxAtySJCNJAPaZWSmErOuNpy k8jbqiJKgboR0rrs8csVBBaWte0CXjUGvwXxXG3Ry4AgFYxVWYKsdJ79+ryIHs+L8Gn0 36nVxTtAQ/SCmFV0wyZr9kRFlNj2tNj5N/Z7AD3tpEqnHdoEfJvffT/nZB+fSzOtKVNe uOHpfppr4QEGaoUpZVSq7S4FlSOyYJlMD867EBwuMLhBHOaIZMnEIYR1SjcFEMwwCTfx +X9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686454192; x=1689046192; 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=rdbwCfJP0fRhUMDyPqmQQA9434sxRWUVYDLaUn3QYpA=; b=kGUyZ5YbjyaLx5KBSr9ttbdCziwxZsEbjXtdDr1dZltPk/SUG4ALfO6Axae1Z4YY3C Xq67PJsKrwGv6SgGItO3XawhfrBEliUJ9X2m8EP8tGW/wnFTLOin6xjVqvcTYPQY/y3Y oRAujBRaXX5tTHAV7kAdL/7UMpo0kY/PvAtJQOcC57DOY8IDsB9LZ+DZSt4xP0UMj6j5 X+QNoluDPRaElrV00zZvD98ZBKL+F3X41ud2KAeNOWwBEWglB4s9CbUBpEFm8aKAwcQS pKItXZtczn+oUWQSc7APLYFrROb8qf7u+HSPktHhTRGO1u05TO57w6nwk+a8A3yns/3b qRBg== X-Gm-Message-State: AC+VfDyjFyOw6K71AllXX8lmoO0ZZVW+VzWi0s2OG9hbs6rp1m+a86To drygfhdwWUWS1lZuLP9xxQ== X-Received: by 2002:a05:620a:8c90:b0:75e:ba84:ecca with SMTP id ra16-20020a05620a8c9000b0075eba84eccamr5396290qkn.40.1686454192214; Sat, 10 Jun 2023 20:29:52 -0700 (PDT) Received: from C02FL77VMD6R.bytedance.net ([2600:1700:65a5:6400:a53e:60df:7509:de6]) by smtp.gmail.com with ESMTPSA id c16-20020a05620a135000b0075aff6f835bsm2045161qkl.19.2023.06.10.20.29.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Jun 2023 20:29:51 -0700 (PDT) From: Peilin Ye X-Google-Original-From: Peilin Ye To: Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Peilin Ye , Vlad Buslov , Pedro Tammela , John Fastabend , Daniel Borkmann , Hillf Danton , Zhengchao Shao , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Cong Wang , Peilin Ye Subject: [PATCH net 0/2] net/sched: Fix race conditions in mini_qdisc_pair_swap() Date: Sat, 10 Jun 2023 20:29:41 -0700 Message-Id: X-Mailer: git-send-email 2.30.1 (Apple Git-130) 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 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?1768379965075665021?= X-GMAIL-MSGID: =?utf-8?q?1768379965075665021?= Hi all, These 2 patches fix race conditions for ingress and clsact Qdiscs as reported [1] by syzbot, split out from another [2] series (last 2 patches of it). Per-patch changelog omitted. Patch 1 hasn't been touched since last version; I just included everybody's tag. Patch 2 bases on patch 6 v1 of [2], with comments and commit log slightly changed. We also need rtnl_dereference() to load ->qdisc_sleeping since commit d636fc5dd692 ("net: sched: add rcu annotations around qdisc->qdisc_sleeping"), so I changed that; please take yet another look, thanks! Patch 2 has been tested with the new reproducer Pedro posted [3]. [1] https://syzkaller.appspot.com/bug?extid=b53a9c0d1ea4ad62da8b [2] https://lore.kernel.org/r/cover.1684887977.git.peilin.ye@bytedance.com/ [3] https://lore.kernel.org/r/7879f218-c712-e9cc-57ba-665990f5f4c9@mojatatu.com/ Thanks, Peilin Ye (2): 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 | 44 +++++++++++++++++++++++++++------------ net/sched/sch_generic.c | 14 ++++++++++--- 3 files changed, 50 insertions(+), 16 deletions(-)