-
Notifications
You must be signed in to change notification settings - Fork 30k
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
src: fix segfault handling/RegisterSignalHandler #27775
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
// with ALLOW_CRASHES set. | ||
if (signal !== null && !process.env.ALLOW_CRASHES) | ||
continue; | ||
// reset_handler does not work on FreeBSD. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed when #27780 lands, I think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@Trott thanks for re-starting CI, but the failures here are genuine and are not trivially solved – I’m still thinking about a nice solution, if I can’t come up with one then I’ll drop the corresponding parts of this PR… |
Cool. I added the WIP label so I don't indiscriminately restart the CI again. Of course, remove it when appropriate. |
Okay, updated with the third commit changed to forbid the @jasnell @bnoordhuis Could you take another look and make sure your reviews still stand? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This macro is only defined when building Node.js, so addons cannot use it as a way of detecting feature availability.
Without this, we would re-enter the signal handler immediately after re-raising the signal, leading to an infinite loop.
This is not easily implementable, and should be explicitly disallowed.
Ensure coverage for the different combinations of arguments.
Landed in 282e2f6...039cfdc |
@addaleax what was the reason for |
src: do not use posix feature macro in node.h
This macro is only defined when building Node.js, so addons cannot
use it as a way of detecting feature availability.
src: reset SIGSEGV handler before crashing
Without this, we would re-enter the signal handler immediately
after re-raising the signal, leading to an infinite loop.
##### src: implement reset_handler for SIGSEGV handlingOtherwise, this makesRegisterSignalHandler()
behave differentlyfor
SIGSEGV
than it does for all other signals.Encoding thereset_handler
bit as part of the function pointer valueis a bit of a hack, and may not work on all platforms.
(This commit can be left out, if people feel like it should be. It can also be replaced by not making thereset_handler
argument part of the public API.)src: forbid reset_handler for SIGSEGV handling
This is not easily implementable, and should be explicitly disallowed.
test: add addon tests for
RegisterSignalHandler()
Ensure coverage for the different combinations of arguments.
Refs: #27246
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes