Re: io_uring file descriptor address already in use error

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

 



On 8/25/20 9:00 AM, Josef wrote:
> Hi,
> 
> I found a bug submitting a server socket poll in io_uring. The file
> descriptor is not really closed when calling close(2), if I bind a new
> socket with the same address & port I'll get an "Already in use" error
> message
> 
> example to reproduce it
> https://gist.github.com/1Jo1/3ace601884b86f7495fd5241190494dc

Not sure this is an actual bug, but depends on how you look at it. Your
poll command has a reference to the file, which means that when you close
it here:

    assert(close(sock_listen_fd1) == 0); 

then that's not the final close. If you move the io_uring_queue_exit()
before that last create_server_socket() it should work, since the poll
will have been canceled (and hence the file closed) at that point.

That said, I don't believe we actually need the file after arming the
poll, so we could potentially close it once we've armed it. That would
make your example work.

-- 
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