Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix signal handling for platforms without SA_ONSTACK #118962

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vvchernov
Copy link

Some platforms such as QNX do not define or implement SA_ONSTACK, so default that flag to 0 to just use the pre-existing stack there.

Copy link

github-actions bot commented Dec 6, 2024

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot
Copy link
Member

llvmbot commented Dec 6, 2024

@llvm/pr-subscribers-llvm-support

Author: Valery Chernov (vvchernov)

Changes

Some platforms such as QNX do not define or implement SA_ONSTACK, so default that flag to 0 to just use the pre-existing stack there.


Full diff: https://github.com/llvm/llvm-project/pull/118962.diff

1 Files Affected:

  • (modified) llvm/lib/Support/Unix/Signals.inc (+6)
diff --git a/llvm/lib/Support/Unix/Signals.inc b/llvm/lib/Support/Unix/Signals.inc
index 088ca33e3c8c56..3a79246b5f14b8 100644
--- a/llvm/lib/Support/Unix/Signals.inc
+++ b/llvm/lib/Support/Unix/Signals.inc
@@ -309,6 +309,12 @@ static void RegisterHandlers() { // Not signal-safe.
 
     struct sigaction NewHandler;
 
+#ifndef SA_ONSTACK
+    // Some platforms such as QNX do not define or implement SA_ONSTACK,
+    // so default that flag to 0 to just use the pre-existing stack there.
+    int SA_ONSTACK = 0;
+#endif
+
     switch (Kind) {
     case SignalKind::IsKill:
       NewHandler.sa_handler = SignalHandler;

@vvchernov
Copy link
Author

cc @AlexMaclean

@vvchernov
Copy link
Author

cc @Artem-B

@Artem-B
Copy link
Member

Artem-B commented Dec 9, 2024

I have no context for this change. Based on the folks CC'ed, it may have something to do with NVPTX back-end, but I don't quite see how it may be related to QNX.

@vvchernov
Copy link
Author

I have no context for this change. Based on the folks CC'ed, it may have something to do with NVPTX back-end, but I don't quite see how it may be related to QNX.

Hello @Artem-B! May be do you know who can review it?

@Artem-B
Copy link
Member

Artem-B commented Dec 9, 2024

Check who made meaningful commits to https://github.com/llvm/llvm-project/blob/main/llvm/lib/Support/Unix/Signals.inc and who reviewed those changes. That would be a good starting point.

@vvchernov
Copy link
Author

@boomanaiden154 @s-barannikov could you review this small patch, please?

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.

3 participants