Skip to content

fix(native): Preserve existing alternate signal stacks - #2219

Merged
jpnurmi merged 3 commits into
v1from
jpnurmi/fix/native-sigaltstack
Oct 20, 2026
Merged

jpnurmi merged 3 commits into
v1from
jpnurmi/fix/native-sigaltstack

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

A follow-up to #2216 that attempted to run unit tests with SENTRY_BACKEND=native in the CI but had to take a step back because of unrelated ASan failures in tests/test_unit.py::test_unit_native[concurrent_init]: https://github.com/getsentry/sentry-native/actions/runs/39236786444/job/118007754912

Share inproc alternate signal-stack helpers through sentry_os and use them for native setup and cleanup. Reuse stacks installed by the runtime instead of replacing them with heap allocations that ASan tries to unmap when a thread exits.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit cd3feb6. Configure here.

Comment thread src/sentry_os.c
@codecov

codecov Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.21277% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.97%. Comparing base (ce33b9b) to head (9fdd567).

Additional details and impacted files
@@            Coverage Diff             @@
##               v1    #2219      +/-   ##
==========================================
+ Coverage   75.52%   75.97%   +0.45%     
==========================================
  Files         105      105              
  Lines       29642    29633       -9     
  Branches     5479     5478       -1     
==========================================
+ Hits        22387    22515     +128     
+ Misses       5829     5745      -84     
+ Partials     1426     1373      -53     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Share the inproc signal-stack helpers through `sentry_os` and use them
for native backend setup and cleanup. Reuse stacks installed by the
runtime instead of replacing them with heap allocations that ASan tries
to unmap when a thread exits.
The unit suite was only ever built with `SENTRY_BACKEND=none`, so every
test guarded by `SENTRY_BACKEND_NATIVE` in `test_native_backend.c`
compiled to `SKIP_TEST()` in CI. Add a `test_unit_native` variant that
builds `sentry_test_unit` together with `sentry-crash`, which
`sentry_init` spawns for the native backend.
Move `log_path` to static storage to reduce the handler's stack usage
by 4 KiB and avoid overflowing existing 16 KiB signal stacks. The
`handling_crash` guard prevents concurrent use of the buffer.
@jpnurmi
jpnurmi force-pushed the jpnurmi/fix/native-sigaltstack branch from 02a160f to 9fdd567 Compare October 19, 2026 19:13
@jpnurmi
jpnurmi changed the base branch from master to v1 October 19, 2026 19:13
@jpnurmi jpnurmi added the v1 Targets 1.0 (v1 branch) label Oct 19, 2026
@jpnurmi
jpnurmi merged commit 65c9d1a into v1 Oct 20, 2026
71 checks passed
@jpnurmi
jpnurmi deleted the jpnurmi/fix/native-sigaltstack branch October 20, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1 Targets 1.0 (v1 branch)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants