Hasty Briefsbeta

A Struct Sockaddr Sequel

4 days ago
  • #kernel
  • #memory-safety
  • #networking
  • The struct sockaddr is traditionally defined with a fixed-size sa_data field, which is now insufficient for modern network addresses.
  • Attempts to redefine sa_data as a flexible array member caused compiler warnings due to struct sockaddr being embedded in other structures.
  • A new struct sockaddr_unsized is introduced for internal use where the size of sa_data needs to be flexible but known.
  • The networking subsystem is being updated to use struct sockaddr_unsized, allowing struct sockaddr to revert to its classic definition.
  • Future work may include adding bounds checking for sockaddr_unsized structures, possibly with an sa_data_len field.
  • The kernel's large amount of C code necessitates incremental improvements to memory safety, despite the availability of Rust.