The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Joe Damato <joe@dama.to>
To: Maoyi Xie <maoyixie.tju@gmail.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	David Wei <dw@davidwei.uk>, Stanislav Fomichev <sdf@fomichev.me>,
	Dragos Tatulea <dtatulea@nvidia.com>,
	Samiullah Khawaja <skhawaja@google.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH net] netdev-genl: report NAPI thread PID in the caller's pid namespace
Date: Mon, 15 Jun 2026 13:43:18 -0700	[thread overview]
Message-ID: <ajBj5j01YmdS02Uw@devvm20253.cco0.facebook.com> (raw)
In-Reply-To: <20260615171736.1709318-1-maoyixie.tju@gmail.com>

On Tue, Jun 16, 2026 at 01:17:36AM +0800, Maoyi Xie wrote:
> netdev_nl_napi_fill_one() reports the NAPI kthread PID in NETDEV_A_NAPI_PID
> using task_pid_nr(), which returns the PID in the initial pid namespace.
> 
> NETDEV_CMD_NAPI_GET does not have GENL_ADMIN_PERM and the netdev genl family
> is netnsok, so a caller in a child pid namespace can issue it. That caller
> then sees the kthread's global PID, even though the kthread is not visible
> in its pid namespace, where the value should be 0.
> 
> Translate the PID through the caller's pid namespace, the same way commit
> 3799c2570982 ("io_uring/fdinfo: translate SqThread PID through caller's
> pid_ns") did for the io_uring SQPOLL thread. The doit and dumpit paths both
> run synchronously in the caller's context, so task_active_pid_ns(current) is
> the caller's pid namespace.
> 
> Fixes: db4704f4e4df ("netdev-genl: Add PID for the NAPI thread")
> Cc: stable@vger.kernel.org
> Signed-off-by: Maoyi Xie <maoyixie.tju@gmail.com>
> ---
>  net/core/netdev-genl.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>

Reviewed-by: Joe Damato <joe@dama.to>

  reply	other threads:[~2026-06-15 20:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-15 17:17 [PATCH net] netdev-genl: report NAPI thread PID in the caller's pid namespace Maoyi Xie
2026-06-15 20:43 ` Joe Damato [this message]
2026-06-16  0:27 ` Samiullah Khawaja

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ajBj5j01YmdS02Uw@devvm20253.cco0.facebook.com \
    --to=joe@dama.to \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dtatulea@nvidia.com \
    --cc=dw@davidwei.uk \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maoyixie.tju@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=razor@blackwall.org \
    --cc=sdf@fomichev.me \
    --cc=skhawaja@google.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox