[Lldb-commits] [lldb] [lldb] Fix SIGSEGV in `GetPtraceScope()` in `Procfs.cpp` (PR #142224)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 2 10:20:22 PDT 2025


================
@@ -120,6 +120,21 @@ TEST(Perf, RealPtraceScope) {
       << "Sensible values of ptrace_scope are between 0 and 3";
 }
 
+TEST(Perf, RealPtraceScopeWhenNotExist) {
+  // We first check we can NOT read /proc/sys/kernel/yama/ptrace_scope
+  auto buffer_or_error =
+      errorOrToExpected(getProcFile("sys/kernel/yama/ptrace_scope"));
+  if (buffer_or_error)
+    GTEST_SKIP() << "In order for this test to run, "
+                    "/proc/sys/kernel/yama/ptrace_scope should not exist";
----------------
clayborg wrote:

Does GTEST_SKIP cause an early return? And if the file does exist, do we want to create noise in the gtest output? We just want to make sure that if the file doesn't exist, we don't crash right?

https://github.com/llvm/llvm-project/pull/142224


More information about the lldb-commits mailing list