From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yx1-f42.google.com (mail-yx1-f42.google.com [74.125.224.42]) (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 394DB37F75A for ; Mon, 30 Mar 2026 02:29:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774837776; cv=none; b=mYZsZ3kwz2eOwtE1tYbpADLPTxhZI1IsmGAYcwqy2iQlaUkIQZaC948u8+HcHbNJyCE93aeY5F1xKRVaAIbGh7qmvIOvdAbM991DXTjEcykkoHJHvtciD0i0tImbYnyTwP3OE1BinLUBtaDGY4WS5eLWIBt9S8uexPKPHu0dAMs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774837776; c=relaxed/simple; bh=q+XVYlFLxCAzomJfQtNjsLarOjG6MU1Go2EMdXhpJq0=; h=Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject: Mime-Version:Content-Type; b=IgLdVeA3z/dKRn/ArNZ2AMJ9hSiSx9ETx/fFIM3nIH5XVX2c7NvD7oO3t2nYbQO83IErbpzmuZKJ0sk7QqDsD4R3b2izSCHEYLx5CCjNCWmPrLfbq739eciwI1vSYFvPAkZqs1v80L8fM8R+cTcYREuOqtwdrGcozqhmdTZ6anY= 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=E6BSmCaE; arc=none smtp.client-ip=74.125.224.42 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="E6BSmCaE" Received: by mail-yx1-f42.google.com with SMTP id 956f58d0204a3-64eaf8aa893so4566494d50.3 for ; Sun, 29 Mar 2026 19:29:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774837774; x=1775442574; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=q+XVYlFLxCAzomJfQtNjsLarOjG6MU1Go2EMdXhpJq0=; b=E6BSmCaE6Ly6XM2TQ7PfZ2KjhVdIFYFQmCIOR2GwyQDV0xiUo1gljhEEeTnYNHgt1I nA4Xg+OvwtFDVv7JROq4vKYzjDwI66gBOrMTtE7f24m/2ZARDZDiSxVHC0kfrO8s0zFF OewjpJFtprGIShnB5thiASBs1T0XmzJ2hiJtxqtfsW79pqvBJ2FcHXuVKH8EaUT3POL1 NkmCefCp1qkN9qdhH9mpygkPp1e/ZDoTgFghSOHOqbXTeJYkmZo/xeXKzuLNq+4iySnx XsUrdegthsPzb6nfcoMhvbCy9NyCrovLHRuVexhlQzqd+GnTAk9T8eNNqNIM+4R5FyBs KigQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774837774; x=1775442574; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=q+XVYlFLxCAzomJfQtNjsLarOjG6MU1Go2EMdXhpJq0=; b=bPOynoe4B3PELnDfuOACpJ2vts0uRVlPkYIFi/arsCa1zNFV8cmxHCPUa94xqBzlNI qzRKsnCUhA+HMLZd9cOUBULJdIZcxJfzoqsH2CbsaHlsgtTh8SVv6iZxqATiU8MQIQ7o QkFO4/xZW507b9J8RXVEr4qGpCp0sHSxNoLLJaQJatdxkfgLvJLw23A9bLMDGiQC2Y0u RHdqajTPGuegxcR3zKNQUGmz36GL/C+gbuF+JQswfvWz1xUL2foCJZNfezL3rDp3eMGp RCVi075IT9+exB+vIlzb8gnHZvZRv8Tf+B0IFdIg21k2T0FYChxMzJcR+r5/Owfkri0Z cu6w== X-Forwarded-Encrypted: i=1; AJvYcCU4xoWzBfrelGYuo4PMDp4WoFlzJlYFylxYSnj32NQkJXZVqlSPoeVHyv+TvU6ifoaGE9R0mMQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yy2CITwWBRWENiHIh++fFwNLu6tsm00n5EPDEjU7qoCFEy89zbi xX0fxbMu2lobjBLHXs+MVbW9QI9FdOEp4eFNo5/qOSVMcCZeCg7U9kOl X-Gm-Gg: ATEYQzw/XBty+QJoYBNv/721hNhkPlfEjA8a+P4HEVu9huBjRV1VY/WA5WHX+EQX50v /iM9iLfvl5lXMCgnGzR4oe8j7BgwSrr6zKuKd+FxX86XXMCAS/p/SIyW6auC7nc5aYEIMI4I4DW YUVAoSCZ8EUZlE9DtakYB6P75qSnTko9v9dFILyVFim45L3PP0TflKaX032PtD3HLsuRBhTG99N IAnL0sADNWTaPn1WlpyMfkBINHBeeQMPd1QMUKK08UGSodokY1OSzEVlT2K98JUD3yr/si6h99R 7g2XHxIPTt/HBNFMbn0JUHzKKWkfetVEkTuKlup7armP39U8XHA2qhJkrpyMgv0yPmW9Wx5ugJU epMW5AEvG6lFNz8SpOUWdME4O1mSTjJ+6dOv7c21nRdKrYm5XL0DKjTEZU+xcZqO91Hp/kNwT6X WYOyx+sBZlrsId+wyg/TZZtKxWJKOKezUseFGAwOgkAajAAaJz2PzU2eT/xZvjT5Ir7VoqdCjPJ 54F X-Received: by 2002:a53:d005:0:b0:650:1bc2:7e18 with SMTP id 956f58d0204a3-6501bc286femr1961791d50.1.1774837774124; Sun, 29 Mar 2026 19:29:34 -0700 (PDT) Received: from gmail.com (180.134.85.34.bc.googleusercontent.com. [34.85.134.180]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-6500934c235sm3278408d50.17.2026.03.29.19.29.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Mar 2026 19:29:32 -0700 (PDT) Date: Sun, 29 Mar 2026 22:29:32 -0400 From: Willem de Bruijn To: Eric Dumazet , Willem de Bruijn Cc: Kuniyuki Iwashima , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Jason Wang , Andrew Lunn , Simon Horman , Kuniyuki Iwashima , netdev@vger.kernel.org Message-ID: In-Reply-To: References: <20260327213441.3781433-1-kuniyu@google.com> Subject: Re: [PATCH v1 net-next] tun: Ignore tun in netdev_lock_pos(). Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eric Dumazet wrote: > On Fri, Mar 27, 2026 at 4:16=E2=80=AFPM Willem de Bruijn > wrote: > > > > Kuniyuki Iwashima wrote: > > > On Fri, Mar 27, 2026 at 2:48=E2=80=AFPM Eric Dumazet wrote: > > > > > > > > On Fri, Mar 27, 2026 at 2:34=E2=80=AFPM Kuniyuki Iwashima wrote: > > > > > > > > > > dev->type could be any value on tun due to TUNSETLINK. > > > > > > > > > > Let's not warn about it in netdev_lock_pos(). > > > > > > > > > > Signed-off-by: Kuniyuki Iwashima > > > > > > > > Hmmm... should we instead have a list of supported types ? > > > > > > > > And reject user space requests for unsupported ones ? > > > > > > I chose a safer way but maybe we could reuse tun_get_addr_len() > > > and define the default case there as unsupported ? > > > > > > I guess it's okay even if it breaks userspace because we can > > > just add a single line to restore the support. > > > > We shouldn't risk breaking userspace, over such a sanity check. > = > The thing is : this check makes sure that each type has a different > lockdep class. > = > > > > Presumably any truly newly added type will have a non-zero addr_len. > > While tun sets this to zero for weird inputs. Maybe just filter on > > that in the WARN_ONCE? > = > Then we might hit some lockdep issues... Warnings due to stacked devices wouldn't apply to tun. Can this be used to set up (false positive) lock inversion deadline reports? = > Perhaps use lockdep_register_key() on each tun device... In tun_set_iff replace the xmit_lockdep_class previously set by netdev_init_one_queue? If keeping the approach from v1, perhaps a tun device can already be identified in core code without having to export tun_link_ops. >From the init in tun_set_iff, dev->sysfs_groups[0] will have an attr "tun_flags". There might be something more elegant. Just the first I spotted.