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

Blog Brk Dtrace

Investigating Red Baron's crash with DTrace in a fresh FreeBSD 16 VM

Start with an unpatched FreeBSD 16-CURRENT guest and the original Linux Red Baron browser. The browser crashes during startup. We want to find what the process did before it died and which memory access failed. At the start, neither a particular system call nor the kernel is known to be responsible.

Run DTrace inside the same VM as Red Baron. Both programs must use the guest's FreeBSD kernel. Running DTrace on the bhyve host traces the host kernel, which cannot expose the guest's system calls or exception handlers. The host is only used to start the VM and, if needed, transfer files.

Xvnc is assumed to be installed, running and accessible to the test user. This post does not configure or start it. The examples use display :1; substitute the display number from your existing Xvnc setup.

The recorded baseline uses an official FreeBSD 16-CURRENT image: stock GENERIC kernel, matching 16-CURRENT userland and matching modules. The measurements and validation limits are listed at the end. The investigation below begins with the crash and introduces each probe when there is a reason to use it.

Copy only the Input boxes. They contain commands without shell prompts; paste the whole box, including any closing SH or DTRACE line. An input labeled edit first contains values you must replace before pasting.

Output — recorded shows a saved result. Output — illustrative shows an example format rather than a captured transcript. Reference boxes contain source or explanatory material, not commands. In output boxes, <...> marks a variable field, ... marks omitted lines, and (no output) means the command is silent. Do not paste those markers. PIDs, TIDs, probe IDs, timestamps and addresses can vary; hashes and file instruction bytes are exact only for the supplied binaries. DTrace may also print a buffer-size message before the useful output shown here.

Background: what is running?

Red Baron 3.10 is an old 32-bit Linux program. Its libc5 C library supplies facilities such as memory allocation. FreeBSD's Linuxulator implements the Linux kernel interfaces those binaries call. We are running a FreeBSD kernel, not a Linux kernel. Native FreeBSD Xvnc provides the X11 display; a Linux X11 client can talk to that server.

A segmentation fault says that a memory access could not be completed. It does not tell us whether the cause is in the application, one of its libraries, or the compatibility layer. DTrace lets us observe the running process from the guest kernel; disassembly lets us interpret the machine instructions and values it records.

No project-specific test program is needed for the main investigation.

1. Begin in the fresh FreeBSD guest

Install an amd64 FreeBSD 16-CURRENT guest from one official snapshot, using its standard GENERIC kernel and the matching userland and modules. Enable networking and SSH during installation if you will transfer the browser files over SSH. Create an ordinary login account for those transfers. Official VM snapshots and the bhyve Handbook instructions cover creating and booting the VM; its name does not affect this procedure.

From this point, every command block is run inside that guest, except the two explicitly labeled file-transfer commands in step 2. Log in as root at the guest console. Enter the base system's Bourne shell so that export and the file-creation commands below have the expected syntax:

Input — guest; copy/paste:

sh
uname -a
uname -K
freebsd-version -ku
for tool in dtrace nm objdump readelf; do command -v "$tool"; done

Output — recorded baseline, shortened; hostname and build details may vary:

FreeBSD <hostname> 16.0-CURRENT FreeBSD 16.0-CURRENT #0 main-n290352-61c70dc16a79: ... GENERIC amd64
1600029
16.0-CURRENT
16.0-CURRENT
/usr/sbin/dtrace
/usr/bin/nm
/usr/bin/objdump
/usr/bin/readelf

uname -a records the running kernel build. uname -K records its numeric kernel interface version. freebsd-version -ku records the installed kernel and userland versions; both reported 16.0-CURRENT here. The recorded experiment used FreeBSD main revision 61c70dc16a79efcb9db732d37706cd311f555d9a, with kernel interface version 1600029. Those identify the measured baseline; a later CURRENT snapshot can have a different version and behavior.

The loop checks that the native tracing and ELF inspection tools are installed. If a minimal installation omitted them, install the matching base-system tools before continuing. Use the modules from this same guest installation. Keep its kernel unpatched while collecting the baseline.

Set the existing Xvnc display:

Input — guest; copy/paste:

export DISPLAY=:1

Output — success is silent:

(no output)

2. Supply the original Linux application and libraries

The input to this step is a directory named linux/, containing Red Baron and its original Linux runtime. In this project that directory is compat/linux/. It is supplied application data, not part of FreeBSD and not distributed with the patches. You must obtain the original files before following the application steps; installing a modern Linux base package does not supply this old browser or its libc5 runtime.

The directory needs at least these components, plus their dependencies and resources from the supplied tree:

Path within linux/ Purpose
usr/lib/redbaron/redbaron_3.10 Linux/i386 browser executable
lib/ld-linux.so.1 and its target Old Linux dynamic loader
lib/libc.so.5.3.12 and libc.so.5 libc5, including the allocator
usr/X11R6/lib/ Linux X11 client libraries and font/resource data
usr/lib/redbaron/help/ Local help pages used instead of a network URL
etc/ld.so.cache and related runtime files Library lookup data in the supplied tree

To bundle an existing tree, run these commands on the machine holding those files, outside the guest. Replace the source directory, login account and VM address with your own values:

Input — machine holding the application files; edit first:

tar -C /path/to/compat -czf /tmp/redbaron-compat.tar.gz linux
scp /tmp/redbaron-compat.tar.gz vmuser@VM_ADDRESS:/tmp/

Output — illustrative transfer progress; tar is silent and scp formatting varies:

redbaron-compat.tar.gz                      100% ...

The archive has linux/ at its top level. Back inside the FreeBSD guest, inspect it, then extract it under /compat:

Input — guest; copy/paste:

tar -tzf /tmp/redbaron-compat.tar.gz | head
mkdir -p /compat
tar -xzpf /tmp/redbaron-compat.tar.gz -C /compat
file -L /compat/linux/usr/lib/redbaron/redbaron_3.10
file -L /compat/linux/lib/ld-linux.so.1
ls /compat/linux/usr/lib/redbaron/help/index.htm

Output — recorded excerpt; archive order and file descriptions may vary slightly:

linux/
linux/usr/
linux/etc/
linux/lib/
...
/compat/linux/usr/lib/redbaron/redbaron_3.10: ELF 32-bit LSB executable, Intel i386, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux.so.1, not stripped
/compat/linux/lib/ld-linux.so.1: ELF 32-bit LSB shared object, Intel i386, version 1 (SYSV), dynamically linked, not stripped
/compat/linux/usr/lib/redbaron/help/index.htm

The browser and loader should be 32-bit i386 ELF files. /compat/linux is the compatibility tree Linuxulator uses for Linux paths such as /lib. The Linux Binary Compatibility Handbook chapter explains this arrangement.

Load the Linux/i386 support into the guest kernel. Check kldstat first and load each module below only if it is absent:

Input — guest; load only modules absent from kldstat:

kldstat
kldload linux_common
kldload linux

Output — recorded initial module list; IDs, addresses and sizes vary; successful kldload commands are silent:

Id Refs Address                Size Name
 1    1 0xffffffff80200000  213dea8 kernel

Create a small native FreeBSD shell launcher in the guest. It selects the old libraries and application resources, then replaces itself with the browser using exec. Clearing LD_PRELOAD prevents an injected library from changing the behavior we measure.

Input — guest; copy/paste the whole launcher-creation block:

cat > /usr/local/bin/redbaron <<'SH'
#!/bin/sh
export DISPLAY=${DISPLAY:-:1}
export HOME=/root
export REDBARON=/compat/linux/usr/lib/redbaron
export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/X11R6/lib
unset LD_PRELOAD
exec "$REDBARON/redbaron_3.10" "$@"
SH
chmod 755 /usr/local/bin/redbaron

Output — success is silent; the launcher file is created:

(no output)

Here redbaron is the launcher we just created, not a command supplied by FreeBSD. The executable remains the original file under /compat/linux.

3. Run the browser once before tracing

Still inside the guest, start it on a local help page:

Input — guest; copy/paste:

/usr/local/bin/redbaron -url file:/usr/lib/redbaron/help/index.htm

Output — recorded startup failure; the shell wording may vary:

Segmentation fault

On the measured unpatched kernel it exited with SIGSEGV, signal 11. That means the process made an invalid memory access; it does not yet identify the responsible code or the reason for that access.

If the loader reports a missing library, resolve the supplied runtime first. If the browser reports that it cannot open the display, resolve access to the already running Xvnc display. Neither message reproduces the startup SIGSEGV. A different snapshot might not reproduce the same failure; record what actually happens before assigning it a cause.

At this point we have a stock guest, the original application, and a repeatable application failure. We have not installed a custom test helper or changed the kernel to make a test pass.

4. Discover the syscall probes, then observe the startup

Our first question is broad: which operating-system interfaces does this Linux program call before it dies? The syscall provider is useful for that question because it observes system-call entry and return. We do not yet choose a particular call to blame.

A provider is a family of instrumentation events, called probes. DTrace probe names have four fields:

Reference — probe-name layout; not shell input:

provider:module:function:event

The fields have provider-specific meanings. For syscall, the module is the ABI, such as native freebsd or Linux/i386 linux32. The earlier file check established that this browser is a Linux/i386 executable; that is why we need the linux32 probes on this amd64 guest. The provider and ABI names are documented in dtrace_syscall(4).

Run these commands inside the guest. Check kldstat and load each module only if it is absent:

Input — guest; load only absent modules, then list probes:

kldstat
kldload dtraceall
kldload systrace_linux32
dtrace -l -P syscall
dtrace -l -n 'syscall:linux32::entry'

Output — illustrative excerpts from the two listings; IDs and the full probe list vary:

   ID   PROVIDER            MODULE                          FUNCTION NAME
...
<id>     syscall           linux32                              read entry
<id>     syscall           linux32                       linux_write entry
...
   ID   PROVIDER            MODULE                          FUNCTION NAME
...
<id>     syscall           linux32                              read entry
<id>     syscall           linux32                       linux_write entry
...

dtraceall enables the general tracing modules; the explicit systrace_linux32 load supplies the Linux/i386 syscall probes. -l lists probes without enabling them, and -P syscall selects the provider. In the last command, the empty function field means all Linux/i386 system calls. Read the MODULE and FUNCTION columns rather than copying numeric probe IDs, which can change between boots.

If that ABI has no probes, resolve its missing provider or mismatched modules before continuing. Normal DTrace library loading worked on the matching 16-CURRENT installation; no library-disabling option was needed. See the DTrace Handbook chapter for the tracing facilities and kernel configuration.

Now capture all syscall names, entry/return events and their first raw argument/result for this one process:

Input — guest; copy/paste:

dtrace -q -o /root/startup-syscalls.log -n '
syscall:linux32::entry,
syscall:linux32::return
/pid == $target/
{
    printf("%lld tid=%d %-24s %-6s arg0=0x%08x\n",
        timestamp, tid, probefunc, probename, (uint32_t)arg0);
}' -c '/usr/local/bin/redbaron -url file:/usr/lib/redbaron/help/index.htm'
sort -n /root/startup-syscalls.log | tail -n 40

Output — illustrative log format, not a captured broad run; timestamps, TIDs and other calls vary:

...
<timestamp> tid=<tid> linux_brk                entry  arg0=0x082ee290
<timestamp> tid=<tid> linux_brk                return arg0=0x082ef000

-c starts our native launcher under DTrace. It uses exec, so the PID selected by $target becomes the browser's PID. probefunc and probename print the function and event fields of each firing probe. The 32-bit cast matches the application ABI. arg0 is the first raw argument at entry, where the call has one, and the result at return; it is not a universal success flag. Timestamps allow the saved events to be sorted even if the process moves between CPUs.

A call near the end of the log is a lead, not proof of the cause. Failed file lookups can be normal library searching, and a process can corrupt memory long after an otherwise correct call. Inspect the candidate's arguments and documented result before narrowing the trace.

Pair entries and returns by thread and syscall name. One startup pair worth checking is linux_brk: request 0x082ee290, return 0x082ef000. Those values are also captured by the recorded focused replay below. The result lands exactly on the next 4 KiB boundary. To decide whether that matters, we must first look up what this call promises. A difference between an argument and a result is not itself a general syscall error, and the call's proximity to the crash does not establish causation.

5. Check the suspicious request against Linux's interface

Look up the operation identified by the trace. The program break is the logical end of the traditional data/heap area. An allocator can move it to obtain memory. The raw Linux brk syscall returns the accepted address on success and the current break if a change is refused. The C library's brk() and sbrk() functions have different return conventions; we are observing the raw syscall here. Linux brk(2), library/kernel differences.

Memory mappings use whole pages. A program can nevertheless have a logical break inside an already mapped page. A page boundary is therefore not an interchangeable answer to a request for a particular byte address. We need a focused entry/return pair to check whether that is happening. Discover its exact name and inspect its arguments first:

Input — guest; copy/paste:

dtrace -l -n 'syscall:linux32:*brk*:entry'
dtrace -lv -n 'syscall:linux32:linux_brk:return'

Output — recorded excerpts from both listings; probe IDs and attribute formatting vary:

   ID   PROVIDER            MODULE                          FUNCTION NAME
74651    syscall           linux32                         linux_brk entry
   ID   PROVIDER            MODULE                          FUNCTION NAME
74652    syscall           linux32                         linux_brk return
...
        Argument Types
                args[0]: int
                args[1]: int

Create /root/brk.d inside the guest:

Input — guest; copy/paste the whole script-creation block:

cat > /root/brk.d <<'DTRACE'
/* SPDX-License-Identifier: BSD-2-Clause */
#pragma D option quiet

syscall:linux32:linux_brk:entry
/pid == $target/
{
    self->requested = (uint32_t)arg0;
    self->in_brk = 1;
}

syscall:linux32:linux_brk:return
/pid == $target && self->in_brk/
{
    printf("pid=%d tid=%d request=0x%08x return=0x%08x errno=%d\n",
        pid, tid, (uint32_t)self->requested, (uint32_t)arg0, errno);
    self->in_brk = 0;
    self->requested = 0;
}
DTRACE

Output — success is silent; /root/brk.d is created:

(no output)

Input — guest; copy/paste:

dtrace -q -s /root/brk.d \
  -c '/usr/local/bin/redbaron -url file:/usr/lib/redbaron/help/index.htm'

Output — recorded focused trace; PID, TID and application addresses can vary:

pid=1647 tid=100084 request=0x082ee290 return=0x082ef000 errno=0

The result is larger than the request, matching page rounding. The per-thread self-> variables pair this thread's entry with its return; the separate flag also permits a zero-valued query. errno=0 describes the native syscall handling, not the C library's later interpretation of the returned address. Linux's raw brk interface also uses its returned break, rather than a conventional syscall error, to report refusal.

We now have a suspected ABI mismatch to investigate. That pair alone could also describe a refused change returning an existing break. We must check whether the helper accepted the request and where its value changed, then determine whether the invalid access follows from it.

6. Follow the syscall implementation before choosing a kernel probe

The syscall name gives us a source-code search term. Open linux_misc.c at the recorded kernel revision and find linux_brk. For a different CURRENT snapshot, use the revision reported by uname -a; an unrelated /usr/src tree can mislead us. The relevant unpatched code is:

Reference — kernel source excerpt; do not paste into the shell:

new = (uintptr_t)args->dsend;
if ((caddr_t)new > vm->vm_daddr && !kern_break(td, &new))
    td->td_retval[0] = (register_t)new;

new starts as the request. &new passes its address to kern_break, which can change it. The syscall then returns that variable. This gives us a concrete question: does that helper replace the requested value? We obtained the function name from the implementation, not from SIGSEGV.

The fbt provider instruments kernel function entry and return; that is why it is appropriate now. Check the available probe:

Input — guest; copy/paste:

dtrace -l -n 'fbt::kern_break:entry'

Output — recorded probe listing; its numeric ID may vary:

   ID   PROVIDER            MODULE                          FUNCTION NAME
66247        fbt            kernel                        kern_break entry

Follow the source's call to vm_unix.c:kern_break. Its second argument is a pointer to an address variable in its caller's kernel stack. Save that pointer at entry and read the same variable at return, before the caller resumes. Create /root/kern-break.d:

Input — guest; copy/paste the whole script-creation block:

cat > /root/kern-break.d <<'DTRACE'
/* SPDX-License-Identifier: BSD-2-Clause */
#pragma D option quiet

fbt::kern_break:entry
/pid == $target/
{
    self->addrp = arg1;
    self->before = *(uintptr_t *)arg1;
}

fbt::kern_break:return
/pid == $target && self->addrp != 0/
{
    printf("pid=%d tid=%d kern_break input=0x%lx output=0x%lx error=%d\n",
        pid, tid, (uintptr_t)self->before,
        *(uintptr_t *)self->addrp, (int)arg1);
    self->addrp = 0;
    self->before = 0;
}
DTRACE

Output — success is silent; /root/kern-break.d is created:

(no output)

Input — guest; copy/paste:

dtrace -q -s /root/kern-break.d \
  -c '/usr/local/bin/redbaron -url file:/usr/lib/redbaron/help/index.htm'

Output — recorded helper trace; PID, TID and addresses can vary:

pid=1650 tid=100206 kern_break input=0x82ee290 output=0x82ef000 error=0

This locates the change inside the helper. Its source rounds *addr for page mapping calculations and writes the rounded address back on success. linux_brk then returns that value unchanged to the Linux application.

For FBT return probes, arg1 is the C function's result; arg0 is the return-instruction offset. Here the C result is an error code, while the pointed-to variable contains the address. Those are separate results. kern_break is nonrecursive in this source, so one saved pointer per thread suffices. See dtrace_fbt(4).

7. Investigate the memory fault without assuming it is a null write

The syscall trace has found an incompatibility, but it has not identified the invalid memory access. We return to the original symptom: SIGSEGV. A user-mode page fault that cannot be resolved can lead to that signal, so the architecture's fault-handling path is a useful observation point. A syscall return probe cannot expose that saved fault context.

Read the amd64 exception handling in sys/amd64/amd64/trap.c at the same revision. Search for T_PAGEFLT and follow its call:

Reference — kernel source excerpt; do not paste into the shell:

pf = trap_pfault(frame, true, &signo, &ucode);

The helper is declared as:

Reference — kernel source excerpt; do not paste into the shell:

trap_pfault(struct trapframe *frame, bool usermode, int *signo, int *ucode)

That source explains both the name to look for and the arguments to use: the first points to the saved register frame; the second distinguishes user-mode faults. The helper reads frame->tf_addr as the fault address. The saved instruction pointer is tf_rip on this amd64 kernel, including when the user program is 32-bit. These are private kernel interfaces; check them against the source and available type information.

Discover that probe before using it:

Input — guest; copy/paste:

dtrace -l -n 'fbt::trap_pfault:entry'
dtrace -lv -n 'fbt::trap_pfault:entry'

Output — illustrative excerpts from the ordinary and verbose listings; ID and type formatting vary:

   ID   PROVIDER            MODULE                          FUNCTION NAME
<id>         fbt            kernel                       trap_pfault entry
   ID   PROVIDER            MODULE                          FUNCTION NAME
<id>         fbt            kernel                       trap_pfault entry
...
        Argument Types
                args[0]: struct trapframe *
...

Begin with all user-mode faults for the browser, without an address-zero filter. Save this as /root/page-faults.d inside the guest:

Input — guest; copy/paste the whole block to create the script and run it:

cat > /root/page-faults.d <<'DTRACE'
#pragma D option quiet

fbt::trap_pfault:entry
/pid == $target && execname == "redbaron_3.10" && arg1/
{
    printf("%lld user fault ip=%08x address=%08x error=%x\n",
        timestamp, (uint32_t)args[0]->tf_rip,
        (uint32_t)args[0]->tf_addr, (uint32_t)args[0]->tf_err);
}
DTRACE
dtrace -q -o /root/page-faults.log -s /root/page-faults.d \
  -c '/usr/local/bin/redbaron -url file:/usr/lib/redbaron/help/index.htm'
sort -n /root/page-faults.log | tail -n 20

Output — illustrative general-fault log, not a captured discovery run; timestamps and addresses vary:

...
<timestamp> user fault ip=2840643f address=00000000 error=6

The execname predicate excludes the native shell before it executes the browser, so these 32-bit address displays apply to the intended image. Many page faults are ordinary demand paging; observing one does not make it the crash. Examine the end of the trace and the process outcome. For the failure recorded here, the relevant register values are:

Saved field Value
Instruction pointer 0x2840643f
Fault address 0x00000000
x86 page-fault error 6

Error 6 denotes a user-mode write to a nonpresent page. Together with the process's SIGSEGV, this makes a null destination a concrete lead. We did not need to assume address zero to select the observation point. The recorded focused capture in step 9 includes these values.

8. Use the captured stack to find the application call site

We now have a reason to inspect the user stack at that null fault. Append a second clause to the script, filtering address zero after finding that address in the fault evidence. Initially print raw words, without assuming which C function or arguments they represent:

Input — guest; copy/paste once after creating /root/page-faults.d in step 7:

cat >> /root/page-faults.d <<'DTRACE'

fbt::trap_pfault:entry
/pid == $target && execname == "redbaron_3.10" &&
    arg1 && args[0]->tf_addr == 0/
{
    this->words = (uint32_t *)copyin(args[0]->tf_rsp, 16);
    printf("stack words: %08x %08x %08x %08x\n",
        this->words[0], this->words[1], this->words[2], this->words[3]);
    this->code = (uint8_t *)copyin(args[0]->tf_rip, 3);
    printf("instruction bytes: %02x %02x %02x\n",
        this->code[0], this->code[1], this->code[2]);
}
DTRACE
dtrace -q -o /root/page-faults.log -s /root/page-faults.d \
  -c '/usr/local/bin/redbaron -url file:/usr/lib/redbaron/help/index.htm'
tail -n 20 /root/page-faults.log

Output — illustrative raw-fault log, not a captured discovery run; the first stack word and addresses vary:

...
<timestamp> user fault ip=2840643f address=00000000 error=6
stack words: <word-0> 0807037e 00000000 0826bddd
instruction bytes: 88 04 11

copyin reads user memory safely through DTrace. The stack is Linux/i386, so we read 32-bit words even though the guest kernel is amd64. Do not reuse this layout for another ABI. The three bytes at the saved instruction pointer let us compare the live instruction with the file disassembly without assuming a shared library's load address.

Before interpreting addresses, fingerprint the actual files:

Input — guest; copy/paste:

sha256 /compat/linux/usr/lib/redbaron/redbaron_3.10
sha256 /compat/linux/lib/libc.so.5.3.12

Output — exact hashes for the supplied files:

SHA256 (/compat/linux/usr/lib/redbaron/redbaron_3.10) = 7d37ac54146bc9c23fb5f2eb1d0521d0d3e02737a97fccb0fc243252737d1d84
SHA256 (/compat/linux/lib/libc.so.5.3.12) = 2a2341f5d1e6c31f340efb42557babdb1229dcb978ef2ccf4088004e84bab555

These fingerprints identify the files used for the recorded addresses and disassembly below. Different files require their own inspection.

The recorded stack words at indexes 1, 2 and 3 were 0x0807037e, zero and 0x0826bddd. Those numbers are initially evidence, not yet labels such as return address or destination. Inspect the executable's loadable address ranges and symbols to place them. In less, use / to search and q to return to the shell:

Input — guest; copy/paste; press q to leave the nm listing in less:

readelf -l /compat/linux/usr/lib/redbaron/redbaron_3.10
nm -n /compat/linux/usr/lib/redbaron/redbaron_3.10 | less

Output — excerpts for the supplied executable; omitted lines and spacing vary:

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
...
  LOAD           0x000000 0x08000000 0x08000000 0x2adc43 0x2adc43 RWE 0x1000
  LOAD           0x2adc48 0x082aec48 0x082aec48 0x244fc 0x3f620 RW  0x1000
...
08070310 T main
08070690 T Main_CleanUp
...

Find the nearest preceding text symbol in the address-sorted nm output. Here 0x0807037e falls in the executable's text, within main. Now that we have identified the containing function, disassemble it:

Input — guest; copy/paste; find 807037e in less, then press q to leave:

objdump -d --disassemble-symbols=main \
  /compat/linux/usr/lib/redbaron/redbaron_3.10 | less

Output — disassembly excerpt for the supplied executable; mnemonics and spacing may vary:

08070310 <main>:
...
 8070360: e8 1b 12 0d 00       calll 0x8141580 <gcc2_compiled.>
 8070365: 83 c4 04             addl $0x4, %esp
 8070368: a3 6c a2 2e 08       movl %eax, 0x82ea26c
 807036d: a1 74 a2 2e 08       movl 0x82ea274, %eax
 8070372: 50                   pushl %eax
 8070373: a1 6c a2 2e 08       movl 0x82ea26c, %eax
 8070378: 50                   pushl %eax
 8070379: e8 4a 5e f9 ff       calll 0x80061c8 <strcpy@plt>
 807037e: 83 c4 08             addl $0x8, %esp
...

That makes the stack word a candidate return address from strcpy. The earlier call's address can be looked up directly rather than guessing its name:

Input — guest; copy/paste:

nm /compat/linux/usr/lib/redbaron/redbaron_3.10 | grep '^08141580 '
objdump -d --disassemble-symbols=SM_Malloc \
  /compat/linux/usr/lib/redbaron/redbaron_3.10
objdump -d --disassemble-symbols=strcpy /compat/linux/lib/libc.so.5.3.12

Output — selected symbol and instruction lines for the supplied binaries; formatting may vary:

08141580 T SM_Malloc
08141580 t gcc2_compiled.
...
08141580 <SM_Malloc>:
...
 8141587: e8 9c 52 ec ff       calll 0x8006828 <malloc@plt>
...
0006d42c <strcpy>:
   6d42c: 56                   pushl %esi
   6d42d: 8b 74 24 08          movl 0x8(%esp), %esi
   6d431: 8b 54 24 0c          movl 0xc(%esp), %edx
...
   6d43f: 88 04 11             movb %al, (%ecx,%edx)
...

nm names 0x08141580 as SM_Malloc; disassembly may label the same address gcc2_compiled. because symbols share it. Its body calls malloc@plt and returns that result unchanged. The browser saves that allocation result and passes it directly to strcpy.

This libc's strcpy begins by pushing %esi; its destination is then at 8(%esp) and its source at 12(%esp). At its copying store the stack therefore contains four 32-bit words: saved %esi, caller return address, destination, source. That establishes why the captured zero is the destination, rather than assuming that interpretation in the first fault trace. The store at libc offset 0x6d43f is:

Reference — instruction from the disassembly; not shell input:

88 04 11    movb %al,(%ecx,%edx)

Compare those instruction bytes with the live capture. With the registers recorded below, %ecx + %edx wraps to zero in 32-bit arithmetic, consistent with the fault address. This confirms the copying-store interpretation.

We also need to connect the syscall mismatch to allocation failure. Now that the trace has identified brk, inspect the library functions that wrap it, using their symbol names rather than unexplained address ranges:

Input — guest; copy/paste:

nm /compat/linux/lib/libc.so.5.3.12 | grep -E 'sbrk|morecore'
readelf -r /compat/linux/lib/libc.so.5.3.12 | grep -E 'sbrk|morecore'
objdump -d --disassemble-symbols=sbrk /compat/linux/lib/libc.so.5.3.12
objdump -d --disassemble-symbols=__default_morecore,__default_morecore_init \
  /compat/linux/lib/libc.so.5.3.12

Output — selected symbols, relocations and instructions for the supplied libc; spacing may vary:

0003abac T __default_morecore
0003abd0 T __default_morecore_init
000962ac D __morecore
000182d4 T __sbrk
000182d4 W sbrk
...
000984cc  0000e307 R_386_JUMP_SLOT        000182d4   __sbrk
...
000182d4 <sbrk>:
...
   18305: cd 80                int $0x80
...
   18318: 39 cf                cmpl %ecx, %edi
   1831a: 75 0c                jne 0x18328 <sbrk+0x54>
...
   1832d: c7 00 0c 00 00 00    movl $0xc, (%eax)
   18333: b8 ff ff ff ff       movl $0xffffffff, %eax
...
0003abac <__default_morecore>:
...
   3abc6: 83 f8 ff             cmpl $-0x1, %eax
   3abc9: 75 02                jne 0x3abcd <__default_morecore+0x21>
   3abcb: 31 c0                xorl %eax, %eax
...

sbrk issues Linux/i386 syscall 45 with int $0x80. At 0x18318 it compares the returned break with its requested address. A difference branches to code setting libc's errno to ENOMEM (12) and returning (void *)-1. The morecore helpers convert that failure to a null result. This library error occurs after the syscall provider reported errno=0. No live SM_Malloc:return event is claimed: the captured stack and these instructions establish the application-level connection.

9. Capture the complete sequence with the verified decoder

Only now do we use a fault script that labels the stack words as strcpy arguments and reads the source string. This decoder is specific to the executable, libc and prologue just checked. Create /root/fault.d:

Input — guest; copy/paste the whole script-creation block:

cat > /root/fault.d <<'DTRACE'
/* SPDX-License-Identifier: BSD-2-Clause */
#pragma D option quiet

/* amd64 kernel, Linux/i386 user stack; verify this libc's prologue first. */
fbt::trap_pfault:entry
/pid == $target && arg1 && args[0]->tf_addr == 0/
{
    this->f = args[0];
    printf("NULL fault ip=%x address=%x error=%x si=%x cx=%x dx=%x\n",
        (uint32_t)this->f->tf_rip, (uint32_t)this->f->tf_addr,
        (uint32_t)this->f->tf_err, (uint32_t)this->f->tf_rsi,
        (uint32_t)this->f->tf_rcx, (uint32_t)this->f->tf_rdx);
    this->words = (uint32_t *)copyin(this->f->tf_rsp, 16);
    printf("strcpy returnpc=%x destination=%x source=%x text=%s\n",
        this->words[1], this->words[2], this->words[3],
        copyinstr((uintptr_t)this->words[3]));
}
DTRACE

Output — success is silent; /root/fault.d is created:

(no output)

Run the three focused scripts together so their evidence comes from one browser process:

Input — guest; copy/paste:

cat /root/brk.d /root/kern-break.d /root/fault.d > /root/combined.d
dtrace -q -s /root/combined.d \
  -c '/usr/local/bin/redbaron -url file:/usr/lib/redbaron/help/index.htm'
printf 'tracer exit: %s\n' "$?"

Output — recorded combined trace; PID, TID and addresses can vary; tracer status 0 is not browser success:

pid=1664 tid=100071 kern_break input=0x82ee290 output=0x82ef000 error=0
pid=1664 tid=100071 request=0x082ee290 return=0x082ef000 errno=0
NULL fault ip=2840643f address=0 error=6 si=0 cx=f7d94222 dx=826bdde
strcpy returnpc=807037e destination=0 source=826bddd text=Spyglass
tracer exit: 0

This sequence was reproduced twice in the stock guest. It connects the rounded break return with a later strcpy(NULL, "Spyglass") write. The library rejects the mismatching address; the browser then fails to check its allocation result. These are distinct compatibility and application problems.

DTrace itself exited zero when the browser died from SIGSEGV. That status means the tracing session completed, not that the browser succeeded. Its buffer-reduction message (2m here) was also present; the recorded runs reported no dropped probes or invalid-memory errors.

10. Save the evidence and stop the guest

The syscall provider answered what crossed the Linux ABI boundary. Source inspection then selected fbt probes for two different questions: where the break changed and what memory access faulted. Neither the syscall names nor the application-specific stack decoder were known just from the original SIGSEGV message.

A separate attempt to use pid$target::SM_Malloc:return with the native launcher did not match a probe. That result does not establish that all Linux user-function probes are unsupported; the launcher initially runs a native shell. The working focused measurements use kernel probes and explicit decoding of the application's 32-bit state.

Save the guest terminal transcript, then shut down this guest:

Input — guest; copy/paste only when finished with this guest:

reboot -p

Output — recorded shutdown excerpt; services, timing and intermediate lines vary:

...
All buffers synced.
Uptime: 15m47s
acpi0: Powering system off...

From the observations to the compatibility fix

The first incorrect result is the rounded address at the Linux syscall boundary. The later null write is the application consequence: libc5 rejects that result, allocation fails, and Red Baron uses the failed allocation without checking it. The kernel correction restores the expected Linux interface; it does not make ignoring allocation failure safe application behavior.

The consolidated kernel patch addresses the observed mismatch and the state needed to keep it fixed:

Observation or requirement Kernel change
Linux sees 0x082ef000 after requesting 0x082ee290. Keep page rounding for mappings, but track the exact logical break in vmspace.vm_brk and return it to Linux.
The request is inside the final mapped ELF page. Seed vm_brk_min from the main executable's exact memory end, including BSS: 0x082ee268 here. The request 0x082ee290 is above that floor and can succeed without adding a page.
Later queries and refused changes need the previous exact address. Preserve logical state across calls; update it only after a successful resize. A low query does not overwrite it.
Shared address spaces and fork can race with a resize. Update state and capture the caller's result under the VM-map lock; copy it under that lock during fork. Reset it on exec.
Native FreeBSD callers still expect page-based results. Select Linux semantics explicitly in kern_break; retain native behavior.

Returning the original request unconditionally would falsely claim success when mapping or limit checks fail. Returning an exact value while refusing all requests below the rounded initial break would also leave this browser broken. Both the logical value and the ELF floor matter.

The ELF memory floor is independently inspectable: nm shows _end at 0x082ee268, and the last loadable segment's virtual address plus its memory size in readelf -l gives that same end, including BSS. The observed request is 40 bytes above it, but below 0x082ef000.

The regression tests and previous patched-guest validation cover those cases: 28 general Linux checks, the libc5 first-request case, a native FreeBSD case, and Red Baron starting without an allocator preload. That positive control used a separate patched guest. This fresh stock VM run establishes the failing baseline and diagnosis; it did not boot a patched GENERIC kernel. Kernel and modules must be rebuilt together for the compatibility fix because it changes kernel interfaces.

DTrace verifies the paths shown here; it does not prove every boundary, mapping or concurrency property. Kernel function names and trap-frame fields are private interfaces, so check them again on another architecture or source revision.

Optional: what is /brk-suite legacy?

Nothing above requires that command. brk-suite is a project-written, freestanding Linux/i386 test program, not a FreeBSD utility. The custom test image installs it at /brk-suite; a stock VM does not contain it. Its legacy argument selects a regression that requests a break 40 bytes above its own ELF memory end before any initial query, independently of Red Baron or libc. Source and build instructions are in brk-test/brk-suite.c and README.md. It belongs after the diagnosis as an independent regression test.

Recorded environment and validation limits

The focused scripts in steps 5, 6 and 9 were executed on 2026-10-29 in a new bhyve VM with two CPUs, 1 GiB RAM and the official UFS raw image:

Reference — recorded image filename and checksum; not shell input:

FreeBSD-16.0-CURRENT-amd64-ufs-20261027-61c70dc16a79-290352.raw.xz
compressed SHA256:
077d9871650ae266b71b4124ef8f508c15ae71c225311758375d7266a937d740

The compressed download matched the published snapshot checksum. The booted kernel was FreeBSD 16.0-CURRENT #0 main-n290352-61c70dc16a79, with uname -K reporting 1600029. Installed kernel and userland both reported 16.0-CURRENT. Xvnc was prepared before the application tests. The baseline launch crashed; individual syscall/helper traces worked; the combined focused trace reproduced the displayed sequence twice. The generated console transcript is dtrace-test/stock16.log locally.

The broad startup and general/raw fault-discovery passes were added on 2026-10-30 to make the probe-selection procedure explicit. Their shell syntax and source assumptions were checked, but they have not yet been executed in the guest. Their instructions are separate from the recorded focused measurements; no new broad-trace transcript is presented as a measured result. The symbol-based disassembly commands were checked against the supplied binaries in the build environment.

Images, logs, supplied application files and credentials are not committed. The optional dtrace-test harness is a separate minimal-image setup; this procedure does not require its preinstalled scripts, test helper or copied userland tools.