<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-can-you-not-be-romantic-about-unix-domain-sockets--sox4kolgg" -->

---
title: How can you not be romantic about UNIX domain sockets?
description: A DEFCON 34 speaker traces a demo crash in an iOS-based SSH/VM project down to a 40-year-old logic bug in the BSD/XNU kernel's uipc_sense() function. Because...
canonical: https://daily.dev/posts/how-can-you-not-be-romantic-about-unix-domain-sockets--sox4kolgg
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How can you not be romantic about UNIX domain sockets? | daily.dev
og:description: A DEFCON 34 speaker traces a demo crash in an iOS-based SSH/VM project down to a 40-year-old logic bug in the BSD/XNU kernel's uipc_sense() function. Because...
og:url: https://daily.dev/posts/how-can-you-not-be-romantic-about-unix-domain-sockets--sox4kolgg
og:image: https://api.daily.dev/og/posts/sOX4koLgG.png
og:image:alt: How can you not be romantic about UNIX domain sockets?
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How can you not be romantic about UNIX domain sockets?

**[Lobsters](https://daily.dev/sources/lobsters)** · 11 min read · 0 upvotes · 0 comments

## Summary

A DEFCON 34 speaker traces a demo crash in an iOS-based SSH/VM project down to a 40-year-old logic bug in the BSD/XNU kernel's uipc_sense() function. Because unp_ino++ is used instead of ++unp_ino, the first UNIX domain socket ever fstat()'d on a freshly booted system gets inode 0, which the kernel misinterprets as 'uninitialized' and reassigns on the next call, causing an inode mismatch. Digging through XNU, NeXTSTEP, and 4.3BSD source history, the bug is traced back to a May 1985 Berkeley commit that first faked up inode numbers for UNIX domain sockets, meaning virtually every version of macOS and iOS has carried this quirk since Mac OS X's 2001 release.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://yuvalino.com/how-can-you-not-be-romantic-about-unix-domain-sockets>

## Questions this post answers

### Why does fstat() on a UNIX domain socket sometimes return a different inode number on the second call after a fresh boot?

The XNU kernel's uipc_sense() function uses unp_ino++ instead of ++unp_ino to lazily assign a socket inode, so the very first fstat() call on any UNIX domain socket on a freshly booted system receives inode 0. Since 0 is treated as the sentinel for 'uninitialized', the next fstat() call on that same socket reassigns it a different, nonzero inode, breaking the assumption that inodes stay stable across calls.

_Kernel-level quirks like this inode mismatch are exactly the kind of edge case developers track down on daily.dev._

### How old is the UNIX domain socket inode bug found in the XNU kernel?

The faulty unp_ino++ post-increment logic traces back to a May 28, 1985 4.3BSD commit that first added fake inode numbers for UNIX domain sockets, with the inode-consistency logic finalized in a December 20, 1985 commit. The same flawed logic persisted essentially unchanged through NeXTSTEP, the original 2001 XNU release in Mac OS X 10.0, and into modern iOS and macOS.

_Long-lived kernel bugs like this one are the sort of deep-dive developers follow on daily.dev._

## Similar posts on daily.dev

- [Hooray for the sockets interface](https://daily.dev/posts/hooray-for-the-sockets-interface-txukw5lm6) · Hacker News · 0 upvotes · 0 comments
- [Big Fish: Exploiting a 37-Year-Old Kernel Bug in OpenBSD](https://daily.dev/posts/big-fish-exploiting-a-37-year-old-kernel-bug-in-openbsd-u6hc8g4lt) · Hacker News · 0 upvotes · 0 comments
- [Beyond Localhost: An Engineer’s Guide to Unix Domain Sockets](https://daily.dev/posts/beyond-localhost-an-engineer-s-guide-to-unix-domain-sockets-w0utmm2sx) · Towards Dev · 15 upvotes · 0 comments
- [UNIX V4 workshop at Low Resource Computing](https://daily.dev/posts/unix-v4-workshop-at-low-resource-computing-1wkxfj6zn) · Lobsters · 0 upvotes · 0 comments

---

Tags: [#ios](https://daily.dev/tags/ios), [#reverse-engineering](https://daily.dev/tags/reverse-engineering), [#kernel-development](https://daily.dev/tags/kernel-development)

[View this post on daily.dev](https://daily.dev/posts/how-can-you-not-be-romantic-about-unix-domain-sockets--sox4kolgg)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How can you not be romantic about UNIX domain sockets?","url":"https://daily.dev/posts/how-can-you-not-be-romantic-about-unix-domain-sockets--sox4kolgg","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-can-you-not-be-romantic-about-unix-domain-sockets--sox4kolgg"},"datePublished":"2026-09-14T20:31:44.327Z","dateModified":"2026-09-14T20:54:04.248Z","description":"A DEFCON 34 speaker traces a demo crash in an iOS-based SSH/VM project down to a 40-year-old logic bug in the BSD/XNU kernel's uipc_sense() function. Because...","image":"https://media.daily.dev/image/upload/s--qPvKM23u--/f_auto/v1722860399/public/Placeholder%2009","thumbnailUrl":"https://media.daily.dev/image/upload/s--qPvKM23u--/f_auto/v1722860399/public/Placeholder%2009","isAccessibleForFree":true,"articleSection":"Lobsters","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Lobsters","logo":"https://media.daily.dev/image/upload/s--tl8v_Fku--/f_auto,t_logo/v1698841318/logos/lobste.jpg","url":"https://daily.dev/sources/lobsters"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-can-you-not-be-romantic-about-unix-domain-sockets--sox4kolgg","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"ios,reverse-engineering,kernel-development","timeRequired":"PT11M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Lobsters","item":"https://daily.dev/sources/lobsters"},{"@type":"ListItem","position":3,"name":"How can you not be romantic about UNIX domain sockets?"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/how-can-you-not-be-romantic-about-unix-domain-sockets--sox4kolgg#faq","mainEntity":[{"@type":"Question","name":"Why does fstat() on a UNIX domain socket sometimes return a different inode number on the second call after a fresh boot?","acceptedAnswer":{"@type":"Answer","text":"The XNU kernel's uipc_sense() function uses unp_ino++ instead of ++unp_ino to lazily assign a socket inode, so the very first fstat() call on any UNIX domain socket on a freshly booted system receives inode 0. Since 0 is treated as the sentinel for 'uninitialized', the next fstat() call on that same socket reassigns it a different, nonzero inode, breaking the assumption that inodes stay stable across calls. Kernel-level quirks like this inode mismatch are exactly the kind of edge case developers track down on daily.dev."}},{"@type":"Question","name":"How old is the UNIX domain socket inode bug found in the XNU kernel?","acceptedAnswer":{"@type":"Answer","text":"The faulty unp_ino++ post-increment logic traces back to a May 28, 1985 4.3BSD commit that first added fake inode numbers for UNIX domain sockets, with the inode-consistency logic finalized in a December 20, 1985 commit. The same flawed logic persisted essentially unchanged through NeXTSTEP, the original 2001 XNU release in Mac OS X 10.0, and into modern iOS and macOS. Long-lived kernel bugs like this one are the sort of deep-dive developers follow on daily.dev."}}]}
```

