Skip to content

Trace/BPT trap (SIGTRAP) in v8::base::OS::SetPermissions on Intel macOS — x86_64 binary is missing the allow-unsigned-executable-memory entitlement #27422

Description

@DerSchiman

What version of Codex CLI is running?

codex-cli 0.139.0 (also reproduced on 0.138.0)

What subscription do you have?

ChatGPT Plus

Which model were you using?

gpt-5.5

What platform is your computer?

Darwin 24.6.0 x86_64 i386 (macOS 15.7.7 / 24G720, Intel Core i7-8700B, Mac mini 2018)

What terminal emulator and version are you using (if applicable)?

iTerm2 3.6.11, no multiplexer

Codex doctor report

codex doctor --json (username redacted, otherwise unmodified)
{
  "schemaVersion": 1,
  "generatedAt": "1781077584s since unix epoch",
  "overallStatus": "warning",
  "codexVersion": "0.139.0",
  "checks": {
    "app_server.status": {
      "id": "app_server.status",
      "category": "app-server",
      "status": "ok",
      "summary": "background server is not running",
      "details": {
        "control socket": "/Users/REDACTED/.codex/app-server-control/app-server-control.sock",
        "daemon state dir": "/Users/REDACTED/.codex/app-server-daemon",
        "mode": "ephemeral",
        "pid file": "/Users/REDACTED/.codex/app-server-daemon/app-server.pid (missing)",
        "settings": "/Users/REDACTED/.codex/app-server-daemon/settings.json (missing)",
        "status": "not running",
        "update-loop pid file": "/Users/REDACTED/.codex/app-server-daemon/app-server-updater.pid (missing)"
      },
      "remediation": null,
      "durationMs": 0
    },
    "auth.credentials": {
      "id": "auth.credentials",
      "category": "auth",
      "status": "ok",
      "summary": "auth is configured",
      "details": {
        "auth file": "/Users/REDACTED/.codex/auth.json",
        "auth storage mode": "File",
        "stored API key": "false",
        "stored ChatGPT tokens": "true",
        "stored agent identity": "false",
        "stored auth mode": "chatgpt"
      },
      "remediation": null,
      "durationMs": 0
    },
    "config.load": {
      "id": "config.load",
      "category": "config",
      "status": "ok",
      "summary": "config loaded",
      "details": {
        "CODEX_HOME": "/Users/REDACTED/.codex",
        "config.toml": "/Users/REDACTED/.codex/config.toml",
        "config.toml parse": "ok",
        "cwd": "/Users/REDACTED",
        "enabled feature flags": "shell_tool, unified_exec, shell_snapshot, terminal_resize_reflow, sqlite, hooks, enable_request_compression, multi_agent, apps, tool_suggest, plugins, in_app_browser, browser_use, browser_use_external, computer_use, plugin_sharing, image_generation, skill_mcp_dependency_install, steer, guardian_approval, goals, collaboration_modes, tool_call_mcp_elicitation, personality, fast_mode, tui_app_server, workspace_dependencies",
        "feature flag overrides": "none",
        "feature flags enabled": "27",
        "log dir": "/Users/REDACTED/.codex/log",
        "mcp servers": "4",
        "model": "gpt-5.5",
        "model provider": "openai",
        "sqlite home": "/Users/REDACTED/.codex"
      },
      "remediation": null,
      "durationMs": 0
    },
    "git.environment": {
      "id": "git.environment",
      "category": "git",
      "status": "ok",
      "summary": "git version 2.54.0",
      "details": {
        "PATH git #1": "/usr/local/bin/git",
        "PATH git #2": "/usr/bin/git",
        "PATH git entries": "2",
        "git build options": "git version 2.54.0; cpu: x86_64; no commit associated with this build; sizeof-long: 8; sizeof-size_t: 8; shell-path: /bin/sh; rust: disabled; feature: fsmonitor--daemon; gettext: enabled; libcurl: 8.6.0; zlib: 1.2.12; SHA-1: SHA1_DC; SHA-256: SHA256_BLK; default-ref-format: files; default-hash: sha1",
        "git exec path": "/usr/local/opt/git/libexec/git-core",
        "git version": "git version 2.54.0",
        "repo detected": "false",
        "selected git": "/usr/local/bin/git"
      },
      "remediation": null,
      "durationMs": 31
    },
    "installation": {
      "id": "installation",
      "category": "install",
      "status": "ok",
      "summary": "installation looks consistent",
      "details": {
        "PATH codex #1": "/Users/REDACTED/.local/bin/codex",
        "PATH codex #2": "/usr/local/bin/codex",
        "PATH codex entries": "2",
        "current executable": "/Users/REDACTED/.local/bin/codex",
        "install context": "standalone (unix, package /Users/REDACTED/.codex/packages/standalone/releases/0.139.0-x86_64-apple-darwin, bin /Users/REDACTED/.codex/packages/standalone/releases/0.139.0-x86_64-apple-darwin/bin, resources /Users/REDACTED/.codex/packages/standalone/releases/0.139.0-x86_64-apple-darwin/codex-resources, path /Users/REDACTED/.codex/packages/standalone/releases/0.139.0-x86_64-apple-darwin/codex-path)",
        "managed by bun": "false",
        "managed by npm": "false",
        "managed package root": "not set"
      },
      "remediation": null,
      "durationMs": 6
    },
    "mcp.config": {
      "id": "mcp.config",
      "category": "mcp",
      "status": "ok",
      "summary": "MCP configuration is locally consistent",
      "details": {
        "configured servers": "4",
        "disabled servers": "0",
        "stdio servers": "4"
      },
      "remediation": null,
      "durationMs": 1
    },
    "network.env": {
      "id": "network.env",
      "category": "network",
      "status": "ok",
      "summary": "network-related environment looks readable",
      "details": {
        "proxy env vars": "none"
      },
      "remediation": null,
      "durationMs": 0
    },
    "network.provider_reachability": {
      "id": "network.provider_reachability",
      "category": "reachability",
      "status": "ok",
      "summary": "active provider endpoints are reachable over HTTP",
      "details": {
        "ChatGPT base URL": "https://chatgpt.com/backend-api/ reachable (HTTP 404)",
        "reachability mode": "ChatGPT auth"
      },
      "remediation": null,
      "durationMs": 498
    },
    "network.websocket_reachability": {
      "id": "network.websocket_reachability",
      "category": "websocket",
      "status": "ok",
      "summary": "Responses WebSocket handshake succeeded",
      "details": {
        "DNS": "2 IPv4, 2 IPv6, first IPv4",
        "auth mode": "chatgpt",
        "connect timeout": "15000 ms",
        "endpoint": "wss://chatgpt.com/backend-api/<redacted>",
        "handshake result": "HTTP 101 Switching Protocols",
        "model provider": "openai",
        "models etag present": "true",
        "provider name": "OpenAI",
        "proxy env vars": "none",
        "reasoning header": "false",
        "server model present": "false",
        "supports websockets": "true",
        "wire API": "responses"
      },
      "remediation": null,
      "durationMs": 1641
    },
    "runtime.provenance": {
      "id": "runtime.provenance",
      "category": "runtime",
      "status": "ok",
      "summary": "running standalone on macos-x86_64",
      "details": {
        "commit": "unknown",
        "current executable": "/Users/REDACTED/.local/bin/codex",
        "install method": "standalone (unix, package /Users/REDACTED/.codex/packages/standalone/releases/0.139.0-x86_64-apple-darwin, bin /Users/REDACTED/.codex/packages/standalone/releases/0.139.0-x86_64-apple-darwin/bin, resources /Users/REDACTED/.codex/packages/standalone/releases/0.139.0-x86_64-apple-darwin/codex-resources, path /Users/REDACTED/.codex/packages/standalone/releases/0.139.0-x86_64-apple-darwin/codex-path)",
        "platform": "macos-x86_64",
        "version": "0.139.0"
      },
      "remediation": null,
      "durationMs": 0
    },
    "runtime.search": {
      "id": "runtime.search",
      "category": "search",
      "status": "ok",
      "summary": "search is OK (bundled)",
      "details": {
        "search command": "/Users/REDACTED/.codex/packages/standalone/releases/0.139.0-x86_64-apple-darwin/codex-path/rg",
        "search command readiness": "file exists",
        "search provider": "bundled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "sandbox.helpers": {
      "id": "sandbox.helpers",
      "category": "sandbox",
      "status": "ok",
      "summary": "sandbox configuration is readable",
      "details": {
        "approval policy": "OnRequest",
        "codex-linux-sandbox helper": "none",
        "execve wrapper helper": "/Users/REDACTED/.codex/tmp/arg0/codex-arg0oVM7vy/codex-execve-wrapper",
        "filesystem sandbox": "restricted",
        "network sandbox": "restricted"
      },
      "remediation": null,
      "durationMs": 0
    },
    "state.paths": {
      "id": "state.paths",
      "category": "state",
      "status": "ok",
      "summary": "state paths and databases are inspectable",
      "details": {
        "CODEX_HOME": "/Users/REDACTED/.codex (dir)",
        "active rollout files": "171 files, 87245212 total bytes, 510205 average bytes",
        "archived rollout files": "1 files, 72014 total bytes, 72014 average bytes",
        "goals DB": "/Users/REDACTED/.codex/goals_1.sqlite (file)",
        "goals DB integrity": "ok",
        "log DB": "/Users/REDACTED/.codex/logs_2.sqlite (file)",
        "log DB integrity": "ok",
        "log dir": "/Users/REDACTED/.codex/log (dir)",
        "memories DB": "/Users/REDACTED/.codex/memories_1.sqlite (file)",
        "memories DB integrity": "ok",
        "sqlite home": "/Users/REDACTED/.codex (dir)",
        "standalone release cache": "1 entries in /Users/REDACTED/.codex/packages/standalone/releases",
        "state DB": "/Users/REDACTED/.codex/state_5.sqlite (file)",
        "state DB integrity": "ok"
      },
      "remediation": null,
      "durationMs": 692
    },
    "state.rollout_db_parity": {
      "id": "state.rollout_db_parity",
      "category": "threads",
      "status": "warning",
      "summary": "rollout files and state DB thread inventory differ",
      "details": {
        "default model provider": "openai",
        "rollout DB active files": "171",
        "rollout DB active rows": "168",
        "rollout DB archive mismatches": "0",
        "rollout DB archived files": "1",
        "rollout DB archived rows": "1",
        "rollout DB duplicate DB paths": "0",
        "rollout DB duplicate rollout thread ids": "0",
        "rollout DB malformed file names": "0",
        "rollout DB missing active rows": "3",
        "rollout DB missing active sample": [
          "/Users/REDACTED/.codex/sessions/2026/04/11/rollout-2026-04-11T16-38-32-019d7cfa-eac3-71d3-b151-6d5df36e820c.jsonl",
          "/Users/REDACTED/.codex/sessions/2026/04/11/rollout-2026-04-11T16-25-08-019d7cee-a92c-7e02-9507-d8b2604058e3.jsonl",
          "/Users/REDACTED/.codex/sessions/2026/04/11/rollout-2026-04-11T16-06-40-019d7cdd-bfc0-73c1-9be7-9720aeaf230a.jsonl"
        ],
        "rollout DB missing archived rows": "0",
        "rollout DB model providers": "openai=169",
        "rollout DB rows": "169",
        "rollout DB scan cap reached": "false",
        "rollout DB scan errors": "0",
        "rollout DB sources": "subagent:thread_spawn=66, cli=49, subagent:other=28, vscode=25, exec=1",
        "rollout DB stale rows": "0"
      },
      "issues": [
        {
          "severity": "warning",
          "cause": "rollout files are missing from the state DB",
          "measured": "3 active, 0 archived",
          "expected": "every rollout file has a matching threads row",
          "remedy": null,
          "fields": []
        }
      ],
      "remediation": null,
      "durationMs": 1194
    },
    "system.environment": {
      "id": "system.environment",
      "category": "system",
      "status": "ok",
      "summary": "OS language en-DE",
      "details": {
        "EDITOR": "not set",
        "LANG": "de_DE.UTF-8",
        "LESS": "set",
        "PAGER": "set",
        "VISUAL": "not set",
        "os": "Mac OS 15.7.7 [64-bit]",
        "os language": "en-DE",
        "os type": "Mac OS",
        "os version": "15.7.7"
      },
      "remediation": null,
      "durationMs": 7
    },
    "terminal.env": {
      "id": "terminal.env",
      "category": "terminal",
      "status": "ok",
      "summary": "terminal metadata was detected",
      "details": {
        "COLORFGBG": "15;0",
        "COLORTERM": "truecolor",
        "TERMINFO_DIRS entry": [
          "/Applications/iTerm.app/Contents/Resources/terminfo (dir)",
          "/usr/share/terminfo (dir)"
        ],
        "TERM_PROGRAM": "iTerm.app",
        "color output": "disabled (stdout is not a terminal)",
        "effective locale": "de_DE.UTF-8",
        "stderr is terminal": "false",
        "stdin is terminal": "false",
        "stdout is terminal": "false",
        "terminal": "iTerm2",
        "terminal size": "80x24",
        "terminal version": "3.6.11"
      },
      "remediation": null,
      "durationMs": 11
    },
    "terminal.title": {
      "id": "terminal.title",
      "category": "title",
      "status": "ok",
      "summary": "terminal title default",
      "details": {
        "terminal title activity": "true",
        "terminal title items": "activity, project-name",
        "terminal title project source": "cwd",
        "terminal title project value": "REDACTED",
        "terminal title source": "default"
      },
      "remediation": null,
      "durationMs": 1
    },
    "updates.status": {
      "id": "updates.status",
      "category": "updates",
      "status": "ok",
      "summary": "update configuration is locally consistent",
      "details": {
        "cached latest version": "0.139.0",
        "check for update on startup": "true",
        "dismissed version": "0.139.0",
        "last checked at": "2026-06-09T23:21:25.044160Z",
        "latest version": "0.139.0",
        "latest version status": "current version is not older",
        "update action": "standalone installer",
        "version cache": "/Users/REDACTED/.codex/version.json"
      },
      "remediation": null,
      "durationMs": 128
    }
  }
}

Closed as duplicate of #27358 — same crash, same workaround. I posted my additional findings (valid entitlements blob, isolated repro of the entitlement behavior) over there.

What happened?

On my Intel Mac mini, Codex sessions kept closing on me without warning: the TUI vanished mid-task and zsh printed trace trap codex. It happened three sessions in a row within an hour, and every single time it was at the moment the agent deployed a subagent or started running commands through unified_exec — sessions that never reached that point ran fine. Each crash left a report in ~/Library/Logs/DiagnosticReports/.

All 8 crash reports I collected have the identical faulting stack — V8 isolate creation aborting in OS::SetPermissions:

Redacted crash report excerpt
Incident:    2026-06-10 01:44:16.00 +0200
Process:     /usr/local/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-x64/vendor/x86_64-apple-darwin/bin/codex
OS:          macOS 15.7.7 (24G720)
CPU:         X86-64
Exception:   EXC_BREAKPOINT (SIGTRAP), codes: 0x0000000000000002, 0x0000000000000000
Termination: Trace/BPT trap: 5

Faulting thread:
 0  codex   v8::base::OS::SetPermissions(void*, unsigned long, v8::base::OS::MemoryPermission) + 231
 1  codex   v8::internal::CodeRange::InitReservation(v8::PageAllocator*, unsigned long, bool) + 587
 2  codex   v8::internal::Heap::SetUp(v8::internal::LocalHeap*) + 399
 3  codex   v8::internal::Isolate::Init(v8::internal::SnapshotData*, ...) + 1967
 4  codex   v8::internal::Isolate::InitWithSnapshot(...) + 9
 5  codex   v8::internal::Snapshot::Initialize(v8::internal::Isolate*) + 539
 6  codex   v8::Isolate::Initialize(v8::Isolate*, v8::Isolate::CreateParams const&) + 603
 7  codex   v8::Isolate::New(v8::Isolate::CreateParams const&) + 55
 8  codex   v8::isolate::Isolate::new::hd4b09eb7264c03d7 + 103
 9  codex   <unsymbolicated>
10  codex   std::sys::backtrace::__rust_begin_short_backtrace + 64

First I suspected a 0.139.0 regression and downgraded to 0.138.0 — same crash, same stack. It also doesn't matter how Codex is installed: I reproduced it with the npm package, the Homebrew cask and the standalone installer. Sessions that never touch unified_exec run fine, which fits: the V8 isolate is only created when that code path is hit.

Root cause

The x86_64-apple-darwin binaries are signed with the hardened runtime but only carry the com.apple.security.cs.allow-jit entitlement:

$ codesign -dvv codex-x86_64-apple-darwin
CodeDirectory v=20500 ... flags=0x10000(runtime)
Authority=Developer ID Application: OpenAI OpCo, LLC (2DC432GLL2)

$ codesign -d --entitlements - codex-x86_64-apple-darwin
[Key] com.apple.security.cs.allow-jit
[Value] [Bool] true

allow-jit only covers MAP_JIT mappings. On Intel, V8's code range setup uses plain RWX mmap/mprotect without MAP_JIT, and under the hardened runtime that additionally requires com.apple.security.cs.allow-unsigned-executable-memory. Without it the call fails with EPERM, V8 hits a CHECK and aborts via SIGTRAP — exactly the OS::SetPermissions frame at the top of every crash. On Apple Silicon V8 goes through MAP_JIT + per-thread write protection, so allow-jit alone is enough there. I assume that's why this never showed up in your release testing.

I verified the mechanism in isolation with a small test program signed the same way the shipped binary is:

#include <sys/mman.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
int main(){
  void *p = mmap(NULL, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, -1, 0);
  printf("plain RWX mmap:   %s (%s)\n", p==MAP_FAILED?"FAILED":"ok", p==MAP_FAILED?strerror(errno):"-");
  void *q = mmap(NULL, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON|MAP_JIT, -1, 0);
  printf("MAP_JIT RWX mmap: %s (%s)\n", q==MAP_FAILED?"FAILED":"ok", q==MAP_FAILED?strerror(errno):"-");
  void *r = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);
  int rc = mprotect(r, 4096, PROT_READ|PROT_EXEC|PROT_WRITE);
  printf("mprotect RW->RWX: %s (%s)\n", rc?"FAILED":"ok", rc?strerror(errno):"-");
  return 0;
}

Signed with hardened runtime + allow-jit only (like codex):

plain RWX mmap:   FAILED (Permission denied)
MAP_JIT RWX mmap: ok (-)
mprotect RW->RWX: FAILED (Permission denied)

Signed with hardened runtime + allow-jit + allow-unsigned-executable-memory:

plain RWX mmap:   ok (-)
MAP_JIT RWX mmap: ok (-)
mprotect RW->RWX: ok (-)

Workaround (verified working)

Re-sign the binary locally, keeping the hardened runtime and adding the missing entitlement:

cat > /tmp/codex-ent.plist <<'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict>
<key>com.apple.security.cs.allow-jit</key><true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key><true/>
</dict></plist>
EOF
cp "$(readlink -f "$(which codex)")" codex.bak
codesign -f -s - --options runtime --entitlements /tmp/codex-ent.plist "$(readlink -f "$(which codex)")"

After re-signing, sessions that spawn subagents and nested sub-shells run without any crash. Drawbacks of the workaround: the Developer ID signature is replaced by an ad-hoc one, and codex update restores the broken signature, so it has to be repeated after every update.

Suggested fix

Add com.apple.security.cs.allow-unsigned-executable-memory to the entitlements used when signing the x86_64-apple-darwin release binaries. Chromium and Deno ship the same entitlement on Intel macOS for exactly this reason.

What were you expecting to happen?

Sessions using unified_exec / subagents complete normally on Intel Macs, like they do on Apple Silicon.

Steps to reproduce

  1. Intel Mac (tested on an i7-8700B Mac mini 2018, macOS 15.7.7), codex 0.138.0 or 0.139.0, any install method.
  2. Start a session and give the agent a task that makes it run shell commands through unified_exec or spawn a subagent.
  3. The process aborts with Trace/BPT trap: 5 as soon as the V8 isolate is created.

Full .ips crash reports are available if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't workingsubagentIssues involving subagents or multi-agent featurestool-callsIssues related to tool calling

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions