From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C744606B1EB for ; Mon, 2 Nov 2026 14:25:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DsO3tGmk Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4jJDWx0r5Kz3bWX; Tue, 03 Nov 2026 01:25:49 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip="2600:3c0a:e001:78e:0:1991:8:25" ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1793629549; cv=none; b=HXOfPm5hZEw9wPYDKgQHSANp18c1qqiLYQD7xV18OBVtTVrnFi0n31wK0EEHcTUHJXZIzaWhCeRO1GNbh17eT2cwn6CV+SzOfqY8ahXPKzmgK2E5kE/sz39QGYOBA82e3JRuVU3YgfxMQtLdR/eimwjqL4ea4V6jzlW+9xIjBUa8c8kvnsYTmKJN7Gtbv+9zflgtKEY5VW8H1CVfpNoDyl7boI8SxDXgAAYFM238lBI7cqimYmzgPHERdQ3wydyiTH3Nw5v5S7t2/5nX4czKRcKjzmq/0E4KbREYyDf2rzu7k10mCKSHJMDCMm+BpI6whz1AJYYlS8AvIsWEu3EvVg== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1793629549; c=relaxed/relaxed; bh=QKQgab6F/A3kQED3xQkQ3++bbO+NbqHo8+XrgOES7ts=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ib9C2V86AunW8c+QVJyOziHWowete1HU1zUC5i2UOEDHCE1czQhPk4DQXRYysUVhnrBn0m0JVF6tkGS9z8WnwKsxOX/4NZzyj7zeB3vlCkAngeyoiGC5Xdzwbwxg6ladbAMdD3A9bkZpPSjjccImnLpRAu+jEkGZ2ttlfFBfa9DAe6lqA+9epAYBczR+1mxapp7y074Qns/GcJ5NNsPTk7a5FDL2+tD7CPXb7q/xOeZ13yKqZ5XQMOgbCN5iOD6ehJU/2Di5TKLFGvVh4iHRmnND+0npq5HDrSa0OVxRkJGV0x8LfD3bPzQ2aPV0wiuAZfShHcudMuwJiDiX/e/seg== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DsO3tGmk; dkim-atps=neutral; spf=pass (client-ip=2600:3c0a:e001:78e:0:1991:8:25; helo=sea.source.kernel.org; envelope-from=brauner@kernel.org; receiver=lists.ozlabs.org) smtp.mailfrom=kernel.org Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DsO3tGmk; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=2600:3c0a:e001:78e:0:1991:8:25; helo=sea.source.kernel.org; envelope-from=brauner@kernel.org; receiver=lists.ozlabs.org) Received: from sea.source.kernel.org (sea.source.kernel.org [IPv6:2600:3c0a:e001:78e:0:1991:8:25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4jJDWw2hhPz30Vs for ; Tue, 03 Nov 2026 01:25:48 +1100 (AEDT) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id AE2B241609; Mon, 2 Nov 2026 14:25:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19D251F00A16; Mon, 2 Nov 2026 14:25:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793629546; bh=QKQgab6F/A3kQED3xQkQ3++bbO+NbqHo8+XrgOES7ts=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=DsO3tGmkPm0NrZBAy36Ik2sKieKOlgJ0mgJL9J8HUXGWM9u2I/c3pHtKiQ0Do2PYm 7gQh5TWLbJfjqkyLpRYxtlHQknQ5ICn+rBMWeVJe+1wUDcrFokW3QV5BRKEjIIM1g7 4uK1dsR4VmTwi1xfPzeMKa6KM54nvBM/9lBOIH2sBK5vfPjnFtHLtg/MR6utvOuTbr BhV4LYIsAevL+sCKBVvYYsxh9K52tALkm+ZraCF9ZgTpQRr9LK+Kf5i1yQ7qyCHV1I CDizin0EMhnII/l7E8fS5Bk+dgnSr97jORnukihffTpxsXFFOekF7M+lAIoxR9VIie WHOn5K7hwiJoA== From: Christian Brauner Date: Mon, 02 Nov 2026 15:21:32 +0100 Subject: [PATCH RFC 17/38] net: pktgen: reject device names with a '/' X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , Precedence: list X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261102-work-procfs-bugfixes-v1-17-59422ed3e465@kernel.org> References: <20261102-work-procfs-bugfixes-v1-0-59422ed3e465@kernel.org> In-Reply-To: <20261102-work-procfs-bugfixes-v1-0-59422ed3e465@kernel.org> To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Jann Horn , Josef Bacik , Chris Mason , Jeff Layton , NeilBrown , Eric Dumazet , Thomas Gleixner , Al Viro , Jonathan Corbet , Christoph Hellwig , Greg Kroah-Hartman , Joel Granados , Kees Cook , Jan Kara , Jan Kara , linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, linux-um@lists.infradead.org, linux-wireless@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org, ntfs3@lists.linux.dev, platform-driver-x86@vger.kernel.org, coreteam@netfilter.org, kexec@lists.infradead.org, linux-pci@vger.kernel.org, linux-sound@vger.kernel.org, netfilter-devel@vger.kernel.org, dri-devel@lists.freedesktop.org, ibm-acpi-devel@lists.sourceforge.net, jfs-discussion@lists.sourceforge.net, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-cifs@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-mm@kvack.org, linux-sh@vger.kernel.org, linux-usb@vger.kernel.org, samba-technical@lists.samba.org, sparclinux@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-doc@vger.kernel.org, linux-serial@vger.kernel.org, linux-atm-general@lists.sourceforge.net, Takashi Iwai , linux-input@vger.kernel.org, linux-raid@vger.kernel.org, linux-ext4@vger.kernel.org, linux-modules@vger.kernel.org, linux-debuggers@vger.kernel.org, "Christian Brauner (Amutable)" , Chuck Lever , stable@vger.kernel.org X-Mailer: b4 0.17-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1684; i=brauner@kernel.org; h=from:subject:message-id; bh=F9CLtO30/n/hY0YqeSuPpMfy319PBmjhBXOfLkB61UI=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMWS9mJOdP/nSfLcrXttv7FH7+buGK2LZ4TruhxXmP3hSF uVMm/phfUcpC4MYF4OsmCKLQ7tJuNxynorNRpkaMHNYmUCGMHBxCsBEjPkYGR7c7BeINg2bJuR9 a7LIdeFTC7/c3ff8saxRtWV+/N3pzG2MDF/XB9+RXGXonZWutHZr+BHB7Po/GQd5V955MO/WnZP Br5kA X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 "add_device" takes a name like eth0@1. Only the part in front of the '@' has to name a network device. The rest is free text and all of it becomes the name of a file in /proc/net/pktgen, where procfs takes a '/' as a directory separator. So "add_device lo@a/b" makes procfs look for a directory "lo@a" that doesn't exist and warn about it. Any user can do that in a network namespace of its own: name 'lo@a/b' WARNING: fs/proc/generic.c:174 at __xlate_proc_name+0xb1/0xf0, CPU#3: bash/241 Call Trace: __proc_create+0xd0/0x9b0 proc_create_reg+0x45/0xf0 proc_create_data+0x77/0xf0 pktgen_thread_write+0xd8d/0x1750 With panic_on_warn that takes the machine down. And if "lo@a" exists because somebody added a device of that name, procfs used to register the new entry below that regular file, and removing "lo@a" freed both. Reject names with a '/'. Reported-by: Chris Mason Fixes: e6fce5b916cd ("pktgen: multiqueue etc.") Cc: stable@vger.kernel.org Signed-off-by: Christian Brauner (Amutable) --- net/core/pktgen.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/core/pktgen.c b/net/core/pktgen.c index d63eeadddfcc..02af70d360bc 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -3831,6 +3831,10 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname) int err; int node = cpu_to_node(t->cpu); + /* The name becomes the name of a file in /proc/net/pktgen. */ + if (strchr(ifname, '/')) + return -EINVAL; + /* We don't allow a device to be on several threads */ if (__pktgen_NN_threads(t->net, ifname, FIND)) { -- 2.53.0