[Bug 290958] ctfmerge: random Segmentation fault: 11 for `make buildkernel' on macOS

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 11 Nov 2025 19:11:25 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=290958

            Bug ID: 290958
           Summary: ctfmerge: random Segmentation fault: 11 for `make
                    buildkernel' on macOS
           Product: Base System
           Version: 14.3-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: misc
          Assignee: bugs@FreeBSD.org
          Reporter: wosch@FreeBSD.org

I'm running `make buildkernel' on macOS (cross compiling) and sometimes
ctfmerge crashes with a Segmentation fault: 11. The errors are random, and not
for the same call.

libsystem_pthread.dylib
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00004bbc62118008
Exception Codes: 0x0000000000000001, 0x00004bbc62118008
Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11

This seems to be a problem with the macOS pthread library, or the use of the
lib. It happens on arm and intel, and the latest macOS 26.

I run `make cleankernel; make buildkernel' in a loop 100 times (ca. 2hours) and
usually in 3-5 cases ctfmerge will crash.


Example:

for i in $(seq 1 100); do printf "."; env logrotate_max=100 debug=0
build_targets='cleankernel;buildkernel' cross-build-macos.sh >/dev/null 2>&1 ||
echo " i=$i exit=$?";done

.......... i=10 exit=2
. i=11 exit=2
.............................................. i=57 exit=2
....... i=64 exit=2
............................ i=92 exit=2
........

sh: line 2: 64617 Segmentation fault: 11 ctfmerge -L VERSION -g -o ipl.kld
mlfk_ipl.o ip_nat.o ip_frag.o ip_state.o ip_proxy.o ip_auth.o ip_log.o
ip_fil_freebsd.o fil.o ip_lookup.o ip_pool.o ip_htable.o ip_sync.o ip_nat6.o
ip_rules.o ip_scan.o ip_dstlist.o radix_ipf.o
*** [ipl.kld] Error code 139

zegrep -l 'Segmentation fault' macos.buildkernel*gz
macos.buildkernel.35.gz
macos.buildkernel.42.gz
macos.buildkernel.7.gz
macos.buildkernel.88.gz
macos.buildkernel.89.gz

-- 
You are receiving this mail because:
You are the assignee for the bug.