Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp419796lqb; Fri, 24 May 2024 02:27:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVQ/bgaGN59WGHiIF91Wp6TnXq2VgBh1MwNrCXJfxH54n1sNfH31dL1MFexT+G+AGZCBx5yi7gCg9K1qzIxEZl/UObJFIMJB4HJy9j36Q== X-Google-Smtp-Source: AGHT+IEEEkqgCd9ns/XBqXW2ArPbg1sv6Ppn68owogqUlMcO3ev6zIcK3Yy0omyHESQv+s9zR4xE X-Received: by 2002:a17:90a:de85:b0:2bd:b302:95d9 with SMTP id 98e67ed59e1d1-2bf5ba1d241mr2449654a91.0.1716542845092; Fri, 24 May 2024 02:27:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716542845; cv=pass; d=google.com; s=arc-20160816; b=Zvq2wZstLn5wwpcql2H5h80pvFv+yPD6MECRPhccTmrMvz/XlZ8ND7ca5IaOI4yY78 431iCO8Jfcp6+5w/435Vbp9ZxwU0cp2vx23Gt8DC/sDD92TRH/4GoUVs/WPLeEL9yCTe 9p88IHfmNqucDAGlft/cRB+vMFqzK/5VgAfPloiOdV0M79Wp9kAKsfX1RQVKvM9uJzhY WR1IFhGdAXoU0XTWcjOQaJaelez/zpMB/o4VbcT30RoNMfi3wLNT41oRBFZc+gTb9C+g Ky2ih5g0sCClBzfh7o0RgAbrSN6YqpOYt/ZwBCRbOLwMIBvJC5UaqyAIRL/Xf37PP13m DWAA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=RcUH2z2PC+NQ15Eh+gwURIN/8l+aK9P+KajNxI/S8X0=; fh=6RCGqOlDjoJ4qoIl6t8jpr3/SjuWjFWpALFvoB04fM8=; b=MnTz0g1+6oUdcEtSplItRIcAEhN2WXmBCsr1tYoCbWeK9kksMGH29PHXLANr+d8va1 uFPeXn2ldBDm3nloy7GeeEU4NSGoBZ9NBtmUNcPiMaILCuzMSUtU/DFk3KPXi7Y7Izic I6M9VNcZwTT0q5dbB3Y48BJAwMBfq8kmpCgseo/4qabxCtNB2doIWAUc+xrbOBnHm0DW U6QjpzW5DxLJBgVBW5yogRHTDyCkWHDksx9DPCgzcLa8HMPDZ01/gvF127Oi9gQ+NXPt UemL+MuSHgopNe6BEE2T9yY2eocDDR6636q9Js+WJwh7pHXZiPYjCg4TEp1MJgVMV499 Z2hQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="Lu/od2me"; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-188549-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188549-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bf5f9d147asi1132613a91.3.2024.05.24.02.27.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 02:27:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188549-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="Lu/od2me"; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-188549-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188549-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id F36A4B21B15 for ; Fri, 24 May 2024 09:24:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D47C84FCF; Fri, 24 May 2024 09:24:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Lu/od2me" Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 E9A1283CDB for ; Fri, 24 May 2024 09:24:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542687; cv=none; b=XSxFs14txbHdYKP7k7AObLpDKHaler12bLqVjgti/pyXnwWn3szQipqBRpPy8v5tf4y8CAnvWnnNFrG0Z484eSRwe4fm77v50oIhtIE+Q7V9J2xPkqN+q2v/bzxPoGOIPsfFMeE+x6Xd9LM8LKBMo4/Qb22eSEW+ZAc8A792+Zw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716542687; c=relaxed/simple; bh=RHA0z0dfkvAfluwpOn268HbNDfmbyWnG2bMGSeAS360=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=LkkAhfXVaZhp2ubiu6nWG3atwLfwrJcQKDoWNfeIk7RTeVyNpZJVT+9AX2GuaZbTCM++zyB/jhi7HPc0Kz7LFhWirdiGnOJQmEPCzMNJjgxo0ULQybnPqpjbQTfRGMk/oFuv+ykb4vnk6pIRqpqlO6QcKiAbqQXmWFOGrlKHqQ8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Lu/od2me; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-41ff3a5af40so44915e9.1 for ; Fri, 24 May 2024 02:24:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1716542684; x=1717147484; 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=RcUH2z2PC+NQ15Eh+gwURIN/8l+aK9P+KajNxI/S8X0=; b=Lu/od2me3mMOuIetOg+W9pAdRGnl3hV0VYA5jxPDjpb4Eg/zf6c3nCb4weVhc1bzzM P1/SOJQlfxbImNPCi+oLlt2/qJTTSqlxtU0NXJhqzG5IJy0pB+v4KtRKrRUULOm6pWX1 eA7FWw5e0pyC/KH4vQtwTEPq9tGED4GU5nIFlBlpGK/QJj6lLM02DtJGnOXpMbPgHYhm V5ZWLgUd/M0TExtNMGzi4fjmLWjSSFqWohIsjI8CN8iPl7yJtiszEcm/r+uAIqlFv4US 2jQ72u0JXW5zlti8ktk0fX/mf3UlIeqkUKKf58+baZfzCNKptbU8x13ANYn6oWr+Oc0H 5jJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716542684; x=1717147484; 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=RcUH2z2PC+NQ15Eh+gwURIN/8l+aK9P+KajNxI/S8X0=; b=M67T2yD/WGUCJpxz0GtStxs1dAOkuK6d0WLxIgfXzTOVD41NWq92uYwC04pUBrAprl igztPVkzfzouZgufpLOfwHUkZu/Eqqflqif+PYg5e0JCtgRwk8zwC/W9y5q8QKV0GcTn hRoEdvprVbnDHglnZX0ytLPkeZ3mazetOUtmjOI7WSeZFmj+AyMog20r0Nl6Nv07YsCw KiEDJ8T0N3lLn8MHHC4KZQpGzC4+C6Yr8NuU4YEmDZ7H2+POLgosyL5BRQWiEiIjBYBv B7Y2rbbpamJ5/1VHH36phFe4QnQlD8b5zE/Cf96wtfDtOInP1Xc+BO9GzmW36LvUMuTu kyTA== X-Forwarded-Encrypted: i=1; AJvYcCVzzY9tFJQlmqZNomV0OZhuAC/EimSQZ/OmRhT3CzDiH6WtSyUoZ2wyJUraD1BODphuoDFlr0+DLILJCk0eqG9y0fkbw8n4/ynZdrj0 X-Gm-Message-State: AOJu0Yw1+KN95F7ZuRaZMQzovm1fWmXhlVfK6c18Xwr9fFapErCNinEk LBuhRInOY4w/3ZgoFR4QhiD8q4xA6qh01ErBUraHxsPTRAVgIHl8A7pFtqT2Anm//1AwNP91rpV rhTwUk343hoDsWZIApEw+TO1rX5uq50VRQXv3 X-Received: by 2002:a05:600c:5028:b0:41b:e55c:8dca with SMTP id 5b1f17b1804b1-42108dd0dffmr1055615e9.7.1716542683868; Fri, 24 May 2024 02:24:43 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240524085108.1430317-1-yuehaibing@huawei.com> In-Reply-To: <20240524085108.1430317-1-yuehaibing@huawei.com> From: Eric Dumazet Date: Fri, 24 May 2024 11:24:30 +0200 Message-ID: Subject: Re: [PATCH net] net/sched: Add xmit_recursion level in sch_direct_xmit() To: Yue Haibing Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, hannes@stressinduktion.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, May 24, 2024 at 10:49=E2=80=AFAM Yue Haibing wrote: > > packet from PF_PACKET socket ontop of an IPv6-backed ipvlan device will h= it > WARN_ON_ONCE() in sk_mc_loop() through sch_direct_xmit() path while ipvla= n > device has qdisc queue. > > WARNING: CPU: 2 PID: 0 at net/core/sock.c:775 sk_mc_loop+0x2d/0x70 > Modules linked in: sch_netem ipvlan rfkill cirrus drm_shmem_helper sg drm= _kms_helper > CPU: 2 PID: 0 Comm: swapper/2 Kdump: loaded Not tainted 6.9.0+ #279 > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/0= 1/2014 > RIP: 0010:sk_mc_loop+0x2d/0x70 > Code: fa 0f 1f 44 00 00 65 0f b7 15 f7 96 a3 4f 31 c0 66 85 d2 75 26 48 8= 5 ff 74 1c > RSP: 0018:ffffa9584015cd78 EFLAGS: 00010212 > RAX: 0000000000000011 RBX: ffff91e585793e00 RCX: 0000000002c6a001 > RDX: 0000000000000000 RSI: 0000000000000040 RDI: ffff91e589c0f000 > RBP: ffff91e5855bd100 R08: 0000000000000000 R09: 3d00545216f43d00 > R10: ffff91e584fdcc50 R11: 00000060dd8616f4 R12: ffff91e58132d000 > R13: ffff91e584fdcc68 R14: ffff91e5869ce800 R15: ffff91e589c0f000 > FS: 0000000000000000(0000) GS:ffff91e898100000(0000) knlGS:0000000000000= 000 > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > CR2: 00007f788f7c44c0 CR3: 0000000008e1a000 CR4: 00000000000006f0 > DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 > DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 > Call Trace: > > ? __warn+0x83/0x130 > ? sk_mc_loop+0x2d/0x70 > ? report_bug+0x18e/0x1a0 > ? handle_bug+0x3c/0x70 > ? exc_invalid_op+0x18/0x70 > ? asm_exc_invalid_op+0x1a/0x20 > ? sk_mc_loop+0x2d/0x70 > ip6_finish_output2+0x31e/0x590 > ? nf_hook_slow+0x43/0xf0 > ip6_finish_output+0x1f8/0x320 > ? __pfx_ip6_finish_output+0x10/0x10 > ipvlan_xmit_mode_l3+0x22a/0x2a0 [ipvlan] > ipvlan_start_xmit+0x17/0x50 [ipvlan] > dev_hard_start_xmit+0x8c/0x1d0 > sch_direct_xmit+0xa2/0x390 > __qdisc_run+0x66/0xd0 > net_tx_action+0x1ca/0x270 > handle_softirqs+0xd6/0x2b0 > __irq_exit_rcu+0x9b/0xc0 > sysvec_apic_timer_interrupt+0x75/0x90 Please provide full symbols in stack traces. > > > Fixes: f60e5990d9c1 ("ipv6: protect skb->sk accesses from recursive deref= erence inside the stack") > Signed-off-by: Yue Haibing > --- > include/linux/netdevice.h | 17 +++++++++++++++++ > net/core/dev.h | 17 ----------------- > net/sched/sch_generic.c | 8 +++++--- > 3 files changed, 22 insertions(+), 20 deletions(-) This patch seems unrelated to the WARN_ON_ONCE(1) met in sk_mc_loop() If sk_mc_loop() is called with a socket which is not inet, we are in troubl= e. Please fix the root cause instead of trying to shortcut sk_mc_loop() as you= did.