Skip to content

Partially revert "Fixes a segfault with callbacks seen on Ubuntu 26"#393

Merged
romgrk merged 2 commits into
masterfrom
revert-391-Issue#390_segfault_in_callback_ubuntu26
Jun 1, 2026
Merged

Partially revert "Fixes a segfault with callbacks seen on Ubuntu 26"#393
romgrk merged 2 commits into
masterfrom
revert-391-Issue#390_segfault_in_callback_ubuntu26

Conversation

@romgrk

@romgrk romgrk commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Reverts the runtime callback changes from #391 while preserving the test file updates from that PR.

@chfritz I'll revert the startup-breaking runtime changes, but keep the test updates intact.

@romgrk

romgrk commented Jun 1, 2026

Copy link
Copy Markdown
Owner Author

@copilot We don't want to revert the changes to test files

Copilot AI commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

@copilot We don't want to revert the changes to test files

Done in 1fda7d3 — I restored the reverted test-file changes while keeping the non-test revert intact.

Copilot AI changed the title Revert "Fixes a segfault with callbacks seen on Ubuntu 26" Partially revert "Fixes a segfault with callbacks seen on Ubuntu 26" Jun 1, 2026
Copilot finished work on behalf of romgrk June 1, 2026 02:02
@romgrk romgrk merged commit 82138a9 into master Jun 1, 2026
@romgrk romgrk deleted the revert-391-Issue#390_segfault_in_callback_ubuntu26 branch June 1, 2026 03:02
romgrk added a commit that referenced this pull request Jun 14, 2026
On libffi 3.4+ the executable trampoline is a separate memory mapping from
the writable ffi_closure, so the closure pointer itself is not callable;
passing it to C as the callback function pointer segfaults when the callback
fires. This is reproducible on Ubuntu 26 (libffi 3.5) and matches the
`node examples/glib-timeout.js` crash in the report.

Pass g_callable_info_get_closure_native_address() instead of the raw closure.
This re-applies #391, which was reverted in #393 because it broke startup —
guarded here by falling back to the closure pointer when introspection returns
NULL, so a callback pointer is never NULL at bootstrap. On platforms where the
two addresses coincide (older libffi, or where the closure is already
executable) the behavior is unchanged.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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