From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793633214; b=5WsTEpP/SXBD2VPvxjyZYgA/pgLwUX1ToxpX3/QSY0Qm7CF//Wrqf6D6/aoV52Lk48Ry IUhYTdhlBWumF7g7CtT8ICTmhJrJgMRHk+gBu1yKrfQzxS6Ta06ooLKcW2DxtSihsEc0Z xWtN5GfUD7Wj0ljSz7q4WxynCqXvwVBI1PW4NFcX4TN0AU/4rBE2LIdHPFEHwIT4zw+e/ XB0BMuIDtHfwbjWEG2xLfZDbv3bdxqAu/mTxsugn4NI59AUbWRFLZaXIBErPUachAIVCn cIKDkCExHs1jQyw/IpNPb0PrT7/xvl86rcTnEhcueaH6BFGrGdi2XorVzyN5Tw7r6NQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793633214; h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer:X-Developer-Signature:X-Developer-Key; bh=5GRAUZH2kX1HsIdPeFBozE83iEr60/LUxZUEqoYcqBA=; b=V7nDQ6JBo8JeHhweyzzFvaDEaR4aIq7lxwU9pCjhUF/0XJoBYwXOYoxnEy1oRRiqU9VR finxmwp3aPdAWxRCETAAD4c0AUAl0wRMQ/tyOtFvw/ETAvJUlqw+NU9rHPJxJT9fty4CI DKTj2iKZFU2pmrnlgEG6f3/UaEFZIXNukzF9cBVX6Vu/TPhVSWOzbqCXRbHIUOHNoDoly 9Z6Q7dRhF/7h7h4rRZ0QtYn1IXDvNKXrDuKagrYdllD7do/E42nW+qShali0l6fsCMU6E IhhVxeZ7DNq6fctYWI10MFc+UqttwWgANvyXhCC4T43OAcJlUYVE8iijM9NgIekppyA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nYBs0GAF; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (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 19616609B596; Mon, 2 Nov 2026 15:26:53 +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=nYBs0GAF Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96FDA1F00A16; Mon, 2 Nov 2026 15:26:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793633213; bh=5GRAUZH2kX1HsIdPeFBozE83iEr60/LUxZUEqoYcqBA=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=nYBs0GAF8b3S0eatIZoAhddTaBQQ/i0CrcM92EglgsZZbWpy731ExatrOh40qewLF Lp8S7Rrut+eO6q6LdIfOUD8IT/maYnyF1DBExnOFJG7mwcNuHGN5jv9pNZ9AuWREId lnOMTthrQoRObRBolVjhYcHCSAlAi4r+kE39L/TCDTKs5S84hkUHNI6KoriDtYwBpI U0fE3C6vht9Hwk8FIpEHBtzNae5orDp4ap1DfxmedQEVe2FH237hpiNUepRwcWVPa9 eKW1KUqWkYD6wrjns7QIlZcwyB9vCaN2c35pIVU6Iu87SgiaL5+rLK2WDEDvulHZL8 tBantGPOqqkGQ== From: Christian Brauner Date: Mon, 02 Nov 2026 16:07:30 +0100 Subject: [PATCH RFC 20/27] module: procfs: let procfs own the seq_file of /proc/modules X-Mailing-List: linux-raid@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261102-work-procfs-fs-v1-20-d09a996317b3@kernel.org> References: <20261102-work-procfs-fs-v1-0-d09a996317b3@kernel.org> In-Reply-To: <20261102-work-procfs-fs-v1-0-d09a996317b3@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 X-Mailer: b4 0.17-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1665; i=brauner@kernel.org; h=from:subject:message-id; bh=flwsY9W3AwD1el1fvMS4MRjAzw7empBDyCTwiYsv/MA=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMWS9WG50+lPbWr8TO3/XJX642z+55KDeRh0pIW9bi1VZ/ MvKft0s7ChlYRDjYpAVU2RxaDcJl1vOU7HZKFMDZg4rE8gQBi5OAZiIpwUjwwyex5oMWjNmXVW1 TDi5fH3+9vUsj5XnVPa/nJM/5XDQTDNGhsPvYp7dK/9aPKFSfO5H07Jd/XPz+O2FRZWOr7PQyLs rzAIA X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 Declare the seq_operations and let procfs open and free the seq_file. ->proc_open() only decides whether to hide the addresses now. Signed-off-by: Christian Brauner (Amutable) --- kernel/module/procfs.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/kernel/module/procfs.c b/kernel/module/procfs.c index 90712aa9dd13..a759bd916df7 100644 --- a/kernel/module/procfs.c +++ b/kernel/module/procfs.c @@ -117,31 +117,24 @@ static const struct seq_operations modules_op = { }; /* - * This also sets the "private" pointer to non-NULL if the - * kernel pointers should be hidden (so you can just test + * procfs opens the seq_file. This sets the "private" pointer to non-NULL + * if the kernel pointers should be hidden (so you can just test * "m->private" to see if you should keep the values private). * * We use the same logic as for /proc/kallsyms. */ static int modules_open(struct inode *inode, struct file *file) { - int err = seq_open(file, &modules_op); + struct seq_file *m = file->private_data; - if (!err) { - struct seq_file *m = file->private_data; - - m->private = kallsyms_show_value(file->f_cred) ? NULL : (void *)8ul; - } - - return err; + m->private = kallsyms_show_value(file->f_cred) ? NULL : (void *)8ul; + return 0; } static const struct proc_ops modules_proc_ops = { .proc_flags = PROC_ENTRY_PERMANENT, + .proc_seq_ops = &modules_op, .proc_open = modules_open, - .proc_read = seq_read, - .proc_lseek = seq_lseek, - .proc_release = seq_release, }; static int __init proc_modules_init(void) -- 2.53.0