From eb4e5b276af4b35b6146cff0329ee9c6bf4a6e29 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Fri, 30 Apr 2021 18:46:11 -0400 Subject: [PATCH] fix: Revert sigmask change --- runtime/src/main.c | 13 ++----------- runtime/src/runtime.c | 15 +++++++++++++++ runtime/src/worker_thread.c | 2 -- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/runtime/src/main.c b/runtime/src/main.c index cb5ffb6..4c13aed 100644 --- a/runtime/src/main.c +++ b/runtime/src/main.c @@ -35,7 +35,7 @@ const uint32_t runtime_first_worker_processor = 1; FILE *runtime_sandbox_perf_log = NULL; enum RUNTIME_SCHEDULER runtime_scheduler = RUNTIME_SCHEDULER_EDF; -enum RUNTIME_SIGALRM_HANDLER runtime_sigalrm_handler = RUNTIME_SIGALRM_HANDLER_TRIAGED; +enum RUNTIME_SIGALRM_HANDLER runtime_sigalrm_handler = RUNTIME_SIGALRM_HANDLER_BROADCAST; int runtime_worker_core_count; @@ -192,18 +192,9 @@ runtime_start_runtime_worker_threads() debuglog("Sandboxing environment ready!\n"); } -void -runtime_cleanup() -{ - if (runtime_sandbox_perf_log != NULL) fflush(runtime_sandbox_perf_log); - - exit(EXIT_SUCCESS); -} - void runtime_configure() { - signal(SIGTERM, runtime_cleanup); /* Scheduler Policy */ char *scheduler_policy = getenv("SLEDGE_SCHEDULER"); if (scheduler_policy == NULL) scheduler_policy = "EDF"; @@ -218,7 +209,7 @@ runtime_configure() /* Sigalrm Handler Technique */ char *sigalrm_policy = getenv("SLEDGE_SIGALRM_HANDLER"); - if (sigalrm_policy == NULL) sigalrm_policy = "TRIAGED"; + if (sigalrm_policy == NULL) sigalrm_policy = "BROADCAST"; if (strcmp(sigalrm_policy, "BROADCAST") == 0) { runtime_sigalrm_handler = RUNTIME_SIGALRM_HANDLER_BROADCAST; } else if (strcmp(sigalrm_policy, "TRIAGED") == 0) { diff --git a/runtime/src/runtime.c b/runtime/src/runtime.c index cab2cb1..17742b6 100644 --- a/runtime/src/runtime.c +++ b/runtime/src/runtime.c @@ -30,6 +30,14 @@ uint64_t runtime_worker_threads_deadline[RUNTIME_WORKER_THREAD_CORE_COUNT] = { U * Shared Process / Listener Thread Logic * *****************************************/ +void +runtime_cleanup() +{ + if (runtime_sandbox_perf_log != NULL) fflush(runtime_sandbox_perf_log); + + exit(EXIT_SUCCESS); +} + /** * Initialize runtime global state, mask signals, and init http parser */ @@ -56,6 +64,13 @@ runtime_initialize(void) panic("Invalid scheduler policy set: %u\n", runtime_scheduler); } + /* Configure Signals */ + signal(SIGPIPE, SIG_IGN); + signal(SIGTERM, runtime_cleanup); + /* These should only be unmasked by workers */ + software_interrupt_mask_signal(SIGUSR1); + software_interrupt_mask_signal(SIGALRM); + http_parser_settings_initialize(); admissions_control_initialize(); } diff --git a/runtime/src/worker_thread.c b/runtime/src/worker_thread.c index 30250a2..7eb893b 100644 --- a/runtime/src/worker_thread.c +++ b/runtime/src/worker_thread.c @@ -332,8 +332,6 @@ worker_thread_main(void *argument) software_interrupt_unmask_signal(SIGUSR1); } - signal(SIGPIPE, SIG_IGN); - /* Initialize epoll */ worker_thread_epoll_file_descriptor = epoll_create1(0); if (unlikely(worker_thread_epoll_file_descriptor < 0)) panic_err();