[vm] Prevent nested handling of SIGPROF.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/52765
Change-Id: I14301d67ad245d3df96624155b383cb5f4c7f981
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310975
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
This commit is contained in:
Ryan Macnak 2023-06-23 17:01:58 +00:00 committed by Commit Queue
parent bbdf87d277
commit b9843b876d
2 changed files with 2 additions and 0 deletions

View file

@ -122,6 +122,7 @@ void SignalHandler::Install(SignalAction action) {
struct sigaction act = {};
act.sa_sigaction = action;
sigemptyset(&act.sa_mask);
sigaddset(&act.sa_mask, SIGPROF); // Prevent nested signals.
act.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK;
r = sigaction(SIGPROF, &act, nullptr);
ASSERT(r == 0);

View file

@ -115,6 +115,7 @@ void SignalHandler::Install(SignalAction action) {
act.sa_handler = nullptr;
act.sa_sigaction = action;
sigemptyset(&act.sa_mask);
sigaddset(&act.sa_mask, SIGPROF); // Prevent nested signals.
act.sa_flags = SA_RESTART | SA_SIGINFO;
int r = sigaction(SIGPROF, &act, nullptr);
ASSERT(r == 0);