Skip to content

fix(runtime): print errno on sigaltstack errors - #14928

Open
dijkstracula wants to merge 2 commits into
ocaml:trunkfrom
dijkstracula:signal_stack_errno
Open

dijkstracula wants to merge 2 commits into
ocaml:trunkfrom
dijkstracula:signal_stack_errno

Conversation

@dijkstracula

@dijkstracula dijkstracula commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

Dear OCaml maintainers,

Internally at Semgrep, we've been trying to diagnose some failures that stem from not being able to correctly set up the signal stack. Currently, caml_init_signals only prints Failed to allocate signal stack for domain 0 (that is, we drop the errno, so we're not exactly sure what's going wrong). This patch simply turns the errno into a printable string via strerror(3) and adds that to the output. Similarly, caml_free_signal_stack did sort of the right thing in that it prints out the errno number but not the string form; this patch passes that usage through strerror as well.

Since this error only happens very occasionally, I've not been able to directly test this patch beyond "force a failure and set errno" one-off test, but we are also pulling this into our fork for internal use, too.

Thanks, and to the Europeans, hope you are staying cool,
Nathan

@miodvallat miodvallat 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.

Wouldn't it better to use caml_strerror instead of strerror in this PR?

@dijkstracula

Copy link
Copy Markdown
Contributor Author

Fair point @miodvallat . Change made.

@miodvallat miodvallat 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.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants