public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Gabriel Krisman Bertazi <krisman@suse.de>
Cc: netdev@vger.kernel.org, io-uring@vger.kernel.org,
	Jakub Kicinski <kuba@kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>
Subject: Re: [PATCH 3/3] io_uring: Introduce getsockname io_uring cmd
Date: Mon, 27 Oct 2025 15:48:47 -0600	[thread overview]
Message-ID: <23860806-f58d-4f11-977a-8ec518adc59a@kernel.dk> (raw)
In-Reply-To: <87ldkwyrcf.fsf@mailhost.krisman.be>

On 10/27/25 3:20 PM, Gabriel Krisman Bertazi wrote:
> Jens Axboe <axboe@kernel.dk> writes:
> 
>> On 10/24/25 9:49 AM, Gabriel Krisman Bertazi wrote:
>>> Introduce a socket-specific io_uring_cmd to support
>>> getsockname/getpeername via io_uring.  I made this an io_uring_cmd
>>> instead of a new operation to avoid polluting the command namespace with
>>> what is exclusively a socket operation.  In addition, since we don't
>>> need to conform to existing interfaces, this merges the
>>> getsockname/getpeername in a single operation, since the implementation
>>> is pretty much the same.
>>>
>>> This has been frequently requested, for instance at [1] and more
>>> recently in the project Discord channel. The main use-case is to support
>>> fixed socket file descriptors.
>>
>> Just two nits below, otherwise looks good!
>>
>>> diff --git a/io_uring/cmd_net.c b/io_uring/cmd_net.c
>>> index 27a09aa4c9d0..092844358729 100644
>>> --- a/io_uring/cmd_net.c
>>> +++ b/io_uring/cmd_net.c
>>> @@ -132,6 +132,28 @@ static int io_uring_cmd_timestamp(struct socket *sock,
>>>  	return -EAGAIN;
>>>  }
>>>  
>>> +static int io_uring_cmd_getsockname(struct socket *sock,
>>> +				    struct io_uring_cmd *cmd,
>>> +				    unsigned int issue_flags)
>>> +{
>>> +	const struct io_uring_sqe *sqe = cmd->sqe;
>>> +
>>
>> Random newline.
> 
> Done, but this fix will totally ruin the diffstat.  :(

What do you mean, it'll look even better as you're now killing a
redundant line you added :)

>>> +	struct sockaddr_storage address;
>>> +	struct sockaddr __user *uaddr;
>>> +	int __user *ulen;
>>> +	unsigned int peer;
>>> +
>>> +	uaddr = u64_to_user_ptr(READ_ONCE(sqe->addr));
>>> +	ulen = u64_to_user_ptr(sqe->addr3);
>>> +	peer = READ_ONCE(sqe->optlen);
>>> +
>>> +	if (sqe->ioprio || sqe->__pad1 || sqe->len || sqe->rw_flags)
>>> +		return -EINVAL;
>>
>> Most/all prep handlers tend to check these first, then proceed with
>> setting up if not set. Would probably make sense to mirror that here
>> too.
> 
> Ack. will wait a few days for feedback on the network side before the
> v2.

Sounds good, thanks.

-- 
Jens Axboe


  reply	other threads:[~2025-10-27 21:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-24 15:48 [PATCH 0/3] Introduce getsockname io_uring_cmd Gabriel Krisman Bertazi
2025-10-24 15:48 ` [PATCH 1/3] socket: Unify getsockname and getpeername implementation Gabriel Krisman Bertazi
2025-10-24 15:48 ` [PATCH 2/3] socket: Split out a getsockname helper for io_uring Gabriel Krisman Bertazi
2025-10-24 15:49 ` [PATCH 3/3] io_uring: Introduce getsockname io_uring cmd Gabriel Krisman Bertazi
2025-10-25 13:27   ` Jens Axboe
2025-10-27 21:20     ` Gabriel Krisman Bertazi
2025-10-27 21:48       ` Jens Axboe [this message]
2025-10-25 13:27 ` [PATCH 0/3] Introduce getsockname io_uring_cmd Jens Axboe
2025-11-19 23:30 ` Jens Axboe
2025-11-20  1:29   ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=23860806-f58d-4f11-977a-8ec518adc59a@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=io-uring@vger.kernel.org \
    --cc=krisman@suse.de \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox