Operating systems

Why OpenBSD stands alone

Written by FlyWithMe (a SimpleX Chat user). Inspired by why-openbsd.rocks -

This article explains why OpenBSD is one of the most secure operating systems in the world, and why Windows, macOS, iOS, Android, and Linux are still weaker even when hardened. It also compares OpenBSD with other BSDs, Qubes OS, Fedora Secureblue, and Hardened Gentoo.

For readers interested in discussing OpenBSD, there is also an independent OpenBSD group on SimpleX Chat. It is not directly related to this website, although its administrators are the same.

As the Fedora Secureblue developers themselves say:

Secureblue is for those whose first priority is using Linux, and second priority is security. secureblue does not claim to be the most secure option available on the desktop. We are limited in that regard by the current state of desktop Linux standardization, tooling, and upstream security development. What we aim for instead is to be the most secure option for those who already intend to use Linux. As such, if security is your first priority, secureblue may not be the best option for you.

  • Linux is limited, and it will never be truly secure in its current model. It was not built for that goal.

Philosophy

OpenBSD believes in strong security. Our aspiration is to be NUMBER ONE in the industry for security (if we are not already there). Our open software development model permits us to take a more uncompromising view towards increased security than most vendors are able to. We can make changes the vendors would not make.

  • This is different from most operating systems, which were not created with the goal of being the most secure. The Linux kernel was not designed around extreme security from the beginning, and old design choices still affect it. A few Linux distributions aim for security, but they do not rewrite the operating system from scratch; they mostly harden user space and parts of the kernel. That is useful, but it does not match OpenBSD, or the BSD family in general.

Library order randomization

In rc(8), libc.so, libcrypto, and ld.so are relinked on startup, so their objects are placed in a random order at boot. This makes return-oriented programming and similar attacks harder, because symbol locations are no longer predictable in the same way.

  • Linux randomizes base addresses, but it does not relink or reorder internal libc symbols at each boot. Internal offsets and gadgets in the same build can remain predictable across machines or boots, so a small infoleak can be enough to locate useful gadgets.

arc4random(3)

OpenBSD has its own cryptographic random number interface. When random input is needed, arc4random is the standard choice across the base system. It is an abstraction over ciphers considered safe today, currently using ChaCha20. The name comes from ARC4, the RC4-based generator of the original 1996 implementation, not from a backronym. It needs no file descriptor, cannot fail, and stays safe after fork, chroot and pledge, and it quickly generates high-quality 32-bit pseudorandom numbers.

  • glibc has exported arc4random(3) since 2.36, but that is only a function available to programs; no Linux distribution makes it the system-wide random interface, and Linux code still uses getrandom(2), /dev/urandom or OpenSSL's RAND_bytes. OpenBSD's base system uses one API with one code path.

First in security implementations

  • The first operating system to integrate post-quantum encryption by default (since April 2022, OpenSSH).
  • The first widely used operating system to provide ASLR by default.
  • The first free operating system to provide an IPSec stack.
  • The first widely used operating system to enable PIE globally by default.
  • The first operating system to enable stack protector system-wide by default.
  • First complete integration and adoption of IPv6, starting Jan 6, 1999. Almost fully operational Jun 6, 1999 during the first OpenBSD hackathon.
  • First mainstream OS to ship execute-only userland text by default.
  • First to pin every system call entry per binary.
  • First to make static address-space permissions immutable by default.
  • First with an SROP mitigation enabled by default.

With OpenBSD, you consistently get major security implementations earlier than on other operating systems.

Camera and audio recording

For privacy reasons, the OpenBSD team disabled camera and audio recording for all devices by default in the kernel. This can be toggled on and off with a simple sysctl change, without rebooting.

Chrooted web server by default

By default, HTTP daemons are chrooted in /var/www. As an OpenBSD system administrator, you do not need extra setup to run a secure web server installation. The base httpd(8) does this out of the box; packaged servers such as apache2 or nginx need it configured, so do not assume the same default there.

cron(8)

OpenBSD's cron(8) daemon can randomize values (~) and prevent multiple jobs from running concurrently (-s). Preventing conflicts avoids race conditions, simultaneous access to shared resources, and overload caused by multiple instances, reducing the risk of data corruption and load spikes. Randomization reduces synchronized peaks (the thundering herd problem) and makes it difficult for attackers to predict execution windows.

  • This can be configured in Linux through systemd (strongly opposed to systemd.), but it does not come enabled by default.

security(8)

OpenBSD includes security(8), a script run by daily(8) that checks for signs of common security weaknesses and mails any output to root. Its checks cover account databases, root's login environment, home and dotfile permissions, changes to files in /etc/changelist, mounted-disk labels and partition tables, package changes, and selected network configuration permissions.

The manual calls security(8) an aid, not complete protection. It moves obvious weaknesses and unexpected changes into routine administration, provided someone reviews the daily reports and maintains the monitored file list.

Defined integer overflows

On OpenBSD, Clang, the default compiler on most architectures, has the -fwrapv flag enabled by default. GCC also does not include -fstrict-overflow in the -O2 optimization option. This tells the compiler to treat signed integer overflows as defined, preventing optimizations that remove security-critical overflow checks. This is another example of sane defaults.

Execute-only memory

OpenBSD maps userland text without read permission. The linker option --execute-only is on by default, and on architectures where the MMU cannot enforce this, the kernel refuses to read the program's text through copyin/copyinst. Coverage as of 8.0: arm64, riscv64, hppa, amd64, powerpc64, powerpc (G5) and octeon. sparc64 is unfinished.

ROP and JIT-spray attacks need to find gadgets, and the easiest way is to read the program's own text through an information leak. If text is not readable, the attacker must guess addresses or find another leak. The kernel-side rule also removes the kernel as a read primitive against text. Threat model: a remote attacker with an infoleak and a control-flow hijack, and a local attacker reading process memory.

  • No mainstream OS ships execute-only userland text by default. Linux cannot do it on x86, where a readable mapping is implied by the page tables, and distributions do not build with execute-only text elsewhere. Windows and macOS have no project-wide equivalent. This is one of the clearest OpenBSD-only properties.

doas(1)

OpenBSD does not use sudo, so it created "doas." doas replaced sudo because of sudo's security flaws and large, complex codebase. doas is easy to configure and use, and it covers most use cases. Its source code is small and elegant.

This is an example of a fully hardened doas.conf configuration:

permit <user> as root
permit root

Compare this with the simplest sudo configuration and you will see the difference.

  • Using doas on Linux is possible, but many programs and package installers assume sudo, so an alias or wrapper is needed. Fedora Secureblue removed suid-root, sudo, su, and pkexec to use run0, reinforcing my argument about sudo insecurity.

freezero(3)

OpenBSD's libc ships a small set of memory-hygiene primitives: freezero(3) wipes and frees, explicit_bzero(3) wipes, timingsafe_bcmp(3) and timingsafe_memcmp(3) compare without early exit. The base system can rely on them without adding a library, so less attack surface.

  • glibc has explicit_bzero(3) since 2.25, and C23 adds memset_explicit, but it has no freezero(3) and no timingsafe_* in libc; libbsd provides those on Linux.

fork+exec in privilege-separated programs

OpenBSD privilege-separated daemons start their children with fork plus exec, not fork alone. Each child therefore gets a fresh address space: a new ASLR layout, a new stack canary, new .openbsd.randomdata values. First used in sshd in 2004, then bgpd in 2015, smtpd in 2016, and most base daemons since.

Classic privilege separation keeps the same memory layout in every child, because they are copies of one process. One infoleak in the unprivileged child then reveals the layout used by the privileged parent and by every sibling, which is exactly what an attacker needs to turn a leak into a full exploit. With re-exec, a leak in one process says nothing about the others. Threat model: an attacker who compromises the unprivileged half of a daemon and wants to attack the privileged half.

  • OpenSSH does this on every OS because it is the same upstream code, and some individual daemons elsewhere re-exec. It is not a system-wide rule on Linux, where many privsep designs still fork without exec and share the layout. Windows services are separate processes, which gives a similar boundary for different reasons.

httpd(8)

OpenBSD includes httpd(8) in the base system. It is not based on Apache: it was written from scratch by OpenBSD developers with a small codebase and security-first design.

OpenBSD 8.0 random-relinks httpd(8) at boot: its object files are linked in a random order, so internal layout changes every boot and a leaked address is worth less. The default TLS cipher set is now "secure", and httpd rejects CL.TE request framing and obs-fold, which closes request-smuggling differentials.

relayd(8)

relayd(8) is OpenBSD's relay and application-layer proxy daemon. It provides reverse proxying, load balancing, health checks, and TLS handling with a compact configuration model that integrates well with the rest of the base networking stack. OpenBSD 8.0 changed the default TLS cipher set in relayd.conf from "HIGH:!aNULL" to "secure".

smtpd(8)

smtpd(8), from the OpenSMTPD project, is OpenBSD's native mail daemon in base. It was developed by OpenBSD contributors with a focus on simplicity, secure defaults, and robust privilege separation.

OpenBSD 8.0 also random-relinks smtpd(8) at boot. The daemon is split into six separate binaries and each is relinked independently, so a leak in one process says little about the others.

KARL

At every install, upgrade, and boot, OpenBSD generates a new kernel with randomized addresses. A unique and unpredictable kernel is a real security improvement. This technique is called Kernel Address Randomized Link (KARL), and combined with library order randomization, it is one of OpenBSD's strongest ideas.

OpenBSD 8.0 also raised the amd64 kernel virtual address space from 4G to 512G and placed the pmap direct map at a random location, which adds kernel memory layout randomization beyond KARL.

  • macOS, Windows, and Linux have KASLR (kernel base address randomization), but not KARL. KARL is the stronger design.

Kernel & Userland

The kernel and userland in OpenBSD, as in the BSD family generally, are developed together. The same project that introduces kernel features also controls the base userland, so new security ideas can be applied consistently across the OS. pledge, unveil, and arc4random are good examples.

  • The Linux kernel and the GNU Core Utilities, or musl/BusyBox on non-GNU systems, are developed independently. That makes it much harder to introduce something like pledge, or even a consistent SELinux/AppArmor approach, across all base tools. This lack of unity makes Linux security fragmented. macOS and Windows have more unified development, but they tend to prioritize features and compatibility, especially Windows with its heavy legacy burden.
  • Windows, macOS, and BSDs do not have this problem. Linux falls behind here.

LibreSSL

The bloated and difficult OpenSSL codebase was forked after Heartbleed. LibreSSL cleaned up, improved, and documented large parts of that code. It added modern cryptography such as FRP256v1, RFC 5639 EC Brainpool, ChaCha20, and Poly1305, while remaining API-compatible with OpenSSL without carrying the same level of complexity. It is actively developed by OpenBSD developers.

  • Nowadays, macOS OpenSSL uses LibreSSL code.

openrsync(1)

openrsync is OpenBSD's BSD-licensed implementation of rsync. It synchronizes local and remote files and is compatible with rsync protocol version 27.

It is a clean-room, ISC-licensed implementation written by Kristaps Dzonsons. It began as part of rpki-client(8), which needed to retrieve RPKI repository data using the rsync protocol, and was imported into OpenBSD in 2019. This gave the base system an implementation under OpenBSD's direct integration, audit, and maintenance process and its preferred license, without importing the original GPL rsync code.

openrsync deliberately implements a smaller interface. The current openrsync(1) manual page defines its supported option set and compatibility with rsync protocol version 27. Its target is deliberately narrower than a complete replacement. OpenBSD's source tree also contains detailed descriptions of the rsync protocol and daemon handshake. These specifications let reviewers compare the implementation with documented wire behavior instead of treating the original program as the protocol's only description.

The strongest reason to prefer openrsync on OpenBSD, when its feature set is sufficient, is its use of native sandboxing. The current main.c uses pledge(2) to limit system operations and tightens the promises after network setup. On the receiving side, receiver.c applies unveil(2) around the source paths and destination root. In server mode, server.c seeds the protocol's MD4 hashes with arc4random(3) instead of the time of day.

The reduced option surface leaves less legacy behavior to understand and test, while the sandbox limits what a bug can reach. The available evidence does not establish that openrsync has fewer vulnerabilities than rsync. It is not a drop-in replacement for workflows that need newer protocols or unsupported options, and its ordinary client and server roles are not a separate privilege-separation design.

License

You are free to use the operating system however you want, including for business, under ISC or Berkeley-style licenses. By project policy, GPL code is not acceptable for new additions. The BSD license is freer than the GPL, which places more restrictions on code use.

This licensing culture also helps protect the project from corporate capture and internal pressure. Linux has spent years pulled between community goals and large corporate interests, especially from companies such as IBM that want Linux shaped for enterprise platforms. That pressure damages the Unix philosophy.

A license as permissive as BSD allows companies to use, close, distribute, and resell OpenBSD code. I see that freedom as a strength, not a weakness, because it keeps the project simple and avoids the ideological battles that often surround copyleft licensing.

  • The Linux and GNU world is built heavily around the GPL. In a perfect world, where open-source programmers and huge companies had aligned incentives, that would be ideal. We do not live in that world. macOS and Windows are proprietary, while OpenBSD is fully open source.

Malloc leak detection

Leak detection is built into libc, not bolted on. MALLOC_OPTIONS=D, or the vm.malloc_conf sysctl system-wide, makes malloc record every live allocation and dump a leak report through utrace(2) at exit; ktrace and kdump turn it into a readable list with call sites. The same sysctl enables guard pages, canaries, free checking and use-after-free protection for the whole system without rebuilding anything.

  • Linux, macOS, and Windows have tools in their ecosystems for this, but none are integrated into the operating system by default.

mimmutable(2)

A process can make the permissions of a memory region permanent. After mimmutable(2), mmap(2), mprotect(2) and munmap(2) on that region fail with EPERM. The mechanism landed in December 2022 and shipped in OpenBSD 7.3; most of a program's static address space, including the main binary, ld.so, the main stack, load-time libraries and dlopen'ed libraries, is made immutable automatically. Code that needs mutable data can opt out with the openbsd.mutable section, and heap objects can be sealed with mimmutable(2).

The standard exploit step after a memory-corruption bug is to change permissions: flip a region to writable and executable for shellcode, or make read-only data writable to overwrite a function pointer or a relocation entry. If the kernel refuses the permission change, that step disappears. The attacker must work inside the permissions the region already has. Threat model: an attacker with an arbitrary write primitive or with the ability to call mprotect inside a compromised process.

  • Linux 6.10 (2024) added mseal(2), which is close in effect, but it is opt-in per mapping and no distribution applies it by default. Windows and macOS have no equivalent. OpenBSD applies it to the static address space of every program without the program asking.

Documentation - manpages

There is probably no operating system documented more thoroughly than OpenBSD. Every binary, library, driver, or script delivered in the base system has its own man page. The OpenBSD project treats missing documentation for any system function as a bug.

  • Linux documentation is fragmented by comparison, which leaves many users with major knowledge gaps and leads to configuration errors. That weakens security in practice. Community projects such as the Arch Wiki partly compensate for this gap.

Linux still falls short here.

Meltdown and Spectre

To mitigate Meltdown and Spectre, OpenBSD disables hyper-threading by default, citing security concerns, including Spectre-style concerns, with the "hw.blockcpu" sysctl. The default is "SL": SMT siblings and the slowest cores are removed from the scheduler. The older hw.smt sysctl is deprecated and only follows the S bit.

  • Qubes OS also disables SMT by default (Xen smt=off since Qubes 4.0, see QSB-043), and Fedora Secureblue, inspired by OpenBSD, does the same.

Memory allocation randomization

All those OSes (Windows, Linux, macOS, Android, etc.) provide malloc implementations, but OpenBSD's malloc is widely regarded as one of the most security-focused and well-audited defaults.

  • GrapheneOS's hardened_malloc is heavily inspired by OpenBSD's design and offers stronger hardening than typical Linux defaults. Fedora Secureblue uses hardened_malloc globally. But as the GrapheneOS devs themselves said:

    The main differences in the design are that it's solely focused on hardening rather than finding bugs

That is, OpenBSD gains a potential advantage by being less likely to have undiscovered bugs that could become security vulnerabilities.

OpenSMTPD

OpenSMTPD was written from scratch by OpenBSD developers. A simple mail daemon was needed for the base system, and there were no suitable alternatives. The goals are simplicity, security, and reliability under an acceptable license (ISC).

  • OpenSMTPD has a portable version available in several Linux distributions, but it is not included by default in any of them.

OpenSSH

The most popular OpenBSD software is probably OpenSSH. It is the SSH standard used worldwide and is native in all BSDs, macOS, and even Windows/Windows Server. From routers and switches to cloud services and hosting, OpenSSH is everywhere. Hybrid post-quantum key exchange has been the default since OpenSSH 9.0 in April 2022. OpenSSH 10.0 (April 2025) moved the default to mlkem768x25519-sha256, the NIST-standard ML-KEM, and removed DSA. OpenSSH 10.6, shipped in OpenBSD 8.0, adds experimental ML-DSA-44 plus Ed25519 composite signatures and disables the LZ77 compression coder to remove a side channel. In 8.0, libtls also prefers X25519MLKEM768 for TLS 1.3.

OpenSSH 10.0 also split the user authentication phase into a separate sshd-auth binary, so the pre-authentication attack surface has an address space disjoint from the rest of the connection.

Firewall

pf is OpenBSD's firewall. It is simple, feature-rich, and easy to read. It supports variables, lists, and tables. Many commercial firewall appliances are based on it.

  • Linux's iptables and nftables are extremely complex compared to pf, and that complexity can lead even advanced users into dangerous mistakes. That is why frontends such as firewalld and ufw exist. iptables and nftables have difficult, cumbersome syntax; the existence of full professional certification courses just to learn them says a lot.

  • The Windows firewall is weak for advanced control. Users have limited direct control, and most behavior is managed through a restrictive GUI. It can still block malware and unwanted traffic, but it is not pleasant for serious administration.

  • I rate the macOS firewall much more positively: it is safe, simple, and user-controlled. It is based on OpenBSD's pf.

  • The NetBSD firewall, npf, is also very good. Its syntax is similar to pf, though a little more complex.

  • FreeBSD has three firewalls, which is messy, but one of them is pf. FreeBSD's pf has diverged from OpenBSD's pf enough that it feels almost like a fork.

PID randomization

OpenBSD spawns each new process with a random unused PID. This helps protect users from attacks that rely on predicting process IDs.

  • Linux kernel allocates PIDs in a semi-sequential (incremental) way, recycling when it reaches pid_max; it does not randomize them by historical design. The same goes for Windows and macOS.

ping randomness

Both ping(8) and ping6(8) obfuscate transmitted monotonic clock values by offsetting them with a random value. ChaCha streams vary each payload. This helps hide system time from attackers and makes OS detection harder.

  • Neither Windows, Linux, nor macOS has this.

pinsyscalls(2)

ld.so reads a new ELF section, .openbsd.syscalls, which lists the exact address of every system call stub used by the program, and registers those addresses with the kernel using pinsyscalls(2). A system call instruction anywhere else kills the process. Added in January 2024, it replaced the earlier pinsyscall(2) for execve and the msyscall(2) mechanism, which were narrower and more expensive.

A ROP chain or a shellcode stub must execute a system call to do damage. With pinned entries, the attacker cannot place a syscall instruction in writable memory, cannot reuse one from another library, and must land exactly on a registered entry point. Combined with immutable memory permissions, the classic "one gadget, then syscall" path is closed. Threat model: an attacker with a control-flow hijack inside a process.

  • seccomp filters which syscall numbers are allowed, not where the instruction lives, and it does not stop a permitted syscall issued from attacker-controlled memory. No mainstream OS pins syscall entry addresses. OpenBSD is the only one that does it for every base binary.

pledge

pledge lets a program limit its own access to system calls with very little code. That is a huge security improvement. Even if a binary is compromised, its ability to misbehave is sharply reduced. Within only two releases, OpenBSD developers introduced pledge across most base system binaries. Today, all base system binaries must be pledged.

  • Linux has seccomp, which can emulate pledge's syscall-restriction part, but seccomp is low-level, hard to write correctly by hand, and brittle across libc/kernel behavior changes and needs tools (like libseccomp) to avoid mistakes; writing policies for this is error-prone.
  • I do not consider seccomp practically usable for ordinary hardening, and this critique shows why: Seccomp is unsafe at any speed
  • FreeBSD has Capsium (capability-based sandboxing) and Jails (OS-level virtualization), both can provide a stronger sandboxing/isolation than pledge and unveil, but Capsium is not used or configured strictly on almost the entire base system and Jails is just not used at all. In addition, the complexity compared to pledge/unveil are much greater.
  • Windows has no direct pledge analogue. macOS has sandbox_init / Seatbelt, more integrated for GUI apps but more complex for arbitrary CLI programs.

unveil

The unveil system call limits filesystem open calls to a defined set of paths. It extends the idea of pledge: simply limiting programs to open is insufficient, because open is valid for the whole filesystem.

For example, why should a program like passwd(1) have access to your file system beyond /etc/passwd and /etc/shadow? If there is a security bug in passwd, the effects would be more limited.

Browsers such as Firefox, Firefox ESR, Tor Browser, Chromium, and Iridium are limited with unveil and pledge. They can access the Downloads folder and their own system folders, but not arbitrary files elsewhere. That turns the browser into a much tighter container for malware.

For another example: OpenBSD 8.0 also put man(1), makewhatis(8) and man.cgi(8) under unveil, so the documentation tools can no longer read or write arbitrary paths. This is one more example of a base system where unveil is the rule rather than an exception.

  • Linux Landlock, AppArmor, SELinux, Smack: filesystem and broader MAC policies can restrict file access like unveil, but they are configured externally and with a lot of additional complexity, and are disabled or misconfigured in most Linux operating systems (Secureblue and Android are the only exception probably). Linux has no single, simple process-centric API combining easy syscall profiles + built-in per-process filesystem veil like pledge+unveil. Such complexity, something common in the Linux world, only leads to more insecurity.
  • FreeBSD has Capsium (capability-based sandboxing) and Jails (OS-level virtualization), both can provide a stronger sandboxing/isolation than pledge and unveil, but Capsium is not used or configured strictly on almost the entire base system and Jails is just not used at all. In addition, the complexity compared to pledge/unveil are much greater.
  • Windows has no direct unveil analogue, nor does macOS.

Privilege and user separation

OpenBSD runs all of the standard base system daemons with privilege and user separation. These include, for example, bgpd(8), dhclient(8), dhcpd(8), dvmrpd(8), eigrpd(8), file(1), httpd(8), iked(8), ldapd(8), ldpd(8), mountd(8), npppd(8), ntpd(8), ospfd(8), ospf6d(8), pflogd(8), radiusd(8), relayd(8), ripd(8), script(1), smtpd(8), syslogd(8), tcpdump(8), tmux(1), xconsole(1), xdm(1), X server(1), ypldap(8), pkg_add(1), etc.

OpenBSD 8.0 also gave syslogd(8) a separate parent executable for privilege separation.

  • All major OSes support privilege separation and many core services run with reduced privileges, but OpenBSD applies it much more uniformly and as a central design principle for its base system. Linux/macOS/Windows have many tools, but they are all extremely complex and require extra configuration, per-service work, or policy management.
  • A lot of complexity only leads to more problems. In theory, Windows has much stronger privilege separation than Linux and macOS, but it has never proven to be functional and reliable; it is actually the opposite.
  • No Linux distributions other than Secureblue and GrapheneOS have good enough configurations. Linux has many tools, but no one uses them because of such complexity.

Privilege revocation

Related to the work on privilege separation, some programs were refactored to drop privileges while holding onto a tricky resource such as a raw socket, reserved port, or modification-locked bpf(4) descriptor. Examples include ping(8), traceroute(8), etc.

  • Linux distributions commonly solve the same problem with file capabilities, for example cap_net_raw on ping. That works, but the process keeps the capability for its whole lifetime. OpenBSD's model is to open the raw socket, then drop to an unprivileged user and pledge, so the capability is gone before any input is parsed.

MAC addresses randomized

OpenBSD lets you use randomized MAC addresses via ifconfig.

ifconfig iwm0 lladdr random

Randomizing your MAC address improves anonymity while using your laptop in public Wi-Fi or similar networks.

  • Fedora Secureblue, Qubes OS (per NetVM), and Tails have this; Whonix and others don't.

Network configuration without root shell scripts

slaacd(8) (IPv6 autoconfiguration), dhcpleased(8) (DHCP client), rad(8) (router advertisements) and resolvd(8) (nameserver management) replaced the old model where root ran shell scripts over parsed network input, such as netstart and dhclient-script. The daemons are privilege separated and pledged: the privileged part performs the specific ioctl, and parsing happens unprivileged.

On any untrusted network, DHCP and router advertisements are attacker-controlled input. Root shell scripts that consume that input have produced command injection and arbitrary file write bugs across the industry, because shell quoting and environment handling are fragile. Removing the root shell removes the entire vulnerability class, not one instance of it. Threat model: a malicious DHCP server or rogue router on a public or hotel network.

  • Linux commonly still runs dhclient-script, NetworkManager dispatcher scripts or similar hooks as root; systemd-networkd is a daemon but a large one. Windows runs its DHCP client inside a SYSTEM service. OpenBSD's advantage is the combination: small single-purpose daemons, privilege separation, pledge, and no root shell in the path.

rcctl(8)

rcctl is a simple utility for maintaining rc.conf.local, OpenBSD's system daemon configuration database. Compared with systemd or SysVinit, I find rcctl lighter, more stable, more secure, and easier to understand. Systemd, by contrast, behaves almost like a full operating system, with substantial Red Hat-driven complexity.

  • Gentoo and distributions such as Artix, Alpine, and Void have the advantage of avoiding systemd, or SysVinit in some cases. But Qubes OS, Fedora Secureblue, Tails, Whonix, Kicksecure, Arch, NixOS, and many others use it.

recallocarray(3)

recallocarray is a libc function that discards old data before allocating new memory and checks for integer overflow in multiplication.

  • recallocarray(3) is reallocarray(3) plus two guarantees: new memory is zeroed, and the old allocation is discarded with munmap(2) or explicit_bzero(3) before it can be reused. glibc has provided reallocarray(3) since 2.26, and Linux code uses it, but no glibc-based system provides recallocarray(3). FreeBSD imported the OpenBSD version.

Relinking at boot

Random relinking is the next step after address-space randomization. At boot, rc(8) rebuilds selected binaries from object files taken in random order, then installs the result. Internal offsets, function order and the location of every internal branch change, so the binary an attacker studies today is not the binary that runs after the next reboot. Each relink kit in /usr/share/relink contains a test command; rc(8) only installs the new binary if the test exits successfully.

The list is deliberately short and network-facing: sshd(8), sshd-auth(8), sshd-session(8) and ssh-agent(1), plus httpd(8) and smtpd(8) with its six helper binaries (smtpd-ca, smtpd-control, smtpd-dispatcher, smtpd-lka, smtpd-queue and smtpd-scheduler). sshd was first, in 2023. httpd and smtpd followed in OpenBSD 8.0, and the relink rules moved into bsd.prog.mk in 2026. The kernel gets the same treatment through KARL, and libc, libcrypto and ld.so through library order randomization.

An exploitation attempt against a remote daemon usually begins with learning the layout: the address of a function, a gadget, or a pointer into libc. Base-address randomization changes where the binary is loaded, but the relative positions inside the binary stay the same for every copy of that build. Relinking changes those relative positions too, per boot and per daemon. A leak obtained from one boot, or from a different privsep process, does not carry over to the next. In smtpd, each of the six processes is relinked separately, so a hole in one IPC path gives no reliable map of its neighbours. Threat model: a remote attacker with an infoleak or a partial ROP chain against a network daemon, and lateral movement between privilege-separated processes after one is compromised.

  • Linux, Windows and macOS randomize load addresses (ASLR and KASLR), and their binaries are PIE. None of them relinks daemons from object files in random order at boot, so internal offsets remain fixed for a given build and distribution update. Linux historically went the other way with prelink, which fixed layouts to speed up loading. OpenBSD is the only mainstream OS that regenerates its network daemons and its kernel layout at every boot.

OpenBGPD, rpki-client(8) and rtrd(8)

OpenBGPD implements BGP, the protocol through which autonomous systems and large networks exchange routing information. An ISP can use it to learn which networks are reachable through peers and upstream providers, then advertise the prefixes it can reach. That operational role is one concrete reason OpenBSD remains relevant to the Internet's infrastructure.

The rpki-client utility queries the RPKI repository system with openrsync to fetch all X.509 certificates, manifests, and revocation lists under a given Trust Anchor. rpki-client subsequently validates each Route Origin Authorization (ROA) by constructing and verifying a certification path for the certificate associated with the ROA (including checking relevant CRLs). rpki-client produces lists of the Validated ROA Payloads (VRPs) in various formats.

OpenBSD 8.0 added rtrd(8), an RPKI-to-Router cache server that sits between rpki-client(8) and routers. Routers take validated data over RTR instead of each one fetching and validating repositories with rsync. rtrd supports RTR versions 0, 1 and 2, is controlled by rtrctl(8), and can export statistics in OpenMetrics format.

Together, OpenBGPD and rpki-client help operators detect incorrect route-origin announcements, configuration errors, and some forms of route hijacking. RPKI origin validation does not cryptographically validate a complete AS path, and it does not make BGP universally secure. OpenBSD developers also participate in developing and implementing relevant open Internet standards.

OpenBGPD also supports ASPA (Autonomous System Provider Authorization) and validates routes against ASPA data received over RTR version 2, which catches route leaks that origin validation alone cannot.

  • This is an OpenBSD feature. It is available for installation on Linux and macOS, although no Linux distro uses it by default.

Sane & secure defaults

OpenBSD ships with sane, secure defaults in daemons and configurations.

The system is intended to be secure by default, and many of its security features are either missing or optional in other operating systems.

This means you do not have to harden a fresh installation just to run basic services. For example, sshd does not require an extra hardening phase. The same is true for other daemons and base-system components.

  • That is the worst aspect of Linux. Every distribution needs a lot of extra security to be minimally secure enough for you to sleep peacefully. Except for Fedora Secureblue, which already comes with enhanced security by default, although at a much lower level than OpenBSD. Furthermore, hardening done by the average, unprepared user can (and probably will) lead to many problems and perhaps even more security breaches.
  • A secure system by default is necessary, and in the Linux world, Secureblue is the only example of this. There's also GrapheneOS, which is a Linux distribution (although many deny that Android is Linux).

signify(1)

signify is a small, elegant tool for cryptographically signing and verifying files. It was created to sign OpenBSD releases (since OpenBSD 5.5) and binary patches for syspatch. It uses only Ed25519. Think of it as a simpler replacement for PGP signing.

The same applies to packages: when a package is signed, pkg_add uses the appropriate key in /etc/signify to verify the signature and only unpacks/installs if the verification and checksums match. This makes it impossible to download a compromised version of OpenBSD or its binaries, even if the official repository is compromised by the NSA.

Each artifact class has its own key: openbsd-80-base.pub, openbsd-80-fw.pub, openbsd-80-pkg.pub and openbsd-80-syspatch.pub. A key that signs packages cannot sign a kernel, so a compromise is contained to one class of artifact.

  • Linux has GnuPG/OpenPGP. But signify has a more defensive position against common attack modes in GnuPG/OpenPGP, such as a lower likelihood of confusion involving multiple keys, subkeys, expired certificates, and legacy formats. Ed25519 also has an API and resistance to usage errors that are better than those of the historical OpenPGP ecosystem. Fedora is the best distro in this regard; it handles OpenPGP well.
  • GnuPG/OpenPGP is large and complex; signify is simple and secure by default on OpenBSD.
  • Signify is available for installation on Linux and macOS.

SROP mitigation

sigreturn(2) loads a complete register set from a frame on the stack. OpenBSD only accepts it when it comes from the signal trampoline context that the kernel itself set up; anywhere else, the process is killed. Implemented in 2016 and enabled by default since OpenBSD 6.0.

SROP (sigreturn-oriented programming) turns a single call to sigreturn into a Turing-complete primitive: the attacker writes a fake signal frame and controls every register without needing a gadget chain. Killing off-context sigreturn removes the primitive entirely, so the attacker is back to needing real gadgets. Threat model: an attacker with a stack write and one controllable syscall.

  • No mainstream OS enforces this by default. The original research by Bosman and Bos targeted Linux, where sigreturn remains usable from attacker-controlled frames.

Stack

Aggressive randomization of the stack location has been used since version 7.3 (2023). This puts the stack at a random location in the upper 1/4th of the userland virtual address space, providing up to 26 additional bits of randomness in the address. This aggressive randomization of the stack location is for all 64-bit architectures except alpha. This should make it harder for an attacker to find the stack.

  • It is possible, through patches like PaX/grsecurity, to reinforce the security of the Linux kernel in this regard, but this requires manual intervention and is not like in OpenBSD, not even by default (does Fedora Secureblue have something like that? I know they use a hardened Linux kernel).

stack-register checking

A memory object should have the fewest permissions possible: typically read, write and execute. OpenBSD introduced a new permission flag known as stack. If you want to use memory as a stack, you must mmap it with that flag bit. When a system call happens, we check to see if the stack-pointer register points to such a page. If not, the program is killed. The ABI is tighter as a result. You may no longer point your stack register at non-stack memory, or your program will die.

  • macOS, Windows, and Linux: No.

Swap encryption by default

This protects sensitive information, such as passwords, from leaking to disk where it can persist for years.

  • Linux supports this (it must be done manually), but only Fedora Secureblue has it by default.
  • GrapheneOS seems to have that, but it's more dynamic.
  • macOS swap and sleep image are encrypted when FileVault (full-disk encryption) is enabled. I rate Windows BitLocker poorly for reliability.

Syscall origin verification

The kernel checks whether a syscall is executed from the address space of its corresponding process. If not, the process is killed. This helps prevent attackers from using uploaded exploit code with raw system call sequences.

  • Linux, Windows, and macOS: No.

trapsleds and -fret-clean

trapsleds (2017) rewrites incidental NOP padding in the instruction stream into trap instructions, and the compiler re-encodes instruction sequences to avoid embedded polymorphic RET bytes (2018). -fret-clean, a clang extension, wipes the return value off the stack after a call, removing a common leak of pointers into other shared objects. The kernel, libc, libcrypto and ld.so are built with it on amd64.

Every exploit chain spends effort on two things: finding gadgets and leaking addresses. Alignment padding is a free source of gadgets, and stale return values are a free source of pointers that defeat ASLR. Removing both raises the cost of writing a reliable exploit and shrinks the value of a small infoleak. Threat model: a remote attacker building a ROP chain against a base daemon, and a local attacker defeating ASLR with a stack leak.

  • No Linux distribution converts NOP padding into traps or builds with -fret-clean. The closest analogue is -fzero-call-used-regs (GCC 11, Clang 13), which zeroes registers rather than the return slot; the Linux kernel can be built with it, but distributions do not enable it by default.

unwind(8) validating DNS resolver

unwind is a validating DNS resolver. It is designed for client machines such as workstations or laptops and listens only on localhost. It queries nameservers directly and switches to resolvers learned from dhclient(8) if local networks block DNS queries. It periodically checks whether DNS is still blocked and switches back when possible. I use it to maximize privacy by keeping DNS resolution local.

  • Fedora Secureblue uses unbound, which also comes by default in OpenBSD but is more complex and unnecessary in most cases; a simple unwind configuration may require several lines in unbound.

W^X Memory

Since 2003, memory on OpenBSD can be writable or executable, but not both. This is a major security feature that helps prevent attackers from executing injected payloads through memory-corruption bugs.

The rule is enforced strictly since OpenBSD 6.0. The only exception is explicit: a binary marked PT_OPENBSD_WXNEEDED may break W^X, and only when stored on a filesystem mounted with the wxallowed option. Browsers and other JIT users need this; everything else does not get the exception.

  • Linux, Windows, and macOS don't have this as a global kernel policy; some Linux distributions and architectures apply NX/UEP and mitigations, but W^X by process is not enforced as in OpenBSD.

WireGuard

OpenBSD has an in-kernel driver for WireGuard VPN communication. Including WireGuard in the kernel improves performance and makes it easy to use from the OpenBSD base system.

WireGuard® is an extremely simple yet fast and modern VPN that utilizes state-of-the-art cryptography.

With this, you can do a base offline installation of OpenBSD and set up a good VPN such as Mullvad or IVPN right away. Both officially support WireGuard.

  • WireGuard is integrated into the OpenBSD kernel. Linux, Windows, and macOS have WireGuard support, but not in this OpenBSD-style base system form.

file(1)

file(1) is sandboxed and runs as the _file user. Imagine downloading a random file from the internet and analyzing it with file. If file had a local code execution bug and the downloaded file was crafted to exploit it, that bug could become dangerous. OpenBSD reduces this risk by privilege separation: the parent opens the file and passes the descriptor to a child that runs as user _file and pledges "stdio recvfd", so the parsing code cannot open any path at all. There is no chroot; the child simply has no filesystem access beyond the descriptors it was handed.

  • Linux and macOS ship file(1) as an ordinary unsandboxed program. This design is unique to OpenBSD.

vmm(4) - hardened hypervisor

Theo de Raadt has long criticized virtual machines and their security model, arguing that the hypervisor is often the weakest and easiest point to exploit. OpenBSD still created its own hypervisor, but with a focus on security and a small attack surface rather than feature count. That means losing many VM features, including:

  • Graphics
  • Snapshots
  • Hardware passthrough
  • Live migration across hosts
  • Live hardware change

Supported guest operating systems are currently limited to OpenBSD and Linux. Because there is no VGA support yet, the guest OS must support a serial console. A graphical interface is still possible with tools such as Xephyr and vncviewer

The native stack implements this narrow scope by separating the vmm(4) kernel monitor, the vmd(8) userland daemon, and the vmctl(8) client. Device emulation stays primarily in userland, and vmd creates a separate VM process for each guest instead of putting every guest's device parsers directly in the host kernel.

Dave Voutila's paper on hardening vmd's emulated devices identifies the threat: emulators consume attacker-controlled guest data and are a recurring source of VM escapes. vmd uses fork-and-exec privilege separation, dedicated process roles, reduced user and group IDs, filesystem restrictions, and pledge(2). OpenBSD 7.4 then introduced a multiprocess model for emulated VirtIO block and network devices, adding another boundary between a compromised device emulator and the rest of vmd(8) or other device code.

The missing features reduce the emulation, passthrough, and migration paths that OpenBSD must maintain and expose. OpenBSD's advantage is direct project control over this compact stack and consistent process isolation throughout userland device emulation.

The following cloc counts describe the hypervisor implementations themselves, not the complete virtualization stack: Xen is about 650,000 lines of code; KVM is about 83,500 lines for x86 only and 217,700 lines across all architectures; bhyve is about 80,000 lines; NOVA is about 24,000 lines; and OpenBSD's vmm(4) is about 9,950 lines, including its SEV support. This is why vmm's deliberately restricted design matters: a smaller implementation leaves less hypervisor code to audit and less code that can contain an escape.

The hypervisor alone is not the whole virtualization attack surface. OpenBSD's stack adds about 16,600 lines of guest-reachable vmd(8) emulation and run-path code, for an approximately 26,600-line host attack surface. Local management and provisioning (configuration, control socket, logging, SNMP, SEV setup) adds about 6,500 lines and is not reachable from a guest. Linux/KVM deployments also include QEMU (if used) and their surrounding management and device-emulation components. Depending on the boundary being measured, Qubes OS also includes dom0, toolstack and AppVM infrastructure, while CPU firmware related to virtualization belongs to the broader virtualization attack surface. External compartmentalization is useful when upstream software cannot practically be modified, but it does not eliminate attack surface.

  • QEMU/KVM, Xen, Hyper-V, VMware, VirtualBox, and other hypervisors were not built from scratch with security as the first priority. VM management can also be weakened by the surrounding operating system, including components such as systemd.
  • The NOVA microhypervisor is also focused on security and it's probably more secure than the virtualization stack on OpenBSD as a whole, but vmm hypervisor has less attack surface.
  • Hardware passthrough greatly increases the attack surface. Additional hardware technology (such as IOMMU) is required for minimum security.

That makes vmm the hypervisor I trust most. QEMU/KVM, Xen, VMware, VirtualBox, and other general-purpose hypervisors carry far more code and functionality and are unreliable as security boundaries without extensive hardening. Even systemd enlarges the host attack surface in a virtualization deployment.

X server without root permissions and xenodm: the secure X Display manager

OpenBSD developers have worked hard to enable the non-root execution of an X server. Since 2014, X no longer requires special privileges: it runs as the _x11 user and is not setuid, so it can be run as a regular user rather than root. OpenBSD has its own soft fork of the X.Org server called Xenocara, designed to enhance security. In addition, remote X11 connections are blocked by default by the firewall pf.

Xenodm is a simplified fork of xdm: lightweight, more secure, and stripped of XDMCP support because of many security vulnerabilities. It supports only the BSDauth code used in OpenBSD. It runs without setuid rights. OpenBSD recommends xenodm over startx, and the FAQ documents it as the secure default path.

  • The standard X11/Xorg stack is legacy-heavy, vulnerability-prone, and full of historical baggage. Xenocara is a major improvement in OpenBSD. XLibre is a later effort in a similar direction, but it does not match Xenocara's security profile.

Wayland is much more secure than X11, but it has still had serious vulnerabilities, and XWayland exists for compatibility with older software. Fedora Secureblue disables XWayland globally for this reason. Wayland is not automatically safe, and its sandboxing can be weakened by compositors such as Hyprland, which Secureblue does not recommend. XLibre and Xenocara are better directions, though only XLibre is usable on Linux.

No closed source drivers

OpenBSD accepts no vendor-compiled drivers and signs no NDAs. Every driver in the tree is open source and auditable. Hardware makers offer binary drivers to hide how their devices work, and OpenBSD answers by reverse engineering the hardware instead of trusting a black box.

Firmware is a separate case: firmware with a redistributable license is shipped in base, while firmware that cannot be redistributed (mostly Wi-Fi) is downloaded externally by fw_update(8). Firmware is still closed source, but it does not run on the CPU: the driver uploads it to the device, where it executes on the device's own processor.

A closed driver is code running in the kernel that nobody outside the vendor can audit, fix or even test for defects. A vendor can ship a buggy or malicious driver, or a driver that cannot be patched because only the vendor holds the source. OpenBSD can fix a bug in any driver the same day it is found, and can replace a driver entirely when a better design appears. The policy also removes the legal wall of NDAs, which would make the audit process impossible.

  • The Linux kernel contains no in-tree binary drivers either, so the kernel itself is not the difference. Distributions are: Debian and Ubuntu ship the non-free-firmware section enabled, most others ship firmware packages by default, and users routinely load out-of-tree proprietary drivers such as NVIDIA's. Only Linux-libre distributions, such as Guix, Trisquel and Parabola, remove blobs, and they do so at the cost of hardware support that OpenBSD keeps by shipping redistributable firmware.
  • FreeBSD accepts vendor drivers and firmware with restrictive licenses in its source tree, and NetBSD ships firmware in base as well. OpenBSD's difference is the rule itself: no closed driver is ever accepted, so the question never comes up.
  • Windows and macOS are proprietary software and ship closed drivers and firmware everywhere.

RETGUARD

RETGUARD is a replacement for the stack protector that uses a per-function random cookie (located in the read-only ELF .openbsd.randomdata section) to consistency-check the return address on the stack. It was implemented for amd64 and arm64 by Todd Mortimer in OpenBSD 6.4, for mips64 in OpenBSD 6.7, and powerpc/powerpc64 in OpenBSD 6.9. amd64 system call stubs were also protected in OpenBSD 7.3.

  • Linux and macOS default to -fstack-protector-strong, which uses one cookie per process and only covers functions with arrays or address-taken locals. RETGUARD uses a separate random cookie per function, stored in the read-only .openbsd.randomdata section, and covers every function, including amd64 syscall stubs.
  • Windows utilizes CFG, DEP/NX, Control Flow Application Technology (CET) support on newer CPUs (hardware shadow stacks), and SEH/unwind metadata. Hardware shadow stacks (Intel CET) offer more robust backward protection and are a closer analogue to RETGUARD's XOR cookies.

Audit process

OpenBSD security page

The process we follow to increase security is simply a comprehensive file-by-file analysis of every critical software component. We are not so much looking for security holes, as we are looking for basic software bugs, and if years later someone discovers the problem used to be a security issue, and we fixed it because it was just a bug, well, all the better. Flaws have been found in just about every area of the system. Entire new classes of security problems have been found during our audit, and often source code which had been audited earlier needs re-auditing with these new flaws in mind. Code often gets audited multiple times, and by multiple people with different auditing skills.

Some members of our security auditing team worked for Secure Networks, the company that made the industry's premier network security scanning software package Ballista (Secure Networks got purchased by Network Associates, Ballista got renamed to Cybercop Scanner, and well...) That company did a lot of security research, and thus fit in well with the OpenBSD stance. OpenBSD passed Ballista's tests with flying colours since day 1.

Another facet of our security auditing process is its proactiveness. In most cases we have found that the determination of exploitability is not an issue. During our ongoing auditing process we find many bugs, and endeavor to fix them even though exploitability is not proven. We fix the bug, and we move on to find other bugs to fix. We have fixed many simple and obvious careless programming errors in code and only months later discovered that the problems were in fact exploitable. (Or, more likely someone on BUGTRAQ would report that other operating systems were vulnerable to a newly discovered problem, and then it would be discovered that OpenBSD had been fixed in a previous release). In other cases we have been saved from full exploitability of complex step-by-step attacks because we had fixed one of the intermediate steps. An example of where we managed such a success is the lpd advisory that Secure Networks put out.

Project Goals

OpenBSD's goals are clear, precise, and they greatly increase user confidence.

OpenBSD project goals

  1. Provide the best development platform possible. Provide full source access to developers and users, including the ability to look at CVS tree changes directly. Users can even look at our source tree and changes directly on the web!

  2. Integrate good code from any source with acceptable licenses. ISC or Berkeley style licences are preferred, the GPL is not acceptable when adding new code, NDAs are never acceptable. We want to make available source code that anyone can use for ANY PURPOSE, with no restrictions. We strive to make our software robust and secure, and encourage companies to use whichever pieces they want to. There are commercial spin-offs of OpenBSD.

  3. Pay attention to security problems and fix them before anyone else does. (Try to be the #1 most secure operating system.)

  4. Greater integration of cryptographic software. OpenBSD is developed and released from Canada and due to Canadian law it is legal to export crypto to the world (as researched by a Canadian individual and as documented in the Export Control list of Canada).

  5. Track and implement standards (ANSI, POSIX, parts of X/Open, etc.)

  6. Work towards a very machine independent source tree. Support as many different systems and hardware as feasible.

  7. Be as politics-free as possible; solutions should be decided on the basis of technical merit.

  8. Focus on being developer-oriented in all senses, including holding developer-only events called hackathons.

  9. Do not let serious problems sit unsolved.

  10. Make a release approximately every six months.

This makes OpenBSD predictable, reliable, stable, and verifiable, which in turn strengthens security.

  • Linux development is chaotic, as I argued in topic 12. Big changes happen constantly, and the project is highly malleable under pressure from large corporations such as IBM, partly because of the GPL-centered ecosystem around it.
  • Windows has always been messy, and each version adds more complexity. At least Microsoft's target is clear: the average desktop user. Windows can be pleasant for that audience, especially for people who do not care much about performance.
  • macOS is pretty predictable. Nothing changes and Apple products only become more and more expensive.
  • NetBSD and FreeBSD also have clear goals, although almost completely different from OpenBSD.

Politics-free

Be as politics-free as possible; solutions should be decided on the basis of technical merit.

OpenBSD development is intentionally kept separate from politics and social causes. The developers, especially Theo de Raadt, tend to make decisions based on technical merit rather than public pressure.

One of the many (hundreds) examples of this was when an OpenBSD user proposed a change of term in the OS code, claiming that the term was sexist against women and was "pretty offensive": OpenBSD advocacy mailing list: proposed terminology change

But OpenBSD creator Theo de Raadt responded: Theo de Raadt's response on the mailing list

OpenBSD has proven reliable in this regard. Unlike many other operating systems, it has resisted political and social pressure inside its technical decision-making.

  • Linux, by contrast, often tries to satisfy social expectations before focusing on software efficiency and security. Vanity and public approval sometimes matter too much in the Linux world, while old bugs and structural problems remain unresolved.

    One example is the merge of inclusive-terminology rules into the Linux kernel tree, aimed at replacing terms such as "master", "slave", "blacklist", and "whitelist" that programmers had used for decades: Linux kernel inclusive-terminology rules (Linux Reviews)

  • None of these changes improves code efficiency. My criticism is that effort should go first toward long-standing kernel bugs and vulnerabilities instead of terminology updates. I see this as one example of a broader priority problem in Linux development.

  • Beyond the kernel, the Linux world has cases like systemd "detect-fash":

The most disturbing part is that many people supported the commit. To me, this shows how quickly a political or social idea can appear in the Linux world and create risk for specific users. If maintainers decide that a group is "problematic" and should be treated differently, a harmful feature can appear very quickly. That makes it hard to trust the ecosystem calmly.

OpenBSD is different. As mentioned in topic 12, the kernel and userland are developed together, which greatly reduces the chance of this kind of surprise entering the system.

  • Windows and macOS also try to please broad audiences rather than focusing purely on software efficiency. That is understandable for proprietary, paid operating systems. I expect it there; I do not want it in Linux.

  • FreeBSD is becoming worse in this regard. The community is changing, which is not necessarily a problem as long as those pressures stay out of OS development.

  • NetBSD and DragonFlyBSD don't seem to suffer from this type of problem, but I don't really know.

Smaller attack surface

As of 2026-10-22, the entire OpenBSD operating system (src + xenocara) has 36,299,895 lines of code. The OpenBSD kernel (src/sys) has a total of 8,025,609 lines of code. Both figures are cloc 2.00 code counts, with comments and blank lines excluded. loccount gives 7,896,621 for the kernel, so the choice of tool moves the total by less than two percent.

Is that a lot? Yes. Is it too much? In my view, yes. But compare it with alternatives:

Windows is likely beyond one billion lines, and probably macOS as well. FreeBSD and NetBSD have more lines of code than OpenBSD, but most likely less than the Linux kernel or a Linux distro.

More lines of code mean more attack surface, more bugs, and more vulnerabilities. OpenBSD's philosophy focuses on minimalism and security. Its developers understand that clean, minimal code lowers attack surface, and they actively follow that approach.

Attack surface also depends on how much of that code is enabled and exposed. Total code size measures potential complexity, while code that is loaded, privileged, listening on the network, parsing untrusted input, or reachable through local IPC is more directly relevant to the effective attack surface. The number of daemons and services enabled by default therefore matters.

OpenBSD deliberately keeps a default installation minimal. Relatively few network-facing or privileged services are enabled by default, and unnecessary services are not started automatically. A process merely running is not necessarily remotely reachable, and a network listener is not necessarily exposed beyond a local interface or firewall. These distinctions matter, but every additional long-running process, privileged helper, IPC endpoint, network listener, or parser of untrusted input increases the code that attackers can continuously reach.

Mainstream desktop and server operating systems often begin with a larger collection of background services, IPC endpoints, privileged helpers, update agents, discovery services, management components, and network listeners. Individual components can be well designed and securely configured, but their aggregate exposure still expands the attack surface. OpenBSD's minimal default configuration is a deliberate security property, not merely an aesthetic preference.

With any Linux distribution, even Gentoo or Linux from Scratch, you are dealing with tens or hundreds of millions of lines of code, perhaps more depending on the full system. That is an incomparably larger attack surface than OpenBSD. The Linux kernel alone is larger than the entire OpenBSD operating system. Windows 10 and 11 are even harder to judge, because only Microsoft knows how much proprietary code is involved.

With OpenBSD, you start with a smaller attack surface than most other monolithic or hybrid-kernel operating systems. That improves user security and also makes additional mitigations easier to implement. Maintenance becomes easier, code quality improves, and reliability improves with it. From a security and reliability perspective, I see no downside.

Even the official OpenBSD websites have a small amount of code: 312,465 lines in total as of 2026-02-26. That improves privacy and user experience beyond the operating system itself. Microsoft, Apple, and many Linux distribution websites are heavy, JavaScript-filled, and telemetry-friendly by comparison.

El Psy Kongroo!