Skip to content

signal: remove SIGURG from default-ignore list#2744

Open
badoriie wants to merge 1 commit into
ish-app:masterfrom
badoriie:fix/sigurg-default-ignore
Open

signal: remove SIGURG from default-ignore list#2744
badoriie wants to merge 1 commit into
ish-app:masterfrom
badoriie:fix/sigurg-default-ignore

Conversation

@badoriie

Copy link
Copy Markdown

Problem

SIGURG is currently in iSH's default-ignore list in kernel/signal.c:

case SIGURG_: case SIGCONT_: case SIGCHLD_:
case SIGIO_: case SIGWINCH_:
    return SIGNAL_IGNORE;

Go 1.14+ uses SIGURG to implement asynchronous goroutine preemption (runtime/signal_unix.go). When a Go program calls signal.Notify or the runtime installs its own SIGURG handler via runtime_sigInstall, iSH's default-ignore classification prevents proper handler registration.

The result is a hard crash on startup:

fatal: bad g in signal handler

The workaround is to set GODEBUG=asyncpreemptoff=1 before launch, which disables Go's async preemption entirely — a significant runtime regression.

Fix

Remove SIGURG_ from the ignore list. Its POSIX default disposition is already "ignored" for processes that haven't installed a handler, so removing it from this list has no effect on programs that don't use SIGURG. It only allows programs like Go to successfully install their own handler.

// Before
case SIGURG_: case SIGCONT_: case SIGCHLD_:

// After
case SIGCONT_: case SIGCHLD_:

Impact

  • Go 1.14+ programs start without GODEBUG=asyncpreemptoff=1
  • No behavioural change for programs that don't use SIGURG
  • Tested with Conduit on iSH (Alpine Linux, iPhone)

Go 1.14+ uses SIGURG to implement asynchronous goroutine preemption
(runtime/signal_unix.go). With SIGURG silently ignored, Go's runtime
cannot preempt goroutines cooperatively, leading to a 'fatal: bad g in
signal handler' crash on startup.

Removing SIGURG from the default-ignore list lets it fall through to
the default POSIX disposition (ignored for processes that haven't
installed a handler), while allowing Go's runtime_sigInstall to
register its own handler correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant