Skip to content

v0.5.2: BusyBox B-5/B-6/B-7/B-8/B-9/B-17, POSIX Regex, Native Compilation

Choose a tag to compare

@doublegate doublegate released this 24 Feb 22:59
· 792 commits to main since this release

VeridianOS v0.5.2

Date: February 24, 2026
Commits: 8 (since v0.5.1)
Files changed: 69
Lines: +6,953 / -262
Previous Release: v0.5.1 (February 23, 2026)


Summary

Major release spanning 6 BusyBox integration sprints (B-5, B-6, B-7, B-8, B-9, B-17), a CI infrastructure fix, and release documentation updates. This release resolves critical pipeline execution issues, builds the native compilation infrastructure needed for on-target GCC execution, implements a complete POSIX regex engine for grep/sed/awk support, and fixes CI to use the correct custom x86_64 target.


Sprint Details

B-5: EPIPE/BrokenPipe Handling

  • Added SyscallError::BrokenPipe (-39/EPIPE) and SyscallError::BadFileDescriptor (-21/EBADF) to the kernel syscall error enum
  • sys_write() on a pipe with no readers now returns EPIPE instead of generic InvalidState
  • Fixes yes | head -n 1 hanging indefinitely (writer never received termination signal)
  • Boot-context pipe reads gained retry logic for command substitution patterns

B-6: Float Printf Formatting

  • Implemented __format_double() (~170 lines) in libc vsnprintf() supporting %f, %g, and %e format specifiers
  • Handles field width, precision, sign flags, and left/right alignment
  • Fixes BusyBox seq producing empty output (seq 1 3 now correctly outputs 1\n2\n3)

B-7: Pipe Read Improvements and Boot Tests

  • cleanup_process() called in boot-context sys_exit() (prevents zombie processes and leaked pipe fds)
  • Added seq 1 3 and echo hello | cat boot tests
  • Fixed AArch64 unused variable warning in boot test dispatch

B-8: Phase C Native Compilation Infrastructure

  • 384MB kernel heap: Expanded from 128MB to support cc1 memory demands during native compilation
  • Frame allocator fallback: Emergency bitmap scan when primary allocation region is exhausted
  • 8MB user-space stack growth: Increased from 4MB via demand paging on guard page faults
  • map_kernel_error(): Translation layer mapping kernel memory errors to syscall-compatible error codes
  • Native build scripts: busybox/build-busybox-native.sh for on-target BusyBox compilation
  • Boot tests: Added native compilation verification tests for cc1/as/ld execution paths

B-9: sbrk/brk Hardening for cc1-Scale Workloads

  • 64KB chunk pre-allocation: Reduces brk syscall frequency by ~16x for small heap increments
  • Page-aligned requests: All break changes rounded to 4KB page boundaries
  • Local break tracking: Per-process break state maintained in kernel to prevent stale pointer issues
  • 512MB per-process heap limit: Hard cap prevents cc1 from exhausting kernel memory
  • Updated libc sbrk() and malloc()/free() to use hardened kernel brk path

B-17: POSIX BRE/ERE Regex Engine

  • 1291-line recursive backtracking NFA in userland/libc/src/regex.c
  • Implements regcomp(), regexec(), regfree(), regerror() per POSIX.2
  • Supports both Basic Regular Expressions (BRE) and Extended Regular Expressions (ERE)
  • Metacharacters: . * + ? ^ $ | () [] {m,n}
  • 12 POSIX character classes: [:alpha:], [:digit:], [:alnum:], [:upper:], [:lower:], [:space:], [:blank:], [:print:], [:punct:], [:cntrl:], [:graph:], [:xdigit:]
  • Bracket expressions with negation ([^...]) and ranges ([a-z])
  • Alternation, grouping, backreferences (BRE \(...\), ERE (...))
  • REG_ICASE, REG_NEWLINE, REG_NOSUB, REG_NOTBOL, REG_NOTEOL flags
  • Enables BusyBox grep, sed, awk, and find applets

CI Fix: x86_64 Target Configuration

  • Changed x86_64 build target from x86_64-unknown-none to targets/x86_64-veridian.json
  • Custom target includes kernel code model required for higher-half kernel at 0xFFFFFFFF80100000
  • Fixes R_X86_64_32S relocation errors in CI builds

libc Header Extensions

New headers added for BusyBox compatibility:

  • byteswap.h, endian.h, features.h, libgen.h, malloc.h, mntent.h
  • net/if.h, netdb.h, paths.h, sched.h, syslog.h, utmp.h
  • sys/mount.h, sys/prctl.h, sys/statfs.h, sys/statvfs.h, sys/sysmacros.h, sys/times.h

Extended existing headers: stdio.h, stdlib.h, string.h, time.h, unistd.h, grp.h, errno.h, veridian/stat.h, veridian/fcntl.h, veridian/signal.h, sys/socket.h, sys/utsname.h, sys/wait.h

New stub implementations: posix_stubs3.c (892 lines) covering strptime, futimens, syslog, mount, sched, utmp, and network stubs.


Build Verification

Architecture Build Clippy Boot Tests Shell
x86_64 0 errors 0 warnings Stage 6 BOOTOK 29/29 root@veridian:/#
AArch64 0 errors 0 warnings Stage 6 BOOTOK 29/29 root@veridian:/#
RISC-V 64 0 errors 0 warnings Stage 6 BOOTOK 29/29 root@veridian:/#

Known Limitations

  • $(pwd) returns empty for builtins in boot execution model (builtins run in kernel context, not as forked processes)
  • BusyBox ash shell requires full rootfs with /bin/busybox symlinks; boot-context testing uses individual applet invocation
  • Regex engine uses recursive backtracking (no Thompson NFA), so pathological patterns may exhibit exponential behavior

Files Changed (69 files, +6,953/-262 lines)

Category Files
Kernel memory mm/heap.rs, mm/frame_allocator.rs, mm/page_fault.rs, mm/mod.rs, mm/vas.rs
Kernel syscall syscall/mod.rs, syscall/filesystem.rs, syscall/process.rs, syscall/memory.rs
Kernel boot bootstrap.rs
Kernel fs fs/mod.rs, fs/file.rs, fs/tar.rs
Kernel process process/creation.rs, process/exit.rs
CI .github/workflows/ci.yml
BusyBox busybox/build-busybox-native.sh, busybox/veridian_defconfig, busybox/busybox-compile-list.txt, busybox/busybox-obj-list.txt
Build scripts scripts/build-busybox-rootfs.sh, scripts/veridian-cc-wrapper.sh
libc headers 30+ headers (new and extended)
libc source regex.c (1291 lines), posix_stubs3.c (892 lines), stdio.c, stdlib.c, string.c, syscall.c, getopt.c, posix_stubs.c
Tests userland/tests/busybox_test.sh
Project Cargo.toml, Cargo.lock, README.md, CHANGELOG.md, .gitignore

Commit Log (since v0.5.1)

e4faa99 chore(release): update v0.5.2 release artifacts for B-8/B-9/B-17 and CI fix
aae52e0 feat(libc): implement POSIX BRE/ERE regex engine (B-17)
383603d fix(ci): use custom x86_64-veridian target with kernel code model
6e7b280 fix(libc): harden sbrk/brk for cc1-scale memory workloads (B-9)
a539bcd feat(kernel): Phase C native compilation infrastructure (B-8)
88d7764 chore(release): v0.5.2 -- BusyBox B-5/B-6/B-7 EPIPE, float printf, pipe improvements
fd136fe feat(busybox): cross-compile BusyBox 1.36.1 for VeridianOS with ash shell support

Full Changelog: v0.5.1...v0.5.2