From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA498332EBB for ; Tue, 3 Mar 2026 09:43:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772530992; cv=none; b=oTcEVmcwcW18uDzVlLcEAmLxvOiqQDVXLf4kT+hb33wpRJffXMiaQQToUVS2ToV6OS3edxkaV1UTdfAnbU5duPDtS5/WFu1rgsG4XSO8A757vlrBw7dJt1eyP+7Gda5r3qP/AxPAejIKIrhaXzxGVGYQvjlo3nRrtpbdkFEpobM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772530992; c=relaxed/simple; bh=+Ls+70EODi+1G0THgyYCXhR2Z7n4Ltp2CPCQLxSWUTk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FULQy/j8PccJtD+/4qNcnwKCxiKpWHD8PvfO/jahSbcHh7x2bVlnkxGTP7JW4krQkEeDNUN9t1O5tdVwhnnfWao66DlFVT5uuUC8BQlxBq8k2Atx/4q5CNd1XRXHQ5Akiqxy86pHFyno4gUXVZ74BQ5Mzm+7VAqENzVFQbrEVMk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SdWD26Aa; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SdWD26Aa" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2ab39b111b9so26134255ad.1 for ; Tue, 03 Mar 2026 01:43:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772530991; x=1773135791; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=fAG/yCp5zU1Q+E1ywZBao8oWa/l/DBt64PVYUKwkwbw=; b=SdWD26Aajp7HNW76ZK5EJyo8tMF2PzNHFuSSRX64k/gAWuwxWZlbIXfPGkqmsxCcp2 gVpJ38327yY8ngVwDYlhxQQFe4yv8BlnsleAxkY7psKRsNYb1z52ybBr/GCM/cYgCldR 6LwabdaQngf912hjg+q2InXAuqKGlrM4ZqvrZm3RL4cejxXhFy9mO6tZhMAyGapzWtjM HP+P9JlryR8Dg2aMvYvZRzdy+iuOgml4sGRt4TRwA/GBWCLJtHIEseyg86q8jdTcWIs4 fwANlHpEje9AaaTQXFaFFHVUJvYaEecH+zZy2Nt87I6NQ4se0ElPHlffh9Lkjq+4Bp2o LHVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772530991; x=1773135791; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fAG/yCp5zU1Q+E1ywZBao8oWa/l/DBt64PVYUKwkwbw=; b=mLXDHW+gdRejhj0U7uwaYzEQD0arXBE71oxDfyOcnsBDJl6N0Mxoz41tMSJcJ4+EQb MHgdaYdtyX8zOBLSNvOK7/SR8dDAmD1ZCocf3o2plZxEub8HA04B9GSNjROFmJlvNFVZ HzB6mQo1Y492+L/htYpGtKZiyqglb5zKCKbQH4aCQV+7AbNBe8pDZVm+hLUwsBXjY6dU WsZf9rCmJ2qK9+pQkd3J/k9SipQ1XlvPOg+DV4mHsKBXAX5dWYdYiqnY0deG9fBn44FW cW/VXvnY3j0qSewovM4PR9vKfMGdgN2xChNyRLliQskUj1fbBHKbWd33+fvwECPH2Ix+ KNDw== X-Forwarded-Encrypted: i=1; AJvYcCV1V8tSSubVTw7lAuI6y8df/PrXXwN39QDmrK0rM3s47g2aUbwmGAou6mB7HIiTQX3/uLAnf2wkMXlq+wQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwBvZUgObpx5FaH+RlnH1AoQqCC5cI4O74RBvYY84Uew0J3wAcG 8mxbg0xkagGbxkKuA9YCFLzXw9B5vmyDY5RzVIVD8BsdH4rfEihJTNAc X-Gm-Gg: ATEYQzxk15/NikmAOPOP47g/ekNkf8Y8FwvEY/B59p7t3t2O692ZWo+7w+FT5BK31SQ v1MQsOX9U0za3N6FM/a+N3SOJchxOgNBZp5V7+t3jVfqkhQySWiXeCXhjJe+Da+gZMRsrvb2cH1 vpURckIGwKNq6P2rLovVyEIWyb+j/P6+wqZ2Lw2Ho6vH1WJpGwMBB7kzxXLYLo17FlBvfh0/qZz 9M0q+kudZN3FupxM2MIALUUg9KK003pxnpiFs5OE9e2zQJKF+VAr2oYvsX9jDcfgILazW5XfztL LSDt9DefxfjriJwab4K+U2iJusSrQM3TH0+VR1R4wCMlIgo82Pm72bWxNfEOkTPijs+Wts3YFj2 Qi8Z3slA8RGKITZQjSqKcM1As1yUopqFawY7ZZ2Bk2upBIHXbwYONBfvaesPDW3JQv9RGeIgZr+ 91rE9mGzmMqtPOU7LrryggizYL5uZ+ONCnI7+jKqOHB2uXaNinmD6PUgg0epc= X-Received: by 2002:a17:902:ef4e:b0:2ae:3ab7:1545 with SMTP id d9443c01a7336-2ae3ab716c3mr100913675ad.43.1772530991099; Tue, 03 Mar 2026 01:43:11 -0800 (PST) Received: from SLSGDTSWING002 ([129.126.109.177]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2adfb69f283sm163382885ad.49.2026.03.03.01.43.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Mar 2026 01:43:10 -0800 (PST) Date: Tue, 3 Mar 2026 17:43:06 +0800 From: Weiming Shi To: Eric Dumazet Cc: security@kernel.org, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, xmei5@asu.edu Subject: Re: [PATCH net] net/core: add xmit recursion limit to qdisc transmit path Message-ID: References: <20260303022947.3061602-2-bestswngs@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On 26-03-03 05:30, Eric Dumazet wrote: > On Tue, Mar 3, 2026 at 3:37 AM wrote: > > > > From: Weiming Shi > > > > __dev_queue_xmit() has two transmit code paths depending on whether the > > device has a qdisc attached: > > > > 1. Qdisc path (q->enqueue): calls __dev_xmit_skb() > > 2. No-qdisc path: calls dev_hard_start_xmit() directly > > > > Commit 745e20f1b626 ("net: add a recursion limit in xmit path") added > > recursion protection to the no-qdisc path via dev_xmit_recursion() > > check and dev_xmit_recursion_inc()/dec() tracking. However, the qdisc > > path performs no recursion depth checking at all. > > > > This allows unbounded recursion through qdisc-attached devices. For > > example, a bond interface in broadcast mode with gretap slaves whose > > remote endpoints route back through the bond creates an infinite > > transmit loop that exhausts the kernel stack: > > Non lltx drivers would deadlock in HARD_TX_LOCK(). > > I would prefer we try to fix this issue at configuration time instead > of adding yet another expensive operations in the fast path. > > Can you provide a test ? > > Thanks. Thanks for the review. I have two follow-up questions: 1. For the configuration-time approach: the loop in this case is formed through the routing layer (gretap remote endpoint routes back through the bond), not through direct upper/lower device links. Since routes can change dynamically after enslave, would this require adding checks in all of bond_enslave(), route change, and address change paths to be complete? I want to make sure I understand the scope before going down that path. 2. As an alternative, would it be acceptable to move the recursion check into the bonding driver itself (e.g., bond_start_xmit() or bond_xmit_broadcast())? This would avoid touching the generic fast path entirely, and since bond is LLTX, there is no HARD_TX_LOCK() deadlock concern. It would narrowly target the driver that causes the fan-out recursion. Happy to respin in either direction, or explore other approaches you have in mind.