From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (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 AEF90329C71 for ; Mon, 15 Jun 2026 07:01:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781506919; cv=none; b=HycFKIWXy6bcfuTJqT/jMuLHpvY9K2YjnzIG2Ywr7MGhVpA0zu5ZJf0/mZGhqVVBNazZkPzYRNycPUq5VZMfuJBowzTUDT7P2ZUBSP/JGOYlD8VSjb59UP25ZqOOWnqlZU+pCth5XzvEqHtp6IS1LTgHrb2zP1xsEmW6JNnGJpA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781506919; c=relaxed/simple; bh=Zg3PZZceVWVnzLK/0U9jN/wv1jhAvnLbMgpKpi93tZk=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=r3mdN6CedMJ3kS76JaLVrN/HMaMYMEpJ2pBt5UUCimTABWfQl4h6UqoF65tGf8TUZQLzobvIDmJidsNg71n8jzOuOek86wnCkJtnXqrlrAey6zXm7REQ+BqdGfRzj5UidEzuc9BZjOPOOSNfHYIXz5eB8lrQlapbMKWGjWlTegc= 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=LfFH/o6t; arc=none smtp.client-ip=209.85.216.44 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="LfFH/o6t" Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-36babe2c4bdso1704831a91.1 for ; Mon, 15 Jun 2026 00:01:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781506918; x=1782111718; 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; bh=XfjOiJOK8cmnc7WRNYZddSGB0RkM01zSadnY6B/8VhA=; b=LfFH/o6tzzkv4xBpcP1XqF78gKwCiYeFHrf5iNSoT82ouaevSsDL00ruas4optGaWl nSoyJ1CpoYCFdp0vgLFG4tf4sXgQnWPQ1L65emsnafWwTZBNgs9V2Jp17+aq2hbvvi/P ccFOktoENYa1+kn6sGf6M+Iy71KZxC2LIVhhQl9EsSRBxaQG4xd3AGk6WDiFK+9uL2IT Lh+DC8/B74toR/qdRthqF1QIQwkwtGHKEL74enWdZiB2uNKM9KXRs/IWH6ICLxI4R89o iHzyMr5Fb5gqLKFJ8RKWPGzIr/huAd6mgEqQJsIzKxmouKfKPo1UKzrJPoaDFmtGLJ5A P+Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781506918; x=1782111718; 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; bh=XfjOiJOK8cmnc7WRNYZddSGB0RkM01zSadnY6B/8VhA=; b=GFr8dhCjj+cdTpBsXzmM/G50EdUB67iy4/kIuFX3rEKUrWQb6dD7XNVQRla+RvuQFW p7TI2Si/z4GfWQMljDyrX9YgutKNfw37eti5oSveV/cX26v4a1GqQZnZ1Iy8zsL/tjjJ VfcaSgTM04I1JKS6jMr9wrIAehIPWen1CRDEDh34FLZlVXEHX3vAWzGHVPwAIdE6kqKW 5Bb27hfMfRw2zIFBojBoZ9qyHDewO1Iehdr50dnecFi8PvaLv+cN+o/zpfVGehtW4ka8 W1gbO2iHjjXJcwzMdeQ66BvWWlQ6JGvLhh1RnTNV5noCvdsvFhFRUCKtSm5pXAQT/oBX +wHg== X-Forwarded-Encrypted: i=1; AFNElJ/dJeGHetXQWvCXaqb4/PRkcAqMWYkt0rntC2tvicPQoh8o2CC1zqs5A8Gu2hO4mzTx9zQhyarqNBiLO+E=@vger.kernel.org X-Gm-Message-State: AOJu0YwfqF0o/8ycrrpvy/W17OnJpzsJJl+Eq/3vPu+s2DqjECllhncR LvoRoOvSdzv5E7I2qIUG4Jcx7prILw1xX+doUqFDfKhOufA5DDX/0lOf X-Gm-Gg: Acq92OF016kUBw6AssebKuqWcXgA+jQSDpBTI51g0ZCCMuC64jF4bXf+PrUq1s7fAx8 EElSOQPiSsXnRWmQZwJxU2Nkc+oAvuCbGtTm87YrjSqioWrdDdixrJi2fumTyp1Ccr97vF82QNv BojrI0V3+N4NV9HbvimbWId7LhX4gux0/qpmuhCAFmJWLqnsAZiNIHFAgzuNrdtdvCP68vTJXuq qEsip7d1zFq5XAGRmSp17nd0BJHcn/sdTSF61TChMqScavS8pjk/MOPAem0apD+svzu+CWFtQpY 79hXgHLDdjuZI/RyTZ5fYsmccr6q3wPTdvcGn3Es/ZiBEt/oEK090X4L/6LYkox40arIvaWQZyJ 8vGd2ZNQ774gNv+/b6YkZBijYhsBjyQAtDsA9uBxr6zGiGlQqxIHiZ4uZo3bPzdOmxc6R+BKfUy B0MwybpG/K5yhEPsvK494NB9murBawxs4I/mGPSsGk348EeLAlEvFp58pZeIw= X-Received: by 2002:a17:90b:582e:b0:36b:b1f4:e0ac with SMTP id 98e67ed59e1d1-37a034f522cmr13518398a91.14.1781506917867; Mon, 15 Jun 2026 00:01:57 -0700 (PDT) Received: from csl-conti-dell7858.ntu.edu.sg ([155.69.195.57]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-379e7e217c0sm6891919a91.2.2026.06.15.00.01.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jun 2026 00:01:57 -0700 (PDT) From: Maoyi Xie To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Amritha Nambiar , Simon Horman , David Wei , Stanislav Fomichev , Samiullah Khawaja , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Maoyi Xie Subject: net: netdev-genl: NETDEV_A_NAPI_PID is the init-ns pid, not the caller's Date: Mon, 15 Jun 2026 15:01:52 +0800 Message-Id: <20260615070152.1211050-1-maoyixie.tju@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi all, I noticed something in netdev_nl_napi_fill_one() and would appreciate your view on whether it is a real problem. It reports the NAPI kthread pid like this: if (napi->thread) { pid = task_pid_nr(napi->thread); if (nla_put_u32(rsp, NETDEV_A_NAPI_PID, pid)) task_pid_nr() returns the pid in the initial pid namespace. It is put into NETDEV_A_NAPI_PID without any translation to the caller's pid namespace. NETDEV_CMD_NAPI_GET has no GENL_ADMIN_PERM and the family is netnsok. So a caller in a child pid namespace can read it. That caller then sees the kthread's global pid. The kthread is not in that namespace, so the value there should be 0. This looks like the same case as commit 3799c2570982 ("io_uring/fdinfo: translate SqThread PID through caller's pid_ns"). I checked it with a small reproducer and a fix. From a child pid namespace the reproducer reads the kthread's global pid. With the fix it reads 0. I am not sure how much this matters in practice. I would appreciate it if you could let me know whether it is worth a fix. I am happy to send the patch. Thanks, Maoyi