$ uname -a A_BLOG_ABOUT_UNIX_TOOLS_AND_THE_BEAUTY_OF_SIMPLE_SYSTEMS
SYS.YEAR  2026
← Back to articles
2026-09-06ARTICLE

Red Baron

Running Red Baron 3.10 on FreeBSD 15 with Linuxulator

Red Baron 3.10 is a 32-bit Linux/Motif web browser from Red Hat Linux 4.2. I had a complete Red Hat 4.2 filesystem under /compat in a FreeBSD 15.1 Bastille jail, but launching the browser initially ended in a segmentation fault.

Linuxulator and the compatibility root

Linuxulator must be enabled on the FreeBSD host:

sysrc linux_enable=YES
service linux start

FreeBSD expects its Linux userland below /compat/linux. Because the imported filesystem already lived directly under /compat, a symlink made it available at the expected location:

ln -s . /compat/linux
brandelf -t Linux /compat/usr/lib/redbaron/redbaron_3.10

The executable and all of its libc5 and X11 dependencies were present. Native FreeBSD lib32 packages were not involved: Linux binaries use the Linux loader and libraries under /compat/linux.

Finding the real crash

ktrace, kdump, and truss showed that /lib/ld-linux.so.1 loaded every required library successfully. Red Baron then made its first heap allocation, received NULL, and executed the equivalent of:

strcpy(NULL, "Spyglass");

The faulting call originated in Red Baron's startup code:

SM_Malloc -> libc5 malloc -> NULL
main      -> strcpy(NULL, "Spyglass") -> SIGSEGV

Enabling security.bsd.map_at_zero did not help, so it was returned to its secure default of 0. The failure was the old libc5 allocator interacting badly with the current Linuxulator, not a missing library or X server.

Replacing the allocator

The workaround was a freestanding i386 Linux shared object that exports:

malloc calloc realloc free strdup

It has no libc dependencies. Each allocation uses the legacy Linux i386 mmap syscall directly, stores its size in a small aligned header, and releases it with munmap. It was built on FreeBSD with Clang and LLD:

cc -target i386-unknown-linux-gnu -m32 -O2 -fPIC \
  -ffreestanding -fno-builtin -fno-stack-protector \
  -fno-asynchronous-unwind-tables \
  -c malloc_shim.c -o malloc_shim.o

ld -m elf_i386 -shared -soname libredbaron_compat.so \
  -o libredbaron_compat.so malloc_shim.o

brandelf -t Linux libredbaron_compat.so

The shim was installed as:

/compat/usr/lib/redbaron/libredbaron_compat.so

Because the process is interpreted by Linux's ld-linux.so.1, the correct variable is LD_PRELOAD:

LD_PRELOAD=/usr/lib/redbaron/libredbaron_compat.so

Tracing confirmed that LD_32_PRELOAD—the FreeBSD 32-bit runtime-linker variable—and LIB_32_PRELOAD were ignored by the Linux loader.

X11 and TigerVNC

Red Baron rejected TigerVNC's original 16-bit RGB565 visual. Display :1 had to run at 24-bit depth and include the imported Red Hat bitmap fonts:

Xvnc :1 -geometry 800x600 -depth 24 \
  -fp /compat/usr/X11R6/lib/X11/fonts/misc,\
/compat/usr/X11R6/lib/X11/fonts/75dpi,\
/compat/usr/X11R6/lib/X11/fonts/100dpi,\
/compat/usr/X11R6/lib/X11/fonts/Type1,\
/compat/usr/X11R6/lib/X11/fonts/Speedo,\
/usr/local/share/fonts/misc,built-ins

The jail launcher sets the Linux-side paths and starts the original binary directly, avoiding the broken Red Hat 4.2 Bash:

#!/bin/sh
export DISPLAY="${DISPLAY:-:1}"
export HOME=/root
export REDBARON=/usr/lib/redbaron
export LD_PRELOAD=/usr/lib/redbaron/libredbaron_compat.so
exec /compat/usr/lib/redbaron/redbaron_3.10 "$@"

With the launcher installed as /usr/local/bin/redbaron, starting the browser is simply:

redbaron

The original Red Baron executable and Red Hat libraries remain unchanged; all compatibility behavior is isolated in the preload shim and launcher.