FreeBSD Status Report
Report Entry
Adopt -fbounds-safety in the FreeBSD Kernel TCP/IP Stack
Links:
Wiki page URL: https://wiki.freebsd.org/BoundsSafety
Project page URL: https://freebsdfoundation.org/project/adopt-fbounds-safety-in-the-freebsd-kernel-tcp-ip-stack/
Contact: Abhijeet Sharma <abhijeetsharma2002@gmail.com>
Clang’s -fbounds-safety lets C code state a buffer’s length, as in __counted_by(len).
The compiler then checks accesses through that pointer.
An out-of-bounds access traps instead of corrupting memory.
The TCP/IP stack parses untrusted network input, so it is a good place to start.
This project adds the macros and build support, then converts TCP files one at a time.
Without the flag the annotations expand to nothing.
The tree still builds with the base system compiler and with GCC.
This quarter
-
External toolchain builds GENERIC on amd64, recipe on the wiki.
-
Macros, build knob and soft traps posted, four reviews accepted.
-
tcp_ecn.cruns checked, kernel boots and passes netinet tests. -
mbuf accessor RFC on arch@ and net@, discussion ongoing.
Sponsor: The FreeBSD Foundation
Last modified on: October 6, 2026 by Abhijeet Sharma