$ uname -a A_BLOG_ABOUT_UNIX_TOOLS_AND_THE_BEAUTY_OF_SIMPLE_SYSTEMS
SYS.YEAR  2026
← Back to articles
2026-10-31ARTICLE

Present Muug Baron

Red Baron on FreeBSD

Running a 1997 Linux browser on a modern FreeBSD system

Manitoba Unix Users Group · MUUG · October 2026

  • The demo jail is disposable. Follow along on a test system, not on production.
  • The host kernel is not modified by any step in this talk.

What we will cover

  • What Red Baron is, and why an old browser is interesting.
  • Why an old program needs old system parts.
  • How FreeBSD runs Linux programs without a Linux kernel.
  • What memory allocation is, and what malloc and brk do.
  • Why the browser crashed, and how we fixed it.
  • How a modern browser can render pages for the old one.
  • The work happens in a disposable Bastille jail; the FreeBSD host kernel is not changed.
  • All commands run inside the jail unless a slide says otherwise.

What was Red Baron?

  • Red Hat's commercial web browser, based on Spyglass technology.
  • Sold only as a compiled program; no source code was published.
  • Included with Red Hat Linux 4.0 in October 1996.
  • This copy is Red Baron 3.10, from Red Hat Linux 4.2, May 1997.
  • A 32-bit Linux program for X11, an old Unix graphics system.

Sources: Fedora's Red Hat history, Red Hat's 4.2 announcement.

  • It is a proprietary i386 Linux binary that also uses Motif, an old graphical toolkit, and libc5.
  • Keep the original RPM files; they are the only copy of its runtime.

Why is old software hard to run?

A program needs other software to run:

  • a kernel to manage memory, processes, files, and network;
  • a C library for basic functions such as malloc and printf;
  • other libraries for graphics, fonts, and compression;
  • a matching binary interface, called an ABI.

FreeBSD is a separate Unix-like system, not a Linux distribution. The 1997 Linux ABI and the 2026 FreeBSD ABI are not the same. FreeBSD can imitate the Linux ABI. That imitation is called Linuxulator.

  • Installing FreeBSD's native 32-bit runtime does not provide a Linux libc5 runtime.
  • A Linux binary does not contain its libraries; it records their names.

How FreeBSD runs Linux programs

Red Baron + Linux libraries       FreeBSD shell + FreeBSD libraries
             |                                  |
       Linux system calls                FreeBSD system calls
             |                                  |
        Linuxulator ----------------> FreeBSD kernel
  • The CPU runs the 32-bit i386 instructions directly; this is not emulation.
  • Linuxulator translates Linux system calls (requests to the kernel) into FreeBSD work.
  • The old Linux libraries stay in the running program.
  • There is no Linux kernel inside the jail.

Source: FreeBSD Handbook: Linux Binary Compatibility.

  • Enable Linux support on the host with sysrc linux_enable=YES and service linux start.
  • A jail shares its host kernel, so enabling Linux support inside the jail is not enough.

What is a system call?

  • A system call is a request from a program to the kernel.
  • Programs use system calls to read files, send network data, and get memory.
  • The kernel does these jobs because programs cannot access hardware directly.
  • A system call has a number, arguments, and a return value.
  • Linux and FreeBSD use different numbers. Linuxulator maps them.
Program -> C library wrapper -> int $0x80 -> Linuxulator -> FreeBSD kernel
  • A system-call trace (ktrace and kdump) records the requests a program makes.
  • It shows where an old program stops, but not which C function made the call.

What is malloc?

  • malloc is a C library function that gives a program memory.
  • It takes memory from an area called the heap.
  • It asks the kernel for memory in large blocks, then splits them.
  • The old Linux C library, libc5, grew the heap with a call named brk.
  • Modern allocators often use mmap, which maps a new block of memory.
Red Baron -> libc5 malloc -> brk or mmap -> Linuxulator -> FreeBSD kernel
  • malloc returns NULL when it cannot provide memory.
  • Red Baron did not check for NULL.

What is brk?

  • brk moves the program break, the end of the program's data area.
  • The heap grows upward from that point.
  • It comes from early Unix, before the POSIX standard and the Single UNIX Specification.
  • POSIX later deprecated brk and its companion sbrk as legacy interfaces.
  • Linux and FreeBSD still provide brk for old programs.
  • Red Baron's old C library, libc5, uses it.
1970s Unix     1988 POSIX     1990s SUS     today
   brk           already old    legacy       kept for compatibility
  • Deprecated does not mean unused; removing brk breaks old binaries.
  • A modern allocator may use brk for small requests and mmap for large ones.

The lab setup

Piece Verified setup
Jail Bastille VNET jail baron, 192.168.3.31
System FreeBSD 15.1-RELEASE-p4, amd64
Linux runtime Five RPMs under /compat/linux, plus X11 data
Files /root/redbaron-install inside the jail
Desktop Xvnc :1, 800x600x24, Fluxbox
Access SSH tunnel to 127.0.0.1:5901
Modern web WRP + Chromium on 127.0.0.1:8080
  • X11 is the old Unix graphics system. VNC is a remote desktop protocol.
  • Xvnc serves the X11 desktop over VNC. Fluxbox is a small window manager.
  • A VNET jail has its own virtual network interface.
  • A jail is an isolated FreeBSD environment that shares the host kernel.
  • Bastille is a tool that creates and manages jails.

Steps 1-2: connect and copy the files

On the workstation:

ssh baron
ssh baron 'install -d /root/redbaron-install /compat/linux'
scp -r redbaron-freebsd-jail/media baron:/root/redbaron-install/
scp redbaron-freebsd-jail/malloc_shim.c baron:/root/redbaron-install/

Inside baron, as root:

pkg install -y tigervnc-server fluxbox xauth xset xsetroot \
  xwininfo curl font-misc-misc font-adobe-75dpi \
  font-adobe-100dpi font-bh-75dpi
  • Connect to the jail over SSH.
  • Copy the RPMs and the memory-replacement source.
  • Install the FreeBSD desktop packages.
  • The browser's Linux libraries stay separate from FreeBSD's.
  • Native FreeBSD fonts work with native Xvnc.
  • Keep Linux libraries and FreeBSD libraries apart.

Step 3: unpack the Linux RPMs and X11 data

Assume media/XFree86-3.2-9.i386.rpm is already present.

cd /root/redbaron-install
for rpm in redbaron-3.1-1.i386.rpm \
  libc-5.3.12-18.i386.rpm ld.so-1.7.14-4.i386.rpm \
  XFree86-libs-3.2-9.i386.rpm xpm-3.4i-1.i386.rpm; do
    bsdtar -xf "media/$rpm" -C /compat/linux
done
bsdtar -xf media/XFree86-3.2-9.i386.rpm -C /compat/linux \
  usr/X11R6/lib/X11
brandelf -t Linux /compat/linux/usr/lib/redbaron/redbaron_3.10
  • An RPM is a Red Hat package: files plus metadata.
  • bsdtar extracts the files; it does not run installer scripts.
  • The sixth RPM, XFree86, supplies X11 keyboard, locale, and font data.
  • Extract only the X11 data subtree, not the old X server programs.
  • brandelf marks the browser as a Linux program.
  • This is payload extraction, not a package transaction; no dependency resolution runs.
  • XFree86 is a different RPM from XFree86-libs.

Step 4: restore the library names

ln -sf libc.so.5.3.12 /compat/linux/lib/libc.so.5
ln -sf libm.so.5.0.6 /compat/linux/lib/libm.so.5
ln -sf libdl.so.1.7.14 /compat/linux/lib/libdl.so.1
cat > /compat/linux/etc/ld.so.conf <<'EOF'
/lib
/usr/lib
/usr/X11R6/lib
EOF
/compat/linux/sbin/ldconfig
  • Programs ask for libraries by a short runtime name, called the SONAME.
  • The files on disk have versioned names.
  • The Linux ldconfig creates the short links and a cache.
  • Use the Linux ldconfig, not FreeBSD's.
  • Do not create libXpm.so.6. The file is libXpm.so.4.9, and its SONAME is libXpm.so.4.
  • The old Linux ldconfig is statically linked, so it runs without the runtime.

Step 5: resolve the dependencies

LD_TRACE_LOADED_OBJECTS=1 \
  LD_LIBRARY_PATH=/lib:/usr/lib:/usr/X11R6/lib \
  /compat/linux/usr/lib/redbaron/redbaron_3.10
  • The check lists every library the program needs.
  • All seven libraries resolved: Xt, X11, Xext, Xpm, SM, ICE, and libc5.
  • The paths are Linux-visible paths under the jail's Linux root directory.
  • The loader variables apply only to this Linux program.
  • If a library is missing, the output names it; fix extraction or ldconfig.

The crash, in plain terms

  • Red Baron asks libc5 for memory.
  • libc5 asks Linuxulator to grow the heap with brk.
  • Linuxulator returns a different address than Linux would.
  • libc5 treats that as failure and returns NULL.
  • Red Baron copies the string "Spyglass" to address zero, which points to no valid memory, and crashes.

Two defects: the incompatible return value, and the unchecked allocation.

  • The crash is a SIGSEGV at address zero.
  • A crash alone does not prove the cause; the trace and the crash dump did.

How we found out

  • A system-call trace showed the brk request and its rounded result.
  • A crash dump, a copy of the process memory at the crash, showed the exact instruction: a string copy to address zero.
  • The source string was "Spyglass".
  • The call chain led back to malloc.
  • The program never checked malloc's result.
CALL  linux_brk(0x82ee290)
RET   linux_brk 137293824/0x82ef000
PSIG  SIGSEGV SIG_DFL code=SEGV_MAPERR
  • Set kern.coredump=1 on the host and ulimit -c unlimited in the jail to capture a dump.
  • Restore the host setting afterwards; it affects other processes too.

The actual bug: brk returned the wrong address

Requested logical heap end:  0x082ee290
Returned address:            0x082ef000  (next 4 KiB page)
  • Linux brk returns the exact new break.
  • FreeBSD's Linuxulator returned an address rounded up to the next 4 KiB (4096-byte) page.
  • libc5 compares the two addresses; they differ.
  • libc5 reports "out of memory", and malloc returns NULL.
  • Page rounding is correct for memory mappings, but the brk return must match the exact request.
  • This is an ABI compatibility bug, not a memory shortage.
  • The program had plenty of memory; the kernel gave the wrong answer.

Two ways to fix it

Option What changes Where it runs
1. Replace memory functions Use mmap instead of brk. Existing baron jail.
2. Repair brk Fix Linuxulator's return value. Separate BARONVM guest.
  • Option 1 works with the current host kernel.
  • Option 2 needs a rebuilt kernel and matching Linuxulator modules.
  • Both keep the original browser and its Linux libraries.
  • The jail cannot change its host kernel, so option 1 is the deployable fix today.
  • Option 2 is a local review proposal, not a FreeBSD release update.

Option 1: LD_PRELOAD

  • The loader is the small program that starts a program and connects it to its libraries.
  • LD_PRELOAD names a library the loader must load first.
  • If that library defines malloc, its malloc is used.
  • The rest of the program and its libraries stay the same.
  • This is interposition: same function name, different implementation.
Ordinary launch:   imported malloc -> libc5 malloc
With preload:      imported malloc -> shim malloc
  • The working variable here is LD_PRELOAD, because the Linux loader reads it.
  • LD_32_PRELOAD belongs to FreeBSD's native 32-bit loader and did not work here.

What the shim replaces

  • The shim is a small shared library, a file of functions that programs load at runtime.
  • It replaces malloc, calloc, realloc, free, and strdup with the same names libc5 uses.
  • These functions allocate, resize, release, and duplicate memory.
  • All five must use one allocation layout, or one function cannot free another's memory.
  • It uses mmap and munmap instead of brk.
  • Replace the whole family; replacing malloc alone lets libc5 free and realloc receive pointers they cannot interpret.
  • The header's magic number is a sanity check, not full pointer validation.

Build and install the shim

cd /root/redbaron-install
cc -target i386-unknown-linux-gnu -m32 -O2 -fPIC \
  -ffreestanding -fno-builtin -fno-stack-protector \
  -fno-asynchronous-unwind-tables -c malloc_shim.c
ld -m elf_i386 --hash-style=sysv -shared \
  -soname libredbaron_compat.so \
  -o libredbaron_compat.so malloc_shim.o
brandelf -t Linux libredbaron_compat.so
install -m 0755 libredbaron_compat.so \
  /compat/linux/usr/lib/redbaron/libredbaron_compat.so
  • Build a 32-bit Linux shared library with FreeBSD's compiler.
  • Link it in the old format the 1997 loader understands.
  • Mark it as a Linux binary.
  • Install it next to the browser.
  • Audit with file, readelf -d, and readelf -Ws: 32-bit, SysV hash, five exports, no libc dependency.
  • Check undefined symbols too, not only DT_NEEDED.

The launcher

cat > /usr/local/bin/redbaron <<'EOF'
#!/bin/sh
set -eu
export DISPLAY="${DISPLAY:-:1}"
export HOME="${HOME:-/root}"
export XAUTHORITY="${XAUTHORITY:-$HOME/.Xauthority}"
export REDBARON=/usr/lib/redbaron
export LANG=C
export LC_ALL=C
export XKEYSYMDB=/usr/X11R6/lib/X11/XKeysymDB
export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/X11R6/lib
export LD_PRELOAD=/usr/lib/redbaron/libredbaron_compat.so
exec /compat/linux/usr/lib/redbaron/redbaron_3.10 "$@"
EOF
chmod 0755 /usr/local/bin/redbaron
  • Sets the X11 display, language, and X11 data path.
  • Sets the Linux library path and preloads the shim.
  • exec replaces the shell with the browser.
  • exec matters: the browser should be the process, not a child of a shell that may exit.
  • A single LD_PRELOAD assignment is enough.

Launch and verify

/usr/local/bin/redbaron -url file:/usr/lib/redbaron/help/index.htm
/usr/local/bin/vnc-session status
pgrep -fl redbaron
sockstat -4 -l | grep 5901
tail -n 20 /root/.vnc/redbaron.log
DISPLAY=:1 xwininfo -root -tree | grep 'Help Index'
  • Use -url. A bare address prints usage and exits.
  • Check the process, the VNC port, and the window title.
  • A running process alone does not prove the page rendered.
  • Inspect the visible page in VNC, not only the process list.
  • The window title is a useful cheap check.

It works: local help

height:480px

  • The original browser rendered its own Help Index.
  • This verifies the memory workaround.
  • The screenshot is from an earlier :2 demo; the guide uses :1.
  • The same runtime also worked in the patched-kernel guest, with the shim disabled.
  • That comparison is what ties the crash to brk, not to the shim.

The web moved on

  • Red Baron understands only 1997 HTML.
  • It has no modern HTTPS, CSS, or JavaScript.
  • It cannot verify modern certificates or run modern scripts.
  • We still want it to show today's pages.
  • A modern browser can do the modern work.
  • Do not expose the old browser directly to the internet.
  • It has no modern TLS and no modern sandboxing.

WRP: modern pages for the old browser

Inside the Bastille jail baron:

Red Baron           WRP                Native Chromium
Linux/i386          FreeBSD/amd64       FreeBSD/amd64
    |                  |                     |
    |-- HTTP/forms --->|-- browser control -->|
    |                  |                     |-- HTTPS --> Website
    |<-- GIF + map ----|<-- rendered page ----|
    |-- click x,y ---->|-- click in page ---->|
  • WRP means Web Rendering Proxy.
  • Red Baron asks WRP for a page; WRP asks Chromium to render it.
  • Chromium returns a picture (GIF) and a clickable image map.
  • Clicks go back to Chromium.
  • All three components run inside the jail.
  • WRP listens only on 127.0.0.1:8080 inside the jail.
  • Chromium runs headless (without a visible window) as the dedicated wrp user.

Install Chromium

install -d /usr/local/etc/pkg/repos
cat > /usr/local/etc/pkg/repos/FreeBSD.conf <<'EOF'
FreeBSD-ports: {
  url: "pkg+https://pkg.FreeBSD.org/FreeBSD:15:amd64/latest"
}
EOF
pkg update
pkg install -y chromium ca_root_nss font-bh-75dpi
/usr/local/bin/chrome --version
  • Chromium was missing from the default package repository but available in the latest one.
  • This changes the package repository for this jail only.
  • Verified: Chromium 156.0.8078.47.
  • Preserve any existing local repository configuration first.
  • Chromium and its dependencies added about 1 GiB.

Install the WRP program

install -d /root/redbaron-install/wrp
cd /root/redbaron-install/wrp
fetch -o wrp-amd64-freebsd \
  https://github.com/tenox7/wrp/releases/download/4.10.3/wrp-amd64-freebsd
expected=2d433c5fea4aa29906f68a8d366cb18025e8f1fab74a31a89c5f3d311ca91d7d
test "$(sha256 -q wrp-amd64-freebsd)" = "$expected" && \
  install -m 0755 wrp-amd64-freebsd /usr/local/bin/wrp
  • The expected SHA256 checksum comes from the 4.10.3 GitHub release.
  • Stop if the checksum does not match.
  • The release asset's internal version says 4.9.3; trust the release URL and checksum.
  • Always verify a downloaded binary against its published checksum.
  • Use the release tag and checksum to identify the binary, not the internal banner.

Give WRP its own account and log

pw usershow wrp >/dev/null 2>&1 || \
  pw useradd wrp -d /var/db/wrp -m \
  -s /usr/sbin/nologin -c 'Web Rendering Proxy'
install -d -o wrp -g wrp -m 0700 /var/db/wrp
install -o wrp -g wrp -m 0600 /dev/null /var/log/wrp.log
  • WRP and Chromium run as wrp, with home directory /var/db/wrp.
  • Chromium runs headless, without a visible desktop window.
  • Creating the log with install is a one-time setup step.
  • Rerunning the log command clears an existing log.
  • WRP's Chromium profile is temporary by default.

Install the WRP service

Save this as /usr/local/etc/rc.d/wrp:

#!/bin/sh
# PROVIDE: wrp
# REQUIRE: NETWORKING
# KEYWORD: shutdown

. /etc/rc.subr
name=wrp
rcvar=wrp_enable
load_rc_config "$name"
: ${wrp_enable:=NO}

pidfile=/var/run/wrp.pid
procname=/usr/local/bin/wrp
# Chromium workers can outlive their parent on this FreeBSD build.
stop_postcmd='pkill -U wrp -x chrome || true'
command=/usr/sbin/daemon
command_args="-f -p ${pidfile} -u wrp -o /var/log/wrp.log \
/usr/local/bin/wrp -b /usr/local/bin/chrome \
-l 127.0.0.1:8080 -t gif -g 640x400x216 -ua="

run_rc_command "$1"
  • WRP and Chromium run as a dedicated user, wrp.
  • Chromium runs headless; there is no visible desktop window.
  • The service starts WRP, which starts Chromium.
  • daemon -u sets the service account and HOME.
  • The stop hook targets only the wrp user's Chromium workers, not the root desktop.

Browse a modern page

chmod 0755 /usr/local/etc/rc.d/wrp
sysrc wrp_enable=YES
service wrp start
service wrp status
curl --retry 5 --retry-connrefused --retry-delay 1 \
  --max-time 30 --fail --silent --show-error \
  -o /dev/null 'http://127.0.0.1:8080/?url=https%3A%2F%2Fexample.com%2F'
/usr/local/bin/redbaron -url http://127.0.0.1:8080/
  1. Enter https://example.com/ in the WRP form and click Go.
  2. Click a link in the image; WRP forwards the coordinates to Chromium.
  3. Use Bk, Up, and Dn to navigate.
  • The workstation only needs VNC and an SSH tunnel to port 5901.
  • WRP stays on loopback; do not expose port 8080.

Red Baron showing a modern page

height:440px

  • Verified: WRP form submission loaded https://www.freebsd.org/.
  • Clicking the image opened the site's mobile menu.
  • WRP logged the forwarded click coordinates 593,40.
  • The check covers two HTTPS pages, form submission, and an image-map click.
  • A sustained browsing workload remains untested.

What this does not fix

  • Rendering is slow; every page is an image.
  • Some sites reject automated browsers.
  • Logins and sensitive data should stay out of the demo.
  • Sustained browsing was not tested.
  • The shim changes memory behavior; overall stability is not proven.
  • WRP adds modern rendering, not modern security.
  • Treat this as a lab demonstration, not a daily browser.

Running it on modern Linux: the runtime

Most modern Linux systems use a modern C library (glibc) and loader; Red Baron needs the 1997 runtime.

  • Put the six original RPMs in a private directory, rebuild the old library cache, and point the copies at a loader the system already has.
  • Replace libc5's allocator with an mmap allocator, and make free do nothing to avoid stale-pointer crashes. Memory leaks remain.
  • Build with the old binary format and stack layout the 1997 program expects.
  • Run the browser with setarch i386 -L for an old-style address layout, and pass LD_PRELOAD through env.
  • The allocator uses mmap2 (syscall 192); the build uses --hash-style=sysv, -mno-sse, and -mstackrealign.
  • The reported Linux malloc failure does not prove Linux has FreeBSD's brk bug.

Running it on modern Linux: fonts, DNS, desktop

Most modern Linux systems no longer supply the old bitmap fonts, DNS behavior, and desktop details.

  • Decompress and index the bitmap fonts, add aliases, and patch the crash when no font is found.
  • After the allocator works, call res_init() so libc5 reads the DNS settings.
  • Supply the OSF key names the old Motif toolkit expects, and enable menu shortcuts.
  • Set a visible cursor, and fix clipboard conversion failures under Xwayland, the X11 layer for Wayland.
  • Fix the font patch's swapped arguments so text lines have separate baselines; remaining issues include bold-italic text, odd <TT> spacing, and sites that require a Host: header.
  • The browser still has its original parser and rendering limits.

Source: Modern Linux experiment.


Recap

  • Linuxulator runs Linux programs with their original Linux libraries.
  • malloc is a library function; brk is an old Unix call for growing the heap.
  • POSIX later deprecated brk, but old programs still use it.
  • Linuxulator's rounded brk return broke libc5 and caused the crash.
  • Option 1 replaces memory functions; option 2 fixes brk in the kernel.
  • WRP and Chromium render modern pages for the old browser.
  • The preload workaround is the deployable fix for the current jail.
  • The kernel repair is a review proposal, validated in a separate VM.

Questions

  • Full guide: muug-baron.md
  • Diagnostics: diagnostics/baron-2026-10-26/README.md
  • brk investigation: LINUXULATOR_BRK.md
  • Kernel patch: ../linux-brk/upstream/
  • WRP: github.com/tenox7/wrp
  • Start with the full guide; it has the exact commands and file hashes.
  • The diagnostics directory records the live checks and their limits.