[Lldb-commits] [lldb] [lldb] Check both the result and output of sysctl (PR #186462)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 13 10:22:17 PDT 2026


https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/186462

This tightens the sysctl checks to check both the command result and the output.

>From 7f8be0878362d8c51be306716db133de8a2a96c6 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Fri, 13 Mar 2026 10:19:12 -0700
Subject: [PATCH] [lldb] Check both the result and output of sysctl

This tightens the sysctl checks to check both the command result and the
output.
---
 lldb/cmake/modules/LLDBConfig.cmake          | 2 +-
 lldb/tools/debugserver/source/CMakeLists.txt | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index 291f189c2bee8..01738b29c7d8b 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -173,7 +173,7 @@ if (APPLE)
       RESULT_VARIABLE SYSCTL_RESULT
       OUTPUT_STRIP_TRAILING_WHITESPACE
   )
-  if(SYSCTL_RESULT EQUAL 0)
+  if(SYSCTL_RESULT EQUAL 0 AND SYSCTL_OUTPUT STREQUAL "1")
     set(default_enable_mte ON)
   endif()
 
diff --git a/lldb/tools/debugserver/source/CMakeLists.txt b/lldb/tools/debugserver/source/CMakeLists.txt
index 571313fa92cde..3c1ddf84fc21e 100644
--- a/lldb/tools/debugserver/source/CMakeLists.txt
+++ b/lldb/tools/debugserver/source/CMakeLists.txt
@@ -122,7 +122,7 @@ if (BUILDING_FOR_ARM64_OSX)
         RESULT_VARIABLE SYSCTL_RESULT
         OUTPUT_STRIP_TRAILING_WHITESPACE
     )
-    if(SYSCTL_RESULT EQUAL 0)
+    if(SYSCTL_RESULT EQUAL 0 AND SYSCTL_OUTPUT STREQUAL "1")
       set(default_arm64e_debugserver ON)
     endif()
   endif()



More information about the lldb-commits mailing list