Skip to content

🍒 437 - fix(sigaction): prevent infinite loop in signal handler chaining#447

Merged
jbachorik merged 1 commit intorelease/1.40._from
jaroslav.bachorik/backport-pr-437
Mar 27, 2026
Merged

🍒 437 - fix(sigaction): prevent infinite loop in signal handler chaining#447
jbachorik merged 1 commit intorelease/1.40._from
jaroslav.bachorik/backport-pr-437

Conversation

@jbachorik
Copy link
Copy Markdown
Collaborator

Backport of #437 to release/1.40._

* fix(sigaction): prevent infinite loop in signal handler chaining

When intercepting sigaction calls from other libraries (e.g., wasmtime),
we were returning our handler as oldact. This caused infinite loops:
  profiler -> wasmtime -> profiler -> wasmtime -> ...

Fix: Save original (JVM's) handlers in protectSignalHandlers() BEFORE
installing ours, then return those saved handlers as oldact. Now the
chain is: profiler -> wasmtime -> JVM

Also:
- Add sigaction_interception_ut.cpp test to catch this bug
- Wire gtest to run before Java tests in testdebug
- Remove broken test_tlsPriming.cpp (referenced removed APIs)
- Add getSigactionHook() stub for macOS

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: address PR review comments

- Add missing <cstring> include for memset
- Fix comment to match int return type (0 = not handled, non-zero = handled)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: close query-only sigaction loop and fix debug-mode SIGABRT

Extend sigaction interception to cover query-only calls
(sigaction(SIGSEGV/SIGBUS, nullptr, &oldact)): return the saved JVM
handler instead of ours, so callers that store oldact and later chain
to it don't loop back into our handler.

Fix intermittent SIGABRT in debug builds on aarch64 GraalVM: extend
crashProtectionActive() with a VMThread::isExceptionActive() fallback
so the cast_to() assert no longer fires for threads without ProfiledThread
TLS when setjmp crash protection is already active in walkVM.

Add OS::resetSignalHandlersForTesting() to prevent static state from
leaking between sigaction interception unit tests.

Add ASCII flow diagram to sigaction_hook documenting the full handler
chain and interception cases.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit 312fc25)
@dd-octo-sts
Copy link
Copy Markdown

dd-octo-sts bot commented Mar 27, 2026

CI Test Results

Run: #23654533162 | Commit: 0dce207 | Duration: 21m 23s (longest job)

All 32 test jobs passed

Status Overview

JDK glibc-aarch64/debug glibc-amd64/debug musl-aarch64/debug musl-amd64/debug
8 - - -
8-ibm - - -
8-j9 - -
8-librca - -
8-orcl - - -
11 - - -
11-j9 - -
11-librca - -
17 - -
17-graal - -
17-j9 - -
17-librca - -
21 - -
21-graal - -
21-librca - -
25 - -
25-graal - -
25-librca - -

Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled

Summary: Total: 32 | Passed: 32 | Failed: 0


Updated: 2026-03-27 20:36:14 UTC

@pr-commenter
Copy link
Copy Markdown

pr-commenter bot commented Mar 27, 2026

Integration Tests

All 40 integration tests passed

📊 Dashboard · 👷 Pipeline · 📦 bd2ff344

@jbachorik jbachorik merged commit 0114dbc into release/1.40._ Mar 27, 2026
169 of 180 checks passed
@jbachorik jbachorik deleted the jaroslav.bachorik/backport-pr-437 branch March 27, 2026 20:29
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.

2 participants