How can you not be romantic about UNIX domain sockets?
15 points by polywolf
15 points by polywolf
What fun!
The same bug is still in OpenBSD: https://codeberg.org/OpenBSD/src/src/commit/ddbdbf63db1bb343170a59cff6fd99e2556cef88/sys/kern/uipc_usrreq.c#L666
And NetBSD (look for line 888): https://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/uipc_usrreq.c?annotate=1.209
It was fixed in FreeBSD in 2002 in a more clever way than I expected: https://cgit.freebsd.org/src/commit/sys/kern/uipc_usrreq.c?id=6f782c4636672e40c45ef9c9f17635e6c110d290
FreeBSD's current code allocates inode numbers eagerly (to avoid a data race) and more simply (assuming that you can't create 2^64 sockets in the lifetime of the system, heh): https://cgit.freebsd.org/src/commit/sys/kern/uipc_usrreq.c?id=f218ac5087c7697321d3866d68c037cc88b0b005
Also, how the hell is my demo the first ever process on the iPhone to call fstat() on a UNIX domain socket?
Yeah, surprising!
Interesting post. Really surprising to spot such a vintage bug in a modern, much reviewed kernel.
This is really neat! A delightful bit of archaeology.