)]}'
{
  "commit": "21e2e77bf2ce2d695c18dfe5ad2e63b74887ce90",
  "tree": "de80244a9b11a0e26c512981bd69bda8f6ab01a2",
  "parents": [
    "fa579c5dd4db6d980a1ba14d9fbc003af9af5cef",
    "6194bec55dc6f3bbd48bf71dd1beb8e22b4510be"
  ],
  "author": {
    "name": "Jonathan Brouwer",
    "email": "jonathantbrouwer@gmail.com",
    "time": "Sun Jul 12 22:01:22 2026 +0200"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Sun Jul 12 22:01:22 2026 +0200"
  },
  "message": "Rollup merge of #159112 - sbogomolov:freebsd-static-environ, r\u003dclarfonthey\n\nFix segfault in env access in statically linked FreeBSD binaries\n\nOn FreeBSD `environ` is provided by the startup object linked into every executable (crt1.o) rather than by libc.so, so rust-lang/rust#153718 switched std to a dlsym lookup to keep shared libraries linkable with `-Wl,--no-undefined` (rust-lang/rust#153451). But dlsym needs a dynamic symbol table, which statically linked executables do not have: it returns null, and both `env::vars_os` and the `Command` spawn paths dereference it (rust-lang/rust#158939).\n\nResolve `environ` through a weak reference first: crt1.o defines it in every executable, statically linked ones included, and a weak undefined symbol does not break shared library links. Fall back to dlsym only when the weak reference is null, i.e. inside a shared library, where the dynamic lookup is available. Also stop dereferencing a null table pointer in `env()`, so an unresolvable `environ` degrades to an empty environment instead of a crash.\n\nThe `extern_weak` reference is the same mechanism std already uses for `__dso_handle` and `__cxa_thread_atexit_impl` in `sys/thread_local/destructors/linux_like.rs`.\n\n## Testing\n\nCI cannot execute FreeBSD tests (the target is cross-compiled only), so:\n\n- `./x check library/std --target x86_64-unknown-freebsd` and a host check pass.\n- The reproduction from rust-lang/rust#158939, built with `-C target-feature\u003d+crt-static`, was executed on FreeBSD 14.4-RELEASE (amd64): built with stock 1.96.0 it segfaults on `vars_os()` (SIGSEGV, exit 139); built against std from this branch it iterates the environment, spawns a child with an inherited environment, and exits cleanly.\n- Downstream, the crash was originally isolated and worked around in a production daemon whose CI runs the exact affected configuration (static, LTO) on a real FreeBSD kernel per commit; that harness stands ready to validate a nightly containing this fix.\n\nThis is a regression from stable to stable (1.95 -\u003e 1.96) and may be worth a beta backport.\n\nFixes rust-lang/rust#158939\n",
  "tree_diff": []
}
