Re: [PATCH 6/6] io_uring: allow specific fd for IORING_OP_ACCEPT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/4/20 12:02 PM, Josh Triplett wrote:
> On Wed, Mar 04, 2020 at 11:00:16AM -0700, Jens Axboe wrote:
>> sqe->len can be set to a specific fd we want to use for accept4(), so
>> it uses that one instead of just assigning a free unused one.
> [...]
>> +	accept->open_fd = READ_ONCE(sqe->len);
>> +	if (!accept->open_fd)
>> +		accept->open_fd = -1;
> 
> 0 is a valid file descriptor. I realize that it seems unlikely, but I
> went to a fair bit of trouble in my patch series to ensure that
> userspace could use any valid file descriptor openat2, without a corner
> case like "you can't open as file descriptor 0", even though it would
> have been more convenient to just say "if you pass a non-zero fd in
> open_how". Please consider accepting a flag to determine the validity of
> open_fd.

Heh, I actually just changed this, just added that as a temporary hack to
verify that things were working. Now SOCK_SPECIFIC_FD is required, and we
just gate on that. OP_ACCEPT disallowed fd != 0 before, so we continue
to do that if SOCK_SPECIFIC_FD isn't set:

https://git.kernel.dk/cgit/linux-block/log/?h=io_uring-fd-select

top two patches.

-- 
Jens Axboe




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux