December 7, 2025

Sock wars: return of the overflow

A Struct Sockaddr Sequel

Ancient ‘sock’ code triggers warning flood as devs feud

TLDR: Linux devs propose a flexible new “unsized” socket address to fix a decades-old size limit without drowning builds in warnings. Commenters split between safety-first supporters and anti-bloat skeptics, swapping sock memes while debating speed, memory, and why 14 bytes still haunts modern code.

The Linux crowd is back at it, arguing over a piece of 1980s baggage with a cutesy name: the kernel’s “sockaddr” — the tiny address box that only holds 14 bytes. When devs tried to make it truly flexible, the compiler unleashed a warning tsunami, and suddenly the thread turned into popcorn time. Some commenters joked that kernel folks would “rather risk a hole in the sock than hear the smoke alarm,” while others cheered the push for safer code. The star of this sequel? A new “unsized sock” that stretches only when the code says so — no more guessing games.

In human-speak: the proposed fix swaps the old box for a smarter one that fits what you actually need, avoiding both memory bloat and compiler meltdowns. Safety fans on LWN and the mailing list love it: no more reading past the edge. Minimalists grumble: just use the big box everywhere and move on. Purists clap back: that wastes memory — “we’re not stuffing the entire closet for one pair of socks.”

Meanwhile, memes abound: “Sockpocalypse,” “lint-roller for warnings,” and “time-capsule coding.” Nostalgia heads defend the old ways; modernizers say: patch it, ship it, and stop tripping over 14 bytes. The drama? Cozy. The stakes? Very real.

Key Points

  • KSPP seeks bounds-checking for all array references, including flexible arrays, and has worked on this for ten years.
  • Legacy struct sockaddr’s 14-byte sa_data is inadequate, leading to unsafe practices where it’s treated as a flexible array.
  • A broad shift to struct sockaddr_storage helped accommodate larger addresses but didn’t solve all embedding issues.
  • Redefining sa_data as a flexible array in struct sockaddr caused massive compiler warnings due to embedded usage.
  • Kees Cook proposes struct sockaddr_unsized for internal interfaces with explicit length (e.g., bind), aiming to stop overreads without structure bloat.

Hottest takes

“Fourteen bytes was cute in 1983; today it’s a landmine” — nostalgiaBSD
“I’ll take a thousand warnings over one silent overflow” — warn_me_bro
“We’re stuffing a mansion into a studio apartment and arguing about the paint” — memelord_ops
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.
A Struct Sockaddr Sequel - Weaving News | Weaving News