public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCHSET 0/2] io_uring fdinfo cleanups
@ 2025-05-16 18:48 Jens Axboe
  2025-05-16 18:48 ` [PATCH 1/2] io_uring/fdinfo: only compile if CONFIG_PROC_FS is set Jens Axboe
  2025-05-16 18:48 ` [PATCH 2/2] io_uring/fdinfo: get rid of dumping credentials Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Jens Axboe @ 2025-05-16 18:48 UTC (permalink / raw)
  To: io-uring

Hi,

Just two minor patches in here, cleaning up the fdinfo parts a little
bit:

1) Only compile fdinfo.c if CONFIG_PROC_FS is set, rather than wrap all
   of fdinfo.c in a if/endif section.

2) Get rid of dumping credentials in fdinfo. I'm not at all convinced
   this is either useful or necessary, so get rid of it.

 io_uring/Makefile |  3 ++-
 io_uring/fdinfo.c | 40 ----------------------------------------
 2 files changed, 2 insertions(+), 41 deletions(-)

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] io_uring/fdinfo: only compile if CONFIG_PROC_FS is set
  2025-05-16 18:48 [PATCHSET 0/2] io_uring fdinfo cleanups Jens Axboe
@ 2025-05-16 18:48 ` Jens Axboe
  2025-05-16 18:48 ` [PATCH 2/2] io_uring/fdinfo: get rid of dumping credentials Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2025-05-16 18:48 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe

Rather than wrap fdinfo.c in one big if, handle it on the Makefile
side instead. io_uring.c already conditionally sets fops->fdinfo()
anyway.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 io_uring/Makefile | 3 ++-
 io_uring/fdinfo.c | 2 --
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/io_uring/Makefile b/io_uring/Makefile
index 11a739927a62..d97c6b51d584 100644
--- a/io_uring/Makefile
+++ b/io_uring/Makefile
@@ -11,7 +11,7 @@ obj-$(CONFIG_IO_URING)		+= io_uring.o opdef.o kbuf.o rsrc.o notif.o \
 					eventfd.o uring_cmd.o openclose.o \
 					sqpoll.o xattr.o nop.o fs.o splice.o \
 					sync.o msg_ring.o advise.o openclose.o \
-					statx.o timeout.o fdinfo.o cancel.o \
+					statx.o timeout.o cancel.o \
 					waitid.o register.o truncate.o \
 					memmap.o alloc_cache.o
 obj-$(CONFIG_IO_URING_ZCRX)	+= zcrx.o
@@ -20,3 +20,4 @@ obj-$(CONFIG_FUTEX)		+= futex.o
 obj-$(CONFIG_EPOLL)		+= epoll.o
 obj-$(CONFIG_NET_RX_BUSY_POLL)	+= napi.o
 obj-$(CONFIG_NET) += net.o cmd_net.o
+obj-$(CONFIG_PROC_FS) += fdinfo.o
diff --git a/io_uring/fdinfo.c b/io_uring/fdinfo.c
index e0d6a59a89fa..b83296eee5f8 100644
--- a/io_uring/fdinfo.c
+++ b/io_uring/fdinfo.c
@@ -15,7 +15,6 @@
 #include "cancel.h"
 #include "rsrc.h"
 
-#ifdef CONFIG_PROC_FS
 static __cold int io_uring_show_cred(struct seq_file *m, unsigned int id,
 		const struct cred *cred)
 {
@@ -264,4 +263,3 @@ __cold void io_uring_show_fdinfo(struct seq_file *m, struct file *file)
 		mutex_unlock(&ctx->uring_lock);
 	}
 }
-#endif
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] io_uring/fdinfo: get rid of dumping credentials
  2025-05-16 18:48 [PATCHSET 0/2] io_uring fdinfo cleanups Jens Axboe
  2025-05-16 18:48 ` [PATCH 1/2] io_uring/fdinfo: only compile if CONFIG_PROC_FS is set Jens Axboe
@ 2025-05-16 18:48 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2025-05-16 18:48 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe

It's a faily obscure feature, and registered credentials would for that
mostly be a static thing. Don't bother including code to dump the
personalities indices.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 io_uring/fdinfo.c | 38 --------------------------------------
 1 file changed, 38 deletions(-)

diff --git a/io_uring/fdinfo.c b/io_uring/fdinfo.c
index b83296eee5f8..e9355276ab5d 100644
--- a/io_uring/fdinfo.c
+++ b/io_uring/fdinfo.c
@@ -15,36 +15,6 @@
 #include "cancel.h"
 #include "rsrc.h"
 
-static __cold int io_uring_show_cred(struct seq_file *m, unsigned int id,
-		const struct cred *cred)
-{
-	struct user_namespace *uns = seq_user_ns(m);
-	struct group_info *gi;
-	kernel_cap_t cap;
-	int g;
-
-	seq_printf(m, "%5d\n", id);
-	seq_put_decimal_ull(m, "\tUid:\t", from_kuid_munged(uns, cred->uid));
-	seq_put_decimal_ull(m, "\t\t", from_kuid_munged(uns, cred->euid));
-	seq_put_decimal_ull(m, "\t\t", from_kuid_munged(uns, cred->suid));
-	seq_put_decimal_ull(m, "\t\t", from_kuid_munged(uns, cred->fsuid));
-	seq_put_decimal_ull(m, "\n\tGid:\t", from_kgid_munged(uns, cred->gid));
-	seq_put_decimal_ull(m, "\t\t", from_kgid_munged(uns, cred->egid));
-	seq_put_decimal_ull(m, "\t\t", from_kgid_munged(uns, cred->sgid));
-	seq_put_decimal_ull(m, "\t\t", from_kgid_munged(uns, cred->fsgid));
-	seq_puts(m, "\n\tGroups:\t");
-	gi = cred->group_info;
-	for (g = 0; g < gi->ngroups; g++) {
-		seq_put_decimal_ull(m, g ? " " : "",
-					from_kgid_munged(uns, gi->gid[g]));
-	}
-	seq_puts(m, "\n\tCapEff:\t");
-	cap = cred->cap_effective;
-	seq_put_hex_ll(m, NULL, cap.val, 16);
-	seq_putc(m, '\n');
-	return 0;
-}
-
 #ifdef CONFIG_NET_RX_BUSY_POLL
 static __cold void common_tracking_show_fdinfo(struct io_ring_ctx *ctx,
 					       struct seq_file *m,
@@ -213,14 +183,6 @@ static void __io_uring_show_fdinfo(struct io_ring_ctx *ctx, struct seq_file *m)
 		else
 			seq_printf(m, "%5u: <none>\n", i);
 	}
-	if (!xa_empty(&ctx->personalities)) {
-		unsigned long index;
-		const struct cred *cred;
-
-		seq_printf(m, "Personalities:\n");
-		xa_for_each(&ctx->personalities, index, cred)
-			io_uring_show_cred(m, index, cred);
-	}
 
 	seq_puts(m, "PollList:\n");
 	for (i = 0; i < (1U << ctx->cancel_table.hash_bits); i++) {
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-16 18:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-16 18:48 [PATCHSET 0/2] io_uring fdinfo cleanups Jens Axboe
2025-05-16 18:48 ` [PATCH 1/2] io_uring/fdinfo: only compile if CONFIG_PROC_FS is set Jens Axboe
2025-05-16 18:48 ` [PATCH 2/2] io_uring/fdinfo: get rid of dumping credentials Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox