From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.179 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796125973; b=VLv7oQyj0TpYHNJARQU2RGfpdKTTs44LlsnN30kAB5PUxVBHKSL5+NWwP19XFAkVlOB2 kf0tcnMbnVhiymIK3wDyfurBOWytQ4nWs1I2YsHTmIkaw0RIhceF4KCeUHhXjZPYIzJ+q 47/Goor5IapH8aZ9txoez8a9126ehQ9Vtl0OD1oi09giqS/v7yQqZhV9lFpOajN/Zkkda x0H0alN3NKKqZjVRgVop8FApgspDmaRIRBPPZavK0mBQ5EVigB517ClOgvspAXcU6yGzR ubOWDhLwSz7Xph8xzNRmjFumXsHABSlmgyiG1gqsoib1fFRg3XwIlEH0rkhLzuzpzkw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796125973; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=Je7fSDZI6vcphad2LPLcjLauc1m88KTZVAPbNja423Y=; b=yd90ocTuY0Ac8vvtlAKnY2lGGx02C2v99Fabl87rJms+0byHp8nwWToQXQYAi5HtEiL+ eQrUGhtCUZ57DgV3FIlGGVlqVUgrNyq8HJkUGgMXCaa2nzITNbWz1pg1JRhIfE/BUJAHt +yuXsZXWMGJkSILRS922QbAg4QfM3jPTSIWZQn77gdX4k15TQoPbzAnhC1xNsm9nDIymp C3H4rqA51W6xjVbJuXp5WIYvIGgl/2hOAF0mYbUtHThiVivovabmhgni8uNauEhC/lcov 0TmYNEnV/vRzAJJMHjGxTmioV44cA1HQCdgtDLeyPd5NhOA4L7Ar4HJwPYsXprjGkNA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=inR7fUIU; arc=none smtp.remote-ip=209.85.214.179 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 839DC606A320 for ; Tue, 1 Dec 2026 11:52:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 839DC606A320 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.a=rsa-sha256 header.s=20260707 header.b=inR7fUIU Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-2f0d23553b1so8227935ad.2 for ; Tue, 01 Dec 2026 03:52:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796125973; x=1796730773; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=Je7fSDZI6vcphad2LPLcjLauc1m88KTZVAPbNja423Y=; b=inR7fUIU4KYVuruBCKeQqxiAYkKfog59J7xZqzSPhEryGNiXuObIo/HvYMnPjh4ufL y9jdiEJ+A2VzbivtOwxYsflkKwXfwwgqO0GdCrlav9IUO0LHdXk+HD2VBUBP8Tn9Fcna I0GQnyqQ494ENGohyUpFLIYMl36PRUNSS+nt/Kmtk7Vi/1WFid8yDSJepxCdgZP3pGvP y9g2p8MxUoEPWDl0e2BH0zqi9MKQ2i/wJ/7V0vpjsYBiQrYqZDsCmWJ19MIM2MNR6kzQ Qh6xaAZPghlw9VMSrQ/KGvVnaGAyYnrm7CyVaAAINOeXOvOs/I/5jCy1MrvU1iKnx9Yz 34DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796125973; x=1796730773; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Je7fSDZI6vcphad2LPLcjLauc1m88KTZVAPbNja423Y=; b=ThvBuaAfkWv9iBfJE8o6OwNmGmcr3dd6myQWqL9WM4bMyr9sAKV8BTumR0J3MOx1GE JYMw+7cv03xSHpjeu4TrayCFEv2d/WcuGZzoT7kbkfI752d1famdaGGgaCAdo7ffy7xf qIfQpj3DDrSoDaHYLj7Aj9ezq2KVCycslyv+bcN3hxX+t8G++fTwVPwF8kEv8mG1DEWh GGpWMX8tmcEltphJlfhMYdFRCGUau60f8F4YEomLIMk4/F+iaIfPWg3n1jyE3pkygNnx jV6mi1n6J/R6Gh1Yu+fLe7J3enpx1rQKwGyl3RAjMqxsjet2YChLRV9EvraqGOm2gJXm OlcQ== X-Forwarded-Encrypted: i=1; AL+hErHUE52qad4JJlbb8nb1fPqfuALykuEPbbkNG8L0uswyGHqaCMHsQgZNlJD39IvMu0FzCstCT/XjIFfGDz0=@vger.kernel.org X-Gm-Message-State: APuU4Z//h5lHOSS3dsuGjErH0wPm2f8pxTAgMTHHb+Q+6vQZTNWdRMhl qtOcFuwmF44q0Q1tMJ2aKNu6e5OwI9h8ON4Uii5vnb6dL22N+VIFCkch X-Gm-Gg: AZFdTZcli21mpff/Y++ipZYRGsEYdQ9M8AQCazgvxKktbHli1rNQCnFNiBNBTinPT5y aa2TGQQZGtdRSFVUZA39h21WB3eXwX8kbqds5eSpdHB8A2rnXThzvVx4s4zrFHsoZaVSH5KAPx1 HdUkRp3bJdiq5J+vldYwNBfw1dukYdA8YkDGecuBRYGYzgvMpnDPuUpfXrett9Z7a1yyFNkybzs kE8qW2aG6/m3mwNYr5DiQxSujH3W4oyp7GVymzN9t4crXDBidi6lcNLTSnr+WL+kXiGHawfCn2o JlZbhQWDyFCWqD2LS0sU3RncOgiicsnWV/dlWB+dW+IsNAQDg2ZBSWhUmCFLHCE9zS2S7ec3qPQ LX27SOw7xZpw+Dk1/x/7MUfLPKUKyguVSr2mdBcykgwxsjYq4aBz11Z1EOAM59tS7uANTznA0y8 98kZHVHptxkaLTWKZxUiRSkJS8gZftSo4xYwfVG2gRR75lZk28QU70Q7BIiyJLS0bAia/Dq9H3m ZPH3/qKi39e5GVTt5sCOQRB7masmB0U33k2ecd+NMjrxhV0w80U/5LEMKn28c53PGpCYZty/o4R lw0hNkK9WCE+R5YhIa1XcuzeTu2kFmy7s4pL+hgtEeF2pyFAog== X-Received: by 2002:a05:6a20:9f08:b0:3ef:2f72:c7e5 with SMTP id adf61e73a8af0-4014ae6fe31mr61947940637.2.1796125972510; Tue, 01 Dec 2026 03:52:52 -0800 (PST) Received: from security.datascience.hku.hk ([175.159.181.20]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8c87343f83dsm19771877b3a.39.2026.12.01.03.52.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 03:52:51 -0800 (PST) From: Yu Junzhe To: David Ahern , Ido Schimmel Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BUG] ipv4: unregister_netdevice hang after flushing a DVMRP tunnel vif Date: Tue, 1 Dec 2026 11:52:48 +0000 Message-ID: <20261201115248.289-1-junzheyu1@gmail.com> X-Mailer: git-send-email 2.43.0 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hello, I am reporting a netdevice refcount hang in IPv4 multicast routing. MRT_ADD_VIF with VIFF_TUNNEL creates a dvmrp IPIP device. MRT_FLUSH with MRT_FLUSH_VIFS_STATIC removes that vif and unregisters the device, and the unregister wait never finishes. The kernel prints: unregister_netdevice: waiting for dvmrp3 to become free. Usage count = 2 netdev_wait_allrefs_any() returns only when the count is 1, so one reference is still held. This needs CAP_NET_ADMIN (root in a new network namespace, no user namespace). I do not claim privilege escalation. The result is a local hang inside the flush setsockopt. Summary ======= On Linux 7.3.0-rc4 (93f51579e, tag v7.3-rc4), net/ipv4/ipmr.c: ipmr_new_tunnel() issues SIOCADDTUNNEL on tunl0, names the device dvmrp, opens it, then dev_hold() and dev_set_allmulti(+1). The reproducer does not call MRT_INIT. CAP_NET_ADMIN is enough for MRT_ADD_VIF, and the socket is not the mroute socket, so the vif is VIFF_STATIC. MRT_FLUSH (value MRT_FLUSH_VIFS_STATIC) calls mroute_clean_tables() with a kill list. vif_delete() clears v->dev, dev_set_allmulti(-1), queues the device with unregister_netdevice_queue() because it is VIFF_TUNNEL, and then netdev_put(). unregister_netdevice_many() runs after that. The wait is in the later netdev_run_todo() path. So the ipmr hold is dropped before the wait. A stuck count of 2 is some other reference that is still alive when the wait starts. I have not pinned which one. The program also does one sendmsg on a still-open AF_INET6 raw socket between the add and the flush. That socket is open for the whole wait. I am not claiming that dst is the leftover hold. MRT_DEL_VIF is a different order: a NULL kill list makes unregister_netdevice_queue() wait inside vif_delete() before netdev_put(). This program uses MRT_FLUSH. Guest log from the minimized program (2026-11-18): [ 47.264753] dvmrp3: entered allmulticast mode [ 47.265016] dvmrp3: left allmulticast mode [ 57.280310] unregister_netdevice: waiting for dvmrp3 to become free. Usage count = 2 The ten second gap is netdev_unregister_timeout_secs. A packaged QEMU guest on 7.3.0-rc4 (93f51579e) running the minimized program with syz-execprog reproduces the same wait line. Config: CONFIG_IP_MROUTE=y, CONFIG_NET_IPIP=y, CONFIG_IP_PIMSM_V1=y, CONFIG_IP_PIMSM_V2=y. CONFIG_IP_MROUTE_MULTIPLE_TABLES is not set. CONFIG_NET_DEV_REFCNT_TRACKER is not set. Reproducer ========== Syzkaller program, sandbox none, one thread. unshare flags are CLONE_NEWNET|CLONE_NEWPID|CLONE_NEWIPC|CLONE_NEWNS|CLONE_FILES. unshare(0x68020400) r0 = socket$igmp(0x2, 0x3, 0x2) setsockopt$MRT_ADD_VIF(r0, 0x0, 0xca, &(0x7f00000002c0)={0x3, 0x1, 0x9, 0x7, @vifc_lcl_addr=@broadcast, @dev={0xac, 0x14, 0x14, 0x1d}}, 0x10) r1 = socket$inet6(0xa, 0x3, 0xff) setsockopt$SO_TIMESTAMPING(r1, 0x1, 0x25, &(0x7f00000004c0)=0x6700, 0x4) sendmsg(r1, &(0x7f0000000000)={&(0x7f0000000040)=@nl=@unspec={0x0, 0xff00, 0x0, 0x80fe}, 0x80, &(0x7f0000000140)=[{&(0x7f00000001c0)="b1b55feb45ef2b41bab2f4e24c5941c38be94acafd45f150ff54a2fd9aaefb5379116f0bf38357e8", 0x28}], 0x1}, 0x4048844) setsockopt$MRT_FLUSH(r0, 0x0, 0xd4, &(0x7f0000000000)=0x8, 0x4) MRT_ADD_VIF is optname 0xca (202). The vifctl is vifi 3, flags VIFF_TUNNEL (1), local 255.255.255.255, remote 172.20.20.29, so the device is dvmrp3. MRT_FLUSH is optname 0xd4 (212) with value 8 (MRT_FLUSH_VIFS_STATIC). The hang starts inside the flush setsockopt, not at process exit. Thanks, Yu Junzhe