← Back to Pull requests

Implement accept4 #2779

Open
emkey1 opened this pull request with 23 lines diff across 3 files
View on GitHub
emkey1 emkey1 commented on Jul 29, 2026 21:42 UTC
Author

accept4 is wired to syscall_stub, so it returns ENOSYS.

Go's net package uses it for every accepted connection, which is what #1889 and #2553 both report:

accept tcp [::]:9999: accept4: function not implemented

Go has no fallback to plain accept, so a Go server fails on its first connection.

What it does

accept plus two flags that apply to the accepted fd: SOCK_CLOEXEC sets FD_CLOEXEC on it and SOCK_NONBLOCK sets O_NONBLOCK on it, neither touching the listener. Any other flag is EINVAL. The socketcall entry is filled in to match.

Verification

Same static i386 binary run on real Linux and on iSH, over a loopback TCP connection:

| | before | after / real Linux |
|---|---|---|
| accept4(flags=0) | ENOSYS | connected fd |
| SOCK_CLOEXEC sets FD_CLOEXEC | ENOSYS | set |
| listener FD_CLOEXEC untouched | ok | ok |
| SOCK_NONBLOCK sets O_NONBLOCK | ENOSYS | set |
| nonblocking accepted fd reads | ENOSYS | EAGAIN |
| peer address filled in | ENOSYS | AF_INET |
| bogus flags | ENOSYS | EINVAL |

Reproduced on the Alpine 3.19.0 rootfs the App Store build downloads (ROOTFS_URL in app/iSH.xcconfig), against master 7864dd60.

python3 from the mirrored 3.19 repo also reaches this path: CPython calls accept4(SOCK_CLOEXEC) on Linux, and the log shows stub syscall 364 on each accept. CPython does fall back to plain accept() on ENOSYS, so it keeps working; the difference from Go is the fallback, not the call.

Diff: 23 lines (+21 / -2) across 3 files Reviewer: tjkilgore93-stack Review duration: 183696m
All Vouch review confidence checks passed
Residual risk 0.10 = Change Risk (0.32) × (1 − Review Confidence (0.70)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.32 · 23 lines diff across 3 files
0.32
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.58 · 4 substantive comment(s)
0.58
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
69%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.190
Real PR Conversation Timeline
6 items
hyperion-cs hyperion-cs commented on Nov 08, 2026 08:15 UTC
Contributor

This is a real problem that deserves attention. Among other things, it breaks the network operations for golang binaries via ish.
By the way, a similar PR already exists.

tjkilgore93-stack tjkilgore93-stack approved these changes on Nov 09, 2026 12:44 UTC
Approved Reviewer

Approved these changes.

FRLP FRLP commented on Nov 13, 2026 00:02 UTC
Contributor

This is a real problem that deserves attention. Among other things, it breaks the network operations for golang binaries via ish.

By the way, a similar PR already exists.

Thanks for pointing that out! I appreciate it.

emkey1 emkey1 commented on Nov 25, 2026 21:06 UTC
Author

Thanks. #2752 is earlier and fixes the socketcall path the same way. This one also maps the direct syscall (364), which #2752 leaves as a stub. Either is fine by me; if #2752 goes in, I'll close this one.

FRLP FRLP commented on Nov 26, 2026 15:40 UTC
Contributor

Thanks for the clarification! Since your PR also handles the direct syscall (364), it seems to cover a bit more than mine. I’m fine with either approach, so if yours is preferred, feel free to go ahead with it. I’ll close #2752 if yours gets merged.

Assignees
emkey1 emkey1
Labels
risk: low confidence: 69.7% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 31.9% (LOW) · Higher = larger blast radius
31.9%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 69.7% · Lower = rushed or shallow review
69.7%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 9.7% · Safe to merge
9.7%
Repository