Re: [PATCH v4] io_uring/register: add IORING_REGISTER_CLONE_FILES opcode

Harshal Chavan <[email protected]>
Newsgroups org.kernel.vger.io-uring,org.kernel.vger.linux-hardening,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Gabriel Krisman Bertazi @ 2026-06-22 20:04 UTC writes:

>Hello,
>
>Do you have the liburing side and test cases?
>
>A few comments inline.

Hello, 
Yes I will update the liburing side with helper function 
and add appropriate test cases.

>> +	/* clone file descriptors from another ring*/
>                                                ^ spacing

Fixed in v5

>> +	if (ctx->user != src_ctx->user || ctx->mm_account != src_ctx->mm_account)
>> +		return -EINVAL;
>
>I don't think it makes sense to check ->user here.  But is mm_account
>necessary either?  How could you get the src_ctx from another process?

Yes, Keeping this check would unnecessarily break valid use case like
Root user passing FDs to guest user

Removed it completely in v5, thanks for catching this!.


>> +	registered_src = (clone_arg.flags & IORING_REGISTER_SRC_REGISTERED) != 0;
>
>This is better written as
>
>registered_src = !!(clone_arg.flags & IORING_REGISTER_SRC_REGISTERED);

Understood, updated this in v5

>> +out:
>> +	if (src_ctx != ctx)
>> +		mutex_unlock(&src_ctx->uring_lock);
>
>Make the mutex_unlock unconditionally above the out label.  It is never
>locked in the error context.

Yes, moved the unlock statement before out without any conditions.

Thank you for the review.

Regards,
Harshal Chavan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.