From 84a8717971d40679cf3062c320591233c7a8c101 Mon Sep 17 00:00:00 2001 From: "sangkyeong.jeong" Date: Wed, 11 Mar 2026 10:48:32 +0900 Subject: [PATCH 1/2] lifecycle: Add exception handling for CPU affinity --- .../src/configuration_manager/configurationmanager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/launch_manager_daemon/src/configuration_manager/configurationmanager.cpp b/src/launch_manager_daemon/src/configuration_manager/configurationmanager.cpp index 0d79443d..94264926 100644 --- a/src/launch_manager_daemon/src/configuration_manager/configurationmanager.cpp +++ b/src/launch_manager_daemon/src/configuration_manager/configurationmanager.cpp @@ -80,7 +80,8 @@ const char* kEnvVarDefaultValue = "/opt/internal/launch_manager/etc/ecu-cfg"; / const uint32_t ConfigurationManager::kDefaultProcessExecutionError = 1U; uint32_t ConfigurationManager::kDefaultProcessorAffinityMask() { - return (1U << osal::getNumCores()) - 1U; + uint32_t core = osal::getNumCores(); + return (1U << (core > 31 ? 31 : core)) - 1U; } const int32_t ConfigurationManager::kDefaultSchedulingPolicy = SCHED_OTHER; const int32_t ConfigurationManager::kDefaultRealtimeSchedulingPriority = 99; From 21d3d287d422b0832c565fea9fe41b991513fa30 Mon Sep 17 00:00:00 2001 From: "sangkyeong.jeong" Date: Thu, 12 Mar 2026 13:56:46 +0900 Subject: [PATCH 2/2] lifecycle: Use 64-bit operations Shifting a 32-bit number by 32 bits causes undefined behavior, so modify it to perform the shift operation on a 64-bit number and then cast it. --- .../src/configuration_manager/configurationmanager.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/launch_manager_daemon/src/configuration_manager/configurationmanager.cpp b/src/launch_manager_daemon/src/configuration_manager/configurationmanager.cpp index 94264926..2a82cc9b 100644 --- a/src/launch_manager_daemon/src/configuration_manager/configurationmanager.cpp +++ b/src/launch_manager_daemon/src/configuration_manager/configurationmanager.cpp @@ -80,8 +80,7 @@ const char* kEnvVarDefaultValue = "/opt/internal/launch_manager/etc/ecu-cfg"; / const uint32_t ConfigurationManager::kDefaultProcessExecutionError = 1U; uint32_t ConfigurationManager::kDefaultProcessorAffinityMask() { - uint32_t core = osal::getNumCores(); - return (1U << (core > 31 ? 31 : core)) - 1U; + return static_cast((1ULL << osal::getNumCores()) - 1ULL); } const int32_t ConfigurationManager::kDefaultSchedulingPolicy = SCHED_OTHER; const int32_t ConfigurationManager::kDefaultRealtimeSchedulingPriority = 99;