Skip to content

SIGTRAP in macOS call stack upon wg-quick down #443

@ink-splatters

Description

@ink-splatters

What

tearing down a tunnel, created with wg-quick crashes boringtun.

Callstack looks strange and it might be that it's macOS issue.

How to reproduce

❯ git clone https://github.com/cloudflare/boringtun.git && cd boringtun
...
❯ git checkout boringtun-cli-0.5.2
❯ cargo build
...
❯ sudo WG_QUICK_USERSPACE_IMPLEMENTATION=./target/debug/boringtun-cli WG_SUDO=1 wg-quick up wg1
[#] ./target/debug/boringtun-cli utun
BoringTun started successfully
[+] Interface for wg1 is utun6
[#] wg setconf utun6 /dev/fd/63
[#] ifconfig utun6 inet 10.2.0.2/32 10.2.0.2 alias
[#] ifconfig utun6 mtu 1420
[#] ifconfig utun6 up
[#] route -q -n add -inet 0.0.0.0/1 -interface utun6
[#] route -q -n add -inet 128.0.0.0/1 -interface utun6
[#] route -q -n add -inet 185.184.192.194 -gateway 172.20.10.1
[#] networksetup -getdnsservers Wi-Fi
[#] networksetup -getsearchdomains Wi-Fi
[#] networksetup -getdnsservers iPhone USB
[#] networksetup -getsearchdomains iPhone USB
[#] networksetup -setdnsservers iPhone USB 10.2.0.1
[#] networksetup -setsearchdomains iPhone USB Empty
[#] networksetup -setdnsservers Wi-Fi 10.2.0.1
[#] networksetup -setsearchdomains Wi-Fi Empty
[+] Backgrounding route monitor

❯ wg-quick down wg1

Environment

❯ sw_vers
ProductName:		macOS
ProductVersion:		15.5
BuildVersion:		24F74

❯ rustc --version
rustc 1.88.0-nightly (b45dd71d1 2025-04-30)

❯ ./target/debug/boringtun-cli --version
boringtun 0.5.2

Crash report

Click to reveal
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               boringtun-cli [55137]
Path:                  /Volumes/VOLUME/*/boringtun-cli
Identifier:            boringtun-cli
Version:               ???
Code Type:             ARM-64 (Native)
Parent Process:        launchd [1]
Responsible:           .kitty-wrapped [711]
User ID:               0

Date/Time:             2025-05-25 12:50:27.4230 +0200
OS Version:            macOS 15.5 (24F74)
Report Version:        12
Anonymous UUID:        9C9F57BE-776C-CC17-CEC2-DC92DD607717

Sleep/Wake UUID:       C0C517FF-3E43-4474-8991-04F75E20ECB4

Time Awake Since Boot: 18000 seconds
Time Since Wake:       1009 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BREAKPOINT (SIGTRAP)
Exception Codes:       0x0000000000000001, 0x0000000184a27890

Termination Reason:    Namespace SIGNAL, Code 5 Trace/BPT trap: 5
Terminating Process:   exc handler [55137]

Application Specific Information:
BUG IN LIBDISPATCH: mach semaphore API failure
Abort Cause 20
crashed on child side of fork pre-exec


Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libdispatch.dylib             	       0x184a27890 <deduplicated_symbol> + 36
1   libdispatch.dylib             	       0x1849f4944 _dispatch_sema4_signal + 84
2   libdispatch.dylib             	       0x1849f4e40 _dispatch_semaphore_signal_slow + 52
3   boringtun-cli                 	       0x1027949a4 crossbeam_channel::waker::SyncWaker::notify::ha918344363a3157c (.2351) + 304
4   boringtun-cli                 	       0x102793c40 crossbeam_channel::flavors::array::Channel$LT$T$GT$::send::h6686a404576dccaa + 1160
5   boringtun-cli                 	       0x1026e6910 core::ptr::drop_in_place$LT$tracing_appender..non_blocking..WorkerGuard$GT$::h590e6cb656dcbcae + 156
6   boringtun-cli                 	       0x1026ee18c boringtun_cli::main::h44c5ad7657fa4cae + 16824
7   boringtun-cli                 	       0x1026dfad4 std::sys::backtrace::__rust_begin_short_backtrace::h60248d4ec77c2aea + 12
8   boringtun-cli                 	       0x1026f1c74 main + 800
9   dyld                          	       0x18480ab98 start + 6076


Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000014   x1: 0x0000000000000001   x2: 0xffffffffffffffe0   x3: 0x0000000155a04160
    x4: 0x0000000155a041c0   x5: 0x0000000000000006   x6: 0x0000000000000002   x7: 0x0000000000000000
    x8: 0x0000000000000014   x9: 0x0000000000000001  x10: 0x0000000000000001  x11: 0x0000600002de8018
   x12: 0x00006000007e8000  x13: 0x0000000000000000  x14: 0x000000016d932db0  x15: 0x00006000007e8020
   x16: 0xffffffffffffffdf  x17: 0x00000001f3d0b018  x18: 0x0000000000000000  x19: 0x0000000000000001
   x20: 0x0000600002aec950  x21: 0x0000000000000000  x22: 0x0000000000000001  x23: 0x0000000184bb40f8
   x24: 0x00000001027f5000  x25: 0x000000016d723568  x26: 0x000000016d723550  x27: 0x000000016d723558
   x28: 0x0000000000000000   fp: 0x000000016d7234d0   lr: 0x00000001849f4944
    sp: 0x000000016d7234c0   pc: 0x0000000184a27890 cpsr: 0x20001000
   far: 0x0000000000000000  esr: 0xf2000001 (Breakpoint) brk 1

Binary Images:
       0x1026d4000 -        0x1027e7fff boringtun-cli (*) <e1ea688a-4574-3527-ac8c-c60adc9ca3cb> /Volumes/VOLUME/*/boringtun-cli
       0x102850000 -        0x10285bfff libiconv.2.dylib (*) <2d687cdf-f723-3547-8946-2dabf06d638c> /Volumes/VOLUME/*/libiconv.2.dylib
       0x102868000 -        0x10286bfff libcharset.1.dylib (*) <63395f9b-af03-33ad-9a92-d8913146c763> /Volumes/VOLUME/*/libcharset.1.dylib
       0x1849f1000 -        0x184a3773f libdispatch.dylib (*) <8bf83cda-8db1-3d46-94b0-d811bd77e078> /usr/lib/system/libdispatch.dylib
       0x184804000 -        0x18489f4cf dyld (*) <9cf0401a-a938-389e-a77d-9e9608076ccf> /usr/lib/dyld
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???
       0x184bb1000 -        0x184be0ba3 libdyld.dylib (*) <c62596fe-63c5-3502-bbd1-14147a7ca921> /usr/lib/system/libdyld.dylib

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 6
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=845.4M resident=0K(0%) swapped_out_or_unallocated=845.4M(100%)
Writable regions: Total=679.9M written=209K(0%) resident=209K(0%) swapped_out=0K(0%) unallocated=679.7M(100%)

                                VIRTUAL   REGION
REGION TYPE                        SIZE    COUNT (non-coalesced)
===========                     =======  =======
Activity Tracing                   256K        1
Kernel Alloc Once                   32K        1
MALLOC                           669.2M       18
MALLOC guard page                   96K        6
Stack                             10.0M        2
Stack Guard                       56.0M        2
VM_ALLOCATE                         48K        3
VM_ALLOCATE (reserved)             256K        2         reserved VM address space (unallocated)
__AUTH                             822K      161
__AUTH_CONST                      12.8M      295
__DATA                            3254K      277
__DATA_CONST                      10.8M      298
__DATA_DIRTY                       452K       88
__FONT_DATA                        2352        1
__LINKEDIT                       615.7M        4
__OBJC_RO                         61.4M        1
__OBJC_RW                         2396K        1
__TEXT                           229.8M      307
__TPRO_CONST                       128K        2
page table in kernel               209K        1
shared memory                       32K        1
===========                     =======  =======
TOTAL                              1.6G     1472
TOTAL, minus reserved VM space     1.6G     1472



-----------
Full Report
-----------

{"app_name":"boringtun-cli","timestamp":"2025-05-25 12:50:27.00 +0200","app_version":"","slice_uuid":"e1ea688a-4574-3527-ac8c-c60adc9ca3cb","build_version":"","platform":1,"share_with_app_devs":0,"is_first_party":1,"bug_type":"309","os_version":"macOS 15.5 (24F74)","roots_installed":0,"incident_id":"4F2B74B1-DB0A-40B5-A6C0-A6E41905E0AC","name":"boringtun-cli"}
{
  "uptime" : 18000,
  "procRole" : "Unspecified",
  "version" : 2,
  "userID" : 0,
  "deployVersion" : 210,
  "modelCode" : "MacBookAir10,1",
  "coalitionID" : 752,
  "osVersion" : {
    "train" : "macOS 15.5",
    "build" : "24F74",
    "releaseType" : "User"
  },
  "captureTime" : "2025-05-25 12:50:27.4230 +0200",
  "codeSigningMonitor" : 1,
  "incident" : "4F2B74B1-DB0A-40B5-A6C0-A6E41905E0AC",
  "pid" : 55137,
  "translated" : false,
  "cpuType" : "ARM-64",
  "roots_installed" : 0,
  "bug_type" : "309",
  "procLaunch" : "2025-05-25 12:50:26.4171 +0200",
  "procStartAbsTime" : 442713871585,
  "procExitAbsTime" : 442737998701,
  "procName" : "boringtun-cli",
  "procPath" : "\/Volumes\/VOLUME\/*\/boringtun-cli",
  "parentProc" : "launchd",
  "parentPid" : 1,
  "coalitionName" : "net.kovidgoyal.kitty",
  "crashReporterKey" : "9C9F57BE-776C-CC17-CEC2-DC92DD607717",
  "appleIntelligenceStatus" : {"state":"unavailable","reasons":["assetIsNotReady","notOptedIn","siriAssetIsNotReady"]},
  "responsiblePid" : 711,
  "responsibleProc" : ".kitty-wrapped",
  "codeSigningID" : "boringtun-cli",
  "codeSigningTeamID" : "",
  "codeSigningFlags" : 570556929,
  "codeSigningValidationCategory" : 10,
  "codeSigningTrustLevel" : 4294967295,
  "codeSigningAuxiliaryInfo" : 0,
  "instructionByteStream" : {"beforePC":"IAAg1Ah8QJP0V7+pVAAAsJT6FpE15DWQteIikbQGAPmoHgD59FfBqA==","atPC":"IAAg1OgDACr0V7+pVAAAsJS2F5E15DWQteIikbQGAPmoHgD59FfBqA=="},
  "bootSessionUUID" : "41E6780E-FC4D-4165-8001-F57F89AFB570",
  "wakeTime" : 1009,
  "sleepWakeUUID" : "C0C517FF-3E43-4474-8991-04F75E20ECB4",
  "sip" : "enabled",
  "exception" : {"codes":"0x0000000000000001, 0x0000000184a27890","rawCodes":[1,6520207504],"type":"EXC_BREAKPOINT","signal":"SIGTRAP"},
  "termination" : {"flags":0,"code":5,"namespace":"SIGNAL","indicator":"Trace\/BPT trap: 5","byProc":"exc handler","byPid":55137},
  "os_fault" : {"process":"boringtun-cli"},
  "asi" : {"libdispatch.dylib":["BUG IN LIBDISPATCH: mach semaphore API failure","Abort Cause 20"],"libsystem_c.dylib":["crashed on child side of fork pre-exec"]},
  "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":6},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
  "faultingThread" : 0,
  "threads" : [{"triggered":true,"id":424052,"threadState":{"x":[{"value":20},{"value":1},{"value":18446744073709551584},{"value":5731533152},{"value":5731533248},{"value":6},{"value":2},{"value":0},{"value":20},{"value":1},{"value":1},{"value":105553164402712},{"value":105553124556800},{"value":0},{"value":6133329328},{"value":105553124556832},{"value":18446744073709551583},{"value":8385507352},{"value":0},{"value":1},{"value":105553161275728},{"value":0},{"value":1},{"value":6521831672,"symbolLocation":0,"symbol":"_tlv_get_addr"},{"value":4336865280,"symbolLocation":608,"symbol":"_MergedGlobals"},{"value":6131168616},{"value":6131168592},{"value":6131168600},{"value":0}],"flavor":"ARM_THREAD_STATE64","lr":{"value":6519998788},"cpsr":{"value":536875008},"fp":{"value":6131168464},"sp":{"value":6131168448},"esr":{"value":4060086273,"description":"(Breakpoint) brk 1"},"pc":{"value":6520207504,"matchesCrashFrame":1},"far":{"value":0}},"queue":"com.apple.main-thread","frames":[{"imageOffset":223376,"symbol":"<deduplicated_symbol>","symbolLocation":36,"imageIndex":3},{"imageOffset":14660,"symbol":"_dispatch_sema4_signal","symbolLocation":84,"imageIndex":3},{"imageOffset":15936,"symbol":"_dispatch_semaphore_signal_slow","symbolLocation":52,"imageIndex":3},{"imageOffset":788900,"symbol":"crossbeam_channel::waker::SyncWaker::notify::ha918344363a3157c (.2351)","symbolLocation":304,"imageIndex":0},{"imageOffset":785472,"symbol":"crossbeam_channel::flavors::array::Channel$LT$T$GT$::send::h6686a404576dccaa","symbolLocation":1160,"imageIndex":0},{"imageOffset":76048,"symbol":"core::ptr::drop_in_place$LT$tracing_appender..non_blocking..WorkerGuard$GT$::h590e6cb656dcbcae","symbolLocation":156,"imageIndex":0},{"imageOffset":106892,"symbol":"boringtun_cli::main::h44c5ad7657fa4cae","symbolLocation":16824,"imageIndex":0},{"imageOffset":47828,"symbol":"std::sys::backtrace::__rust_begin_short_backtrace::h60248d4ec77c2aea","symbolLocation":12,"imageIndex":0},{"imageOffset":121972,"symbol":"main","symbolLocation":800,"imageIndex":0},{"imageOffset":27544,"symbol":"start","symbolLocation":6076,"imageIndex":4}]}],
  "usedImages" : [
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 4335681536,
    "size" : 1130496,
    "uuid" : "e1ea688a-4574-3527-ac8c-c60adc9ca3cb",
    "path" : "\/Volumes\/VOLUME\/*\/boringtun-cli",
    "name" : "boringtun-cli"
  },
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 4337238016,
    "size" : 49152,
    "uuid" : "2d687cdf-f723-3547-8946-2dabf06d638c",
    "path" : "\/Volumes\/VOLUME\/*\/libiconv.2.dylib",
    "name" : "libiconv.2.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 4337336320,
    "size" : 16384,
    "uuid" : "63395f9b-af03-33ad-9a92-d8913146c763",
    "path" : "\/Volumes\/VOLUME\/*\/libcharset.1.dylib",
    "name" : "libcharset.1.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6519984128,
    "size" : 288576,
    "uuid" : "8bf83cda-8db1-3d46-94b0-d811bd77e078",
    "path" : "\/usr\/lib\/system\/libdispatch.dylib",
    "name" : "libdispatch.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6517964800,
    "size" : 636112,
    "uuid" : "9cf0401a-a938-389e-a77d-9e9608076ccf",
    "path" : "\/usr\/lib\/dyld",
    "name" : "dyld"
  },
  {
    "size" : 0,
    "source" : "A",
    "base" : 0,
    "uuid" : "00000000-0000-0000-0000-000000000000"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6521819136,
    "size" : 195492,
    "uuid" : "c62596fe-63c5-3502-bbd1-14147a7ca921",
    "path" : "\/usr\/lib\/system\/libdyld.dylib",
    "name" : "libdyld.dylib"
  }
],
  "sharedCache" : {
  "base" : 6517129216,
  "size" : 5047205888,
  "uuid" : "d7397d7f-8df9-3920-81a7-c0a144be9c51"
},
  "vmSummary" : "ReadOnly portion of Libraries: Total=845.4M resident=0K(0%) swapped_out_or_unallocated=845.4M(100%)\nWritable regions: Total=679.9M written=209K(0%) resident=209K(0%) swapped_out=0K(0%) unallocated=679.7M(100%)\n\n                                VIRTUAL   REGION \nREGION TYPE                        SIZE    COUNT (non-coalesced) \n===========                     =======  ======= \nActivity Tracing                   256K        1 \nKernel Alloc Once                   32K        1 \nMALLOC                           669.2M       18 \nMALLOC guard page                   96K        6 \nStack                             10.0M        2 \nStack Guard                       56.0M        2 \nVM_ALLOCATE                         48K        3 \nVM_ALLOCATE (reserved)             256K        2         reserved VM address space (unallocated)\n__AUTH                             822K      161 \n__AUTH_CONST                      12.8M      295 \n__DATA                            3254K      277 \n__DATA_CONST                      10.8M      298 \n__DATA_DIRTY                       452K       88 \n__FONT_DATA                        2352        1 \n__LINKEDIT                       615.7M        4 \n__OBJC_RO                         61.4M        1 \n__OBJC_RW                         2396K        1 \n__TEXT                           229.8M      307 \n__TPRO_CONST                       128K        2 \npage table in kernel               209K        1 \nshared memory                       32K        1 \n===========                     =======  ======= \nTOTAL                              1.6G     1472 \nTOTAL, minus reserved VM space     1.6G     1472 \n",
  "legacyInfo" : {
  "threadTriggered" : {
    "queue" : "com.apple.main-thread"
  }
},
  "logWritingSignature" : "e3d4efac61fdc2d97af2b68aaf30ff1e049cdeb0",
  "trialInfo" : {
  "rollouts" : [
    {
      "rolloutId" : "670ea6eb7a111748a97092a4",
      "factorPackIds" : {
        "SIRI_TEXT_TO_SPEECH" : "681bf70f044c4d6ae58991c1"
      },
      "deploymentId" : 240000127
    },
    {
      "rolloutId" : "66d35d7fe4d6bf7664f40ddf",
      "factorPackIds" : {
        "BLACKPEARL_SPARROW" : "67c7824a1baae429bb41b897"
      },
      "deploymentId" : 240000031
    }
  ],
  "experiments" : [

  ]
}
}

Model: MacBookAir10,1, BootROM 11881.121.1, proc 8:4:4 processors, 16 GB, SMC
Graphics: Apple M1, Apple M1, Built-In
Display: Color LCD, 2560 x 1600 Retina, Main, MirrorOff, Online
Memory Module: LPDDR4, Hynix
AirPort: spairport_wireless_card_type_wifi (0x14E4, 0x4378), wl0: Dec  7 2024 04:41:25 version 18.90.5.0.7.8.177 FWID 01-02f4dc53
IO80211_driverkit-1475.39 "IO80211_driverkit-1475.39" Apr 18 2025 20:10:40
AirPort:
Bluetooth: Version (null), 0 services, 0 devices, 0 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
USB Device: USB31Bus
USB Device: USB31Bus
Thunderbolt Bus: MacBook Air, Apple Inc.
Thunderbolt Bus: MacBook Air, Apple Inc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions