mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
[vm] initialize sigaction for msan
msan didn't recognize instance initialized with memset or bzero. Initialize all the instances. Bug: https://buganizer.corp.google.com/issues/137630695 Change-Id: I0f4adf90cd9d4daa2abe783b1e1ca892bdacb690 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109306 Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Zichang Guo <zichangguo@google.com>
This commit is contained in:
parent
9749a83f56
commit
1509d9ad41
|
@ -704,11 +704,11 @@ void CallbackTestSignalHandler(int) {
|
|||
int ExpectAbort(void (*fn)()) {
|
||||
fprintf(stderr, "**** EXPECT STACKTRACE TO FOLLOW. THIS IS OK. ****\n");
|
||||
|
||||
struct sigaction old_action;
|
||||
struct sigaction old_action = {};
|
||||
int result = __sigsetjmp(buf, /*savesigs=*/1);
|
||||
if (result == 0) {
|
||||
// Install signal handler.
|
||||
struct sigaction handler;
|
||||
struct sigaction handler = {};
|
||||
handler.sa_handler = CallbackTestSignalHandler;
|
||||
sigemptyset(&handler.sa_mask);
|
||||
handler.sa_flags = 0;
|
||||
|
|
|
@ -40,8 +40,7 @@ bool Platform::Initialize() {
|
|||
// Turn off the signal handler for SIGPIPE as it causes the process
|
||||
// to terminate on writing to a closed pipe. Without the signal
|
||||
// handler error EPIPE is set instead.
|
||||
struct sigaction act;
|
||||
bzero(&act, sizeof(act));
|
||||
struct sigaction act = {};
|
||||
act.sa_handler = SIG_IGN;
|
||||
if (sigaction(SIGPIPE, &act, 0) != 0) {
|
||||
perror("Setting signal handler failed");
|
||||
|
|
|
@ -39,8 +39,7 @@ bool Platform::Initialize() {
|
|||
// Turn off the signal handler for SIGPIPE as it causes the process
|
||||
// to terminate on writing to a closed pipe. Without the signal
|
||||
// handler error EPIPE is set instead.
|
||||
struct sigaction act;
|
||||
bzero(&act, sizeof(act));
|
||||
struct sigaction act = {};
|
||||
act.sa_handler = SIG_IGN;
|
||||
if (sigaction(SIGPIPE, &act, 0) != 0) {
|
||||
perror("Setting signal handler failed");
|
||||
|
|
|
@ -47,8 +47,7 @@ bool Platform::Initialize() {
|
|||
// Turn off the signal handler for SIGPIPE as it causes the process
|
||||
// to terminate on writing to a closed pipe. Without the signal
|
||||
// handler error EPIPE is set instead.
|
||||
struct sigaction act;
|
||||
bzero(&act, sizeof(act));
|
||||
struct sigaction act = {};
|
||||
act.sa_handler = SIG_IGN;
|
||||
if (sigaction(SIGPIPE, &act, 0) != 0) {
|
||||
perror("Setting signal handler failed");
|
||||
|
|
|
@ -1006,8 +1006,7 @@ intptr_t Process::SetSignalHandler(intptr_t signal) {
|
|||
handler = handler->next();
|
||||
}
|
||||
if (listen) {
|
||||
struct sigaction act;
|
||||
bzero(&act, sizeof(act));
|
||||
struct sigaction act = {};
|
||||
act.sa_handler = SignalHandler;
|
||||
sigemptyset(&act.sa_mask);
|
||||
for (int i = 0; i < kSignalsCount; i++) {
|
||||
|
@ -1052,8 +1051,7 @@ void Process::ClearSignalHandler(intptr_t signal, Dart_Port port) {
|
|||
handler = next;
|
||||
}
|
||||
if (unlisten) {
|
||||
struct sigaction act;
|
||||
bzero(&act, sizeof(act));
|
||||
struct sigaction act = {};
|
||||
act.sa_handler = SIG_DFL;
|
||||
VOID_NO_RETRY_EXPECTED(sigaction(signal, &act, NULL));
|
||||
}
|
||||
|
|
|
@ -1000,8 +1000,7 @@ intptr_t Process::SetSignalHandler(intptr_t signal) {
|
|||
handler = handler->next();
|
||||
}
|
||||
if (listen) {
|
||||
struct sigaction act;
|
||||
bzero(&act, sizeof(act));
|
||||
struct sigaction act = {};
|
||||
act.sa_handler = SignalHandler;
|
||||
sigemptyset(&act.sa_mask);
|
||||
for (int i = 0; i < kSignalsCount; i++) {
|
||||
|
@ -1048,8 +1047,7 @@ void Process::ClearSignalHandler(intptr_t signal, Dart_Port port) {
|
|||
handler = next;
|
||||
}
|
||||
if (unlisten) {
|
||||
struct sigaction act;
|
||||
bzero(&act, sizeof(act));
|
||||
struct sigaction act = {};
|
||||
act.sa_handler = SIG_DFL;
|
||||
sigaction(signal, &act, NULL);
|
||||
}
|
||||
|
|
|
@ -1034,8 +1034,7 @@ intptr_t Process::SetSignalHandler(intptr_t signal) {
|
|||
handler = handler->next();
|
||||
}
|
||||
if (listen) {
|
||||
struct sigaction act;
|
||||
bzero(&act, sizeof(act));
|
||||
struct sigaction act = {};
|
||||
act.sa_handler = SignalHandler;
|
||||
sigemptyset(&act.sa_mask);
|
||||
for (int i = 0; i < kSignalsCount; i++) {
|
||||
|
@ -1084,8 +1083,7 @@ void Process::ClearSignalHandler(intptr_t signal, Dart_Port port) {
|
|||
handler = next;
|
||||
}
|
||||
if (unlisten) {
|
||||
struct sigaction act;
|
||||
bzero(&act, sizeof(act));
|
||||
struct sigaction act = {};
|
||||
act.sa_handler = SIG_DFL;
|
||||
VOID_NO_RETRY_EXPECTED(sigaction(signal, &act, NULL));
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// told about areas that are initialized by generated code.
|
||||
#if defined(__has_feature)
|
||||
#if __has_feature(memory_sanitizer)
|
||||
extern "C" void __msan_unpoison(void*, size_t);
|
||||
extern "C" void __msan_unpoison(const volatile void*, size_t);
|
||||
#define MSAN_UNPOISON(ptr, len) __msan_unpoison(ptr, len)
|
||||
#define NO_SANITIZE_MEMORY __attribute__((no_sanitize_memory))
|
||||
#else // __has_feature(memory_sanitizer)
|
||||
|
|
|
@ -95,8 +95,7 @@ uintptr_t SignalHandler::GetLinkRegister(const mcontext_t& mcontext) {
|
|||
}
|
||||
|
||||
void SignalHandler::InstallImpl(SignalAction action) {
|
||||
struct sigaction act;
|
||||
memset(&act, 0, sizeof(act));
|
||||
struct sigaction act = {};
|
||||
act.sa_sigaction = action;
|
||||
sigemptyset(&act.sa_mask);
|
||||
act.sa_flags = SA_RESTART | SA_SIGINFO;
|
||||
|
@ -107,8 +106,7 @@ void SignalHandler::InstallImpl(SignalAction action) {
|
|||
void SignalHandler::Remove() {
|
||||
// Ignore future SIGPROF signals because by default SIGPROF will terminate
|
||||
// the process and we may have some signals in flight.
|
||||
struct sigaction act;
|
||||
memset(&act, 0, sizeof(act));
|
||||
struct sigaction act = {};
|
||||
act.sa_handler = SIG_IGN;
|
||||
sigemptyset(&act.sa_mask);
|
||||
int r = sigaction(SIGPROF, &act, NULL);
|
||||
|
|
|
@ -95,7 +95,7 @@ uintptr_t SignalHandler::GetLinkRegister(const mcontext_t& mcontext) {
|
|||
}
|
||||
|
||||
void SignalHandler::InstallImpl(SignalAction action) {
|
||||
struct sigaction act;
|
||||
struct sigaction act = {};
|
||||
act.sa_handler = NULL;
|
||||
act.sa_sigaction = action;
|
||||
sigemptyset(&act.sa_mask);
|
||||
|
@ -107,7 +107,7 @@ void SignalHandler::InstallImpl(SignalAction action) {
|
|||
void SignalHandler::Remove() {
|
||||
// Ignore future SIGPROF signals because by default SIGPROF will terminate
|
||||
// the process and we may have some signals in flight.
|
||||
struct sigaction act;
|
||||
struct sigaction act = {};
|
||||
act.sa_handler = SIG_IGN;
|
||||
sigemptyset(&act.sa_mask);
|
||||
act.sa_flags = 0;
|
||||
|
|
|
@ -91,7 +91,7 @@ uintptr_t SignalHandler::GetLinkRegister(const mcontext_t& mcontext) {
|
|||
}
|
||||
|
||||
void SignalHandler::InstallImpl(SignalAction action) {
|
||||
struct sigaction act;
|
||||
struct sigaction act = {};
|
||||
act.sa_handler = NULL;
|
||||
act.sa_sigaction = action;
|
||||
sigemptyset(&act.sa_mask);
|
||||
|
@ -103,7 +103,7 @@ void SignalHandler::InstallImpl(SignalAction action) {
|
|||
void SignalHandler::Remove() {
|
||||
// Ignore future SIGPROF signals because by default SIGPROF will terminate
|
||||
// the process and we may have some signals in flight.
|
||||
struct sigaction act;
|
||||
struct sigaction act = {};
|
||||
act.sa_handler = SIG_IGN;
|
||||
sigemptyset(&act.sa_mask);
|
||||
act.sa_flags = 0;
|
||||
|
|
Loading…
Reference in a new issue