Skip to contentSkip to conversation

registering files returns -EBADF in 5.10.214

DISCUSSION Kornilios Kourtis 2 participants 2 messages Apr 3, 2024 io_uring

lore
Share & tools
lore
#0 lore raw

Hi,

In 5.10.214, registering files seems to return -EBADF

Running the file-register test from (latest) liburing:

liburing/test# uname -r
5.10.214
liburing/test# ./file-register.t
test_basic: register -9
test_basic failed

The test seems to work in 5.10.211:

liburing/test# uname -r
5.10.211
liburing/test# ./file-register.t
file alloc ranges are not supported, skip

Best,
Kornilios.

Signature · 1 line
https://kkourt.io/
maintainer
#1 lore raw
Quoted 12 lines · Kornilios Kourtis

Hi,

In 5.10.214, registering files seems to return -EBADF

Running the file-register test from (latest) liburing:

liburing/test# uname -r
5.10.214
liburing/test# ./file-register.t
test_basic: register -9
test_basic failed

Quoted 6 lines

The test seems to work in 5.10.211:

liburing/test# uname -r
5.10.211
liburing/test# ./file-register.t
file alloc ranges are not supported, skip

I sent in patches for this for stable, it was (unfortunately) an error introduced by a backport. FWIW, here's the 5.10-stable patch that I sent in.

Signature · 1 line
Jens Axboe

From a8c22921a08a8d50b10fc836cff4348d5dde17e2 Mon Sep 17 00:00:00 2001
From: Jens Axboe <[email protected]>
Date: Tue, 2 Apr 2024 08:28:04 -0600
Subject: [PATCH] io_uring: ensure '0' is returned on file registration success

A previous backport mistakenly removed code that cleared 'ret' to zero, as the SCM logging was performed. Fix up the return value so we don't return an errant error on fixed file registration.

Fixes a6771f343af9 ("io_uring: drop any code related to SCM_RIGHTS")
---
 io_uring/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/io_uring.c +1 -1
index fc60396c9039..93f9ecedc59f 100644
@@ -8247,7 +8247,7 @@ static int io_sqe_files_register(struct io_ring_ctx *ctx, void __user *arg,
 	}
 
 	io_rsrc_node_switch(ctx, NULL);
-	return ret;
+	return 0;
 out_fput:
 	for (i = 0; i < ctx->nr_user_files; i++) {
 		file = io_file_from_index(ctx, i);
Signature · 1 line
2.43.0