Commits on Source 1

  • cznic's avatar
    modernc.org/libc: implement abort(3) on openbsd (was a panic(todo) stub) · 7f6c23a1
    cznic authored
    
    
    Xabort on openbsd was panic(todo("")), so C abort(3) never terminated the
    process by a signal. SQLite's crash-recovery tests (writecrash.test and the
    crash*.test family) require the child to die BY A SIGNAL so the parent's Tcl
    exec reports "child killed: ..."; the stub made it panic ("exited abnormally")
    instead, which regressed with the SQLite 3.53.3 upgrade.
    
    A faithful SIGABRT-based abort is unreachable from pure-Go libc on openbsd:
      - libc's own Xsigaction is an unimplemented stub, so SIGABRT's disposition
        cannot be reset to SIG_DFL; the Go runtime therefore always catches a
        delivered SIGABRT, prints a crash traceback, and exits status 2 — again
        "exited abnormally", not "killed".
      - openbsd's pinsyscalls(2) makes the raw sys_sigaction(46)/getthrid(299)/
        thrkill(119) syscalls return ENOSYS through the generic indirect syscall
        path (only libc.so's pinned call sites may issue them; verified: sigaction
        -> errno 78). So the netbsd-style SIG_DFL-reset + thread-directed thrkill
        approach cannot be ported.
    
    Terminate via SIGKILL instead: it cannot be caught, blocked, or ignored, so it
    kills the process immediately and unconditionally by signal — no race, no
    traceback, no "SIGABRT" string leaking into test output. unix.Kill routes
    through libc.so, so unlike the raw syscalls it is not defeated by pinsyscalls.
    
    Fixes openbsd/amd64 and openbsd/arm64 (shared libc_openbsd.go). Validated
    against SQLite 3.53.3: writecrash.test 0 errors out of 997 subtests, and the
    whole crash*.test/multiplex/quota family green on both arches.
    
    Co-Authored-By: default avatarClaude Opus 4.8 (1M context) <noreply@anthropic.com>
    7f6c23a1
Loading
Loading