Page MenuHomeFreeBSD

aio: Interlock with listen(2)
ClosedPublic

Authored by markj on Sep 10 2021, 4:19 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 17 2024, 2:30 AM
Unknown Object (File)
Mar 17 2024, 2:30 AM
Unknown Object (File)
Mar 17 2024, 2:30 AM
Unknown Object (File)
Mar 17 2024, 2:18 AM
Unknown Object (File)
Feb 12 2024, 11:48 AM
Unknown Object (File)
Feb 8 2024, 11:04 AM
Unknown Object (File)
Dec 20 2023, 2:06 AM
Unknown Object (File)
Dec 12 2023, 3:18 PM
Subscribers

Details

Summary

soo_aio_queue() did not handle the possibility that the provided socket
is a listening socket. Up until recently, to fix this one would have to
acquire the socket lock first and check, since the socket buffer locks
were destroyed by listen(2).

Now that the socket buffer locks belong to the socket, simply check
SOLISTENING(so) after acquiring them, and make listen(2) return an error
if any AIO jobs are enqueued on the socket.

Add a couple of simple regression test cases.

Note that this fixes things only for the default AIO implementation;
cxgbe has a separate pru_aio_queue implementation which needs to be
fixed.

Reported by: syzbot+c8aa122fa2c6a4e2a28b@syzkaller.appspotmail.com
Reported by: syzbot+39af117d43d4f0faf512@syzkaller.appspotmail.com

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable