| Issue |
203853
|
| Summary |
compiler-rt / LLDB test failures due to disabled `ptrace_scope`
|
| Labels |
|
| Assignees |
|
| Reporter |
Thyre
|
Due to recent security vulnerabilities, some systems now use a changed default for `ptrace_scope`, e.g.,
```console
$ sysctl -w kernel.yama.ptrace_scope=3
```
LLDB correctly warns about this when starting to attach to an application:
```console
$ sleep 3500 &
[1] 1563316
$ ./bin/lldb -p 1563316
(lldb) process attach --pid 1563316
error: attach failed: The current value of ptrace_scope is 3, which will cause ptrace to fail to attach to a running process. This value cannot be changed without rebooting.
For more information, see: https://www.kernel.org/doc/Documentation/security/Yama.txt.
(lldb)
```
Similarly, the LeakSanitizer warns about this:
```
# .---command stdout------------
# | ==1909857==LeakSanitizer has encountered a fatal error.
# | ==1909857==HINT: For debugging, try setting environment variable LSAN_OPTIONS=verbosity=1:log_threads=1
# | ==1909857==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)
# | ==1909857==HINT: LeakSanitizer requires ptrace_scope to be disabled (e.g. echo 0 > /proc/sys/kernel/yama/ptrace_scope)
# `-----------------------------
```
However, this is not respected in the tests. Trying to run `check-lldb` for 58031e519153fdbe637f9f135ac1fbfef6f0e224 fails with 124 test failures on my system:
<details>
```
********************
********************
Failed Tests (124):
lldb-shell :: Breakpoint/invalid-condition.test
lldb-shell :: Breakpoint/jit-loader_jitlink_elf.test
lldb-shell :: Commands/command-expr-diagnostics.test
lldb-shell :: Commands/command-image-dump-ast.test
lldb-shell :: Commands/command-list-reach-beginning-of-file.test
lldb-shell :: Commands/command-list-reach-end-of-file.test
lldb-shell :: Commands/command-memory-region.test
lldb-shell :: Commands/command-process-launch-user-entry.test
lldb-shell :: Commands/command-process-save-core-not-a-plugin.test
lldb-shell :: Commands/command-source-embedded.test
lldb-shell :: Commands/command-stop-hook-no-target.test
lldb-shell :: Commands/command-thread-backtrace.test
lldb-shell :: Commands/command-thread-select.test
lldb-shell :: Commands/command-thread-siginfo.test
lldb-shell :: Driver/CommandOnCrashMultiThreaded.test
lldb-shell :: Driver/TestEmptyArgument.test
lldb-shell :: ExecControl/StopHook/stop-hook-unified.test
lldb-shell :: ExecControl/StopHook/stop-hook.test
lldb-shell :: Expr/TestAnonNamespaceParamFunc.cpp
lldb-shell :: Expr/TestExited.test
lldb-shell :: Expr/TestExprLanguageNote.test
lldb-shell :: Expr/TestExprWithSideEffect.cpp
lldb-shell :: Expr/TestExprWithSideEffectOnConvenienceVar.cpp
lldb-shell :: Expr/TestGlobalSymbolObjCConflict.c
lldb-shell :: Expr/TestIRMemoryMap.test
lldb-shell :: Expr/TestStringLiteralExpr.test
lldb-shell :: Expr/nodefaultlib.cpp
lldb-shell :: ObjectFile/ELF/minidebuginfo-set-and-hit-breakpoint.test
lldb-shell :: Process/TestEnvironment.test
lldb-shell :: Process/UnsupportedLanguage.test
lldb-shell :: Register/x86-64-fp-read.test
lldb-shell :: Register/x86-64-fp-write.test
lldb-shell :: Register/x86-64-gp-read.test
lldb-shell :: Register/x86-64-gp-write.test
lldb-shell :: Register/x86-64-read.test
lldb-shell :: Register/x86-64-write.test
lldb-shell :: Register/x86-64-ymm-read.test
lldb-shell :: Register/x86-64-ymm-write.test
lldb-shell :: Register/x86-fp-write.test
lldb-shell :: Register/x86-mm-xmm-read.test
lldb-shell :: Register/x86-mm-xmm-write.test
lldb-shell :: Register/x86-multithread-read.test
lldb-shell :: Register/x86-multithread-write.test
lldb-shell :: Settings/TestChildCountTruncation.test
lldb-shell :: Settings/TestChildDepthTruncation.test
lldb-shell :: Settings/TestCxxFrameFormat.test
lldb-shell :: Settings/TestCxxFrameFormatEmpty.test
lldb-shell :: Settings/TestCxxFrameFormatMixedLanguages.test
lldb-shell :: Settings/TestCxxFrameFormatObjC.test
lldb-shell :: Settings/TestCxxFrameFormatPartialFailure.test
lldb-shell :: Settings/TestCxxFrameFormatRecursive.test
lldb-shell :: Settings/TestFrameFormatColor.test
lldb-shell :: Settings/TestFrameFormatFunctionBasename.test
lldb-shell :: Settings/TestFrameFormatFunctionBasenameObjC.test
lldb-shell :: Settings/TestFrameFormatFunctionFormattedArguments.test
lldb-shell :: Settings/TestFrameFormatFunctionFormattedArgumentsObjC.test
lldb-shell :: Settings/TestFrameFormatFunctionPrefix.test
lldb-shell :: Settings/TestFrameFormatFunctionQualifiers.test
lldb-shell :: Settings/TestFrameFormatFunctionQualifiersObjC.test
lldb-shell :: Settings/TestFrameFormatFunctionReturn.test
lldb-shell :: Settings/TestFrameFormatFunctionReturnObjC.test
lldb-shell :: Settings/TestFrameFormatFunctionScope.test
lldb-shell :: Settings/TestFrameFormatFunctionScopeObjC.test
lldb-shell :: Settings/TestFrameFormatFunctionSuffix.test
lldb-shell :: Settings/TestFrameFormatFunctionTemplateArguments.test
lldb-shell :: Settings/TestFrameFormatFunctionTemplateArgumentsObjC.test
lldb-shell :: Settings/TestFrameFormatMangling.test
lldb-shell :: Settings/TestFrameFormatName.test
lldb-shell :: Settings/TestFrameFormatNoColor.test
lldb-shell :: Settings/TestFrameFunctionInlined.test
lldb-shell :: Settings/TestLineMarkerColor.test
lldb-shell :: Subprocess/clone-follow-child-softbp.test
lldb-shell :: Subprocess/clone-follow-child-wp.test
lldb-shell :: Subprocess/clone-follow-child.test
lldb-shell :: Subprocess/clone-follow-parent-softbp.test
lldb-shell :: Subprocess/clone-follow-parent-wp.test
lldb-shell :: Subprocess/clone-follow-parent.test
lldb-shell :: Subprocess/fork-follow-child-softbp.test
lldb-shell :: Subprocess/fork-follow-child-wp.test
lldb-shell :: Subprocess/fork-follow-child.test
lldb-shell :: Subprocess/fork-follow-parent-softbp.test
lldb-shell :: Subprocess/fork-follow-parent-wp.test
lldb-shell :: Subprocess/fork-follow-parent.test
lldb-shell :: Subprocess/vfork-follow-child-softbp.test
lldb-shell :: Subprocess/vfork-follow-child-wp.test
lldb-shell :: Subprocess/vfork-follow-child.test
lldb-shell :: Subprocess/vfork-follow-parent-softbp.test
lldb-shell :: Subprocess/vfork-follow-parent-wp.test
lldb-shell :: Subprocess/vfork-follow-parent.test
lldb-shell :: SymbolFile/DWARF/DW_OP_piece-O3.c
lldb-shell :: SymbolFile/DWARF/debug-types-expressions.test
lldb-shell :: SymbolFile/DWARF/dwarf5-lazy-dwo.c
lldb-shell :: SymbolFile/DWARF/dwo-debug-file-search-path-symlink-relative-compdir.c
lldb-shell :: SymbolFile/DWARF/dwo-debug-file-search-paths-dwoname-absolute-compdir.c
lldb-shell :: SymbolFile/DWARF/dwo-debug-file-search-paths-filename-only-absolute-compdir.c
lldb-shell :: SymbolFile/DWARF/dwo-debug-file-search-paths-filename-only-relative-compdir.c
lldb-shell :: SymbolFile/DWARF/dwo-debug-file-search-paths-relative-compdir.c
lldb-shell :: SymbolFile/DWARF/dwo-missing-error.test
lldb-shell :: SymbolFile/DWARF/dwo-relative-filename-only-binary-dir.c
lldb-shell :: SymbolFile/DWARF/dwo-static-data-member-access.test
lldb-shell :: SymbolFile/DWARF/split-dwarf-_expression_-eval-bug.cpp
lldb-shell :: SymbolFile/DWARF/vla.cpp
lldb-shell :: SymbolFile/DWARF/x86/DW_TAG_GNU_call_site-DW_AT_low_pc.s
lldb-shell :: SymbolFile/DWARF/x86/DW_TAG_variable-DW_AT_decl_file-DW_AT_abstract_origin-crosscu1.s
lldb-shell :: SymbolFile/OnDemand/source-breakpoint.test
lldb-shell :: SymbolFile/OnDemand/symbolic-breakpoint.test
lldb-shell :: SymbolFile/checksum-mismatch.test
lldb-shell :: Unwind/basic-block-sections-with-dwarf.test
lldb-shell :: Unwind/basic-block-sections.test
lldb-shell :: Unwind/eh-frame-augment-noop.test
lldb-shell :: Unwind/eh-frame-dwarf-unwind-abort.test
lldb-shell :: Unwind/eh-frame-dwarf-unwind-val-offset.test
lldb-shell :: Unwind/eh-frame-dwarf-unwind.test
lldb-shell :: Unwind/eh-frame-small-fde.test
lldb-shell :: Unwind/prefer-debug-over-eh-frame.test
lldb-shell :: Unwind/split-machine-functions.test
lldb-shell :: Unwind/thread-step-out-ret-addr-check.test
lldb-shell :: Unwind/trap_frame_sym_ctx.test
lldb-shell :: Unwind/unwind-plan-dwarf-dump.test
lldb-shell :: Watchpoint/ExpressionLanguage.test
lldb-shell :: Watchpoint/SetErrorCases.test
lldb-unit :: tools/lldb-server/tests/./LLDBServerTests/TestBase/LaunchModePreservesEnvironment
lldb-unit :: tools/lldb-server/tests/./LLDBServerTests/TestBase/qStructuredDataPlugins
lldb-unit :: tools/lldb-server/tests/./LLDBServerTests/TestBase/vAttachRichError
Testing Time: 28.67s
Total Discovered Tests: 34121
Skipped : 2 (0.01%)
Unsupported : 1654 (4.85%)
Passed : 32330 (94.75%)
Expectedly Failed: 11 (0.03%)
Failed : 124 (0.36%)
make[3]: *** [tools/lldb/test/CMakeFiles/check-lldb.dir/build.make:71: tools/lldb/test/CMakeFiles/check-lldb] Error 1
```
</details>
For `compiler-rt`, a significantly higher amount of tests fail.
If possible, those tests should probably be ignored instead, or marked with XFAIL.
Some examples:
```
********************
FAIL: lldb-unit :: tools/lldb-server/tests/./LLDBServerTests/1/3 (2841 of 2842)
******************** TEST 'lldb-unit :: tools/lldb-server/tests/./LLDBServerTests/1/3' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:/home/jreuter/Projects/Compilers/llvm-project/_build_lld/tools/lldb/unittests/tools/lldb-server/tests/./LLDBServerTests-lldb-unit-1428536-1-3.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=3 GTEST_SHARD_INDEX=1 /home/jreuter/Projects/Compilers/llvm-project/_build_lld/tools/lldb/unittests/tools/lldb-server/tests/./LLDBServerTests
--
Script:
--
/home/jreuter/Projects/Compilers/llvm-project/_build_lld/tools/lldb/unittests/tools/lldb-server/tests/./LLDBServerTests --gtest_filter=TestBase.vAttachRichError
--
error: failed to launch '/home/jreuter/Projects/Compilers/llvm-project/_build_lld/tools/lldb/unittests/tools/lldb-server/./environment_check': ptrace failed: Operation not permitted
/home/jreuter/Projects/Compilers/llvm-project/lldb/unittests/tools/lldb-server/tests/LLGSTest.cpp:60: Failure
Value of: llvm::detail::TakeExpected(ClientOr)
Expected: succeeded
Actual: failed (Connection timed out)
/home/jreuter/Projects/Compilers/llvm-project/lldb/unittests/tools/lldb-server/tests/LLGSTest.cpp:60
Value of: llvm::detail::TakeExpected(ClientOr)
Expected: succeeded
Actual: failed (Connection timed out)
```
```
********************
FAIL: lldb-shell :: Unwind/unwind-plan-dwarf-dump.test (2208 of 2842)
******************** TEST 'lldb-shell :: Unwind/unwind-plan-dwarf-dump.test' FAILED ********************
Exit Code: 1
Command Output (stdout):
--
# RUN: at line 3
/home/jreuter/Projects/Compilers/llvm-project/_build_lld/bin/clang --target=specify-a-target-or-use-a-_host-substitution --target=x86_64-unknown-linux-gnu -pthread -fmodules-cache-path=/home/jreuter/Projects/Compilers/llvm-project/_build_lld/lldb-test-build.noindex/module-cache-clang/lldb-shell /home/jreuter/Projects/Compilers/llvm-project/lldb/test/Shell/Unwind/Inputs/unwind-plan-dwarf-dump.s -o /home/jreuter/Projects/Compilers/llvm-project/_build_lld/tools/lldb/test/Shell/Unwind/Output/unwind-plan-dwarf-dump.test.tmp
# executed command: /home/jreuter/Projects/Compilers/llvm-project/_build_lld/bin/clang --target=specify-a-target-or-use-a-_host-substitution --target=x86_64-unknown-linux-gnu -pthread -fmodules-cache-path=/home/jreuter/Projects/Compilers/llvm-project/_build_lld/lldb-test-build.noindex/module-cache-clang/lldb-shell /home/jreuter/Projects/Compilers/llvm-project/lldb/test/Shell/Unwind/Inputs/unwind-plan-dwarf-dump.s -o /home/jreuter/Projects/Compilers/llvm-project/_build_lld/tools/lldb/test/Shell/Unwind/Output/unwind-plan-dwarf-dump.test.tmp
# .---command stderr------------
# | clang: warning: argument unused during compilation: '-fmodules-cache-path=/home/jreuter/Projects/Compilers/llvm-project/_build_lld/lldb-test-build.noindex/module-cache-clang/lldb-shell' [-Wunused-command-line-argument]
# `-----------------------------
# RUN: at line 4
/home/jreuter/Projects/Compilers/llvm-project/_build_lld/bin/lldb --no-lldbinit -S /home/jreuter/Projects/Compilers/llvm-project/_build_lld/tools/lldb/test/Shell/lit-lldb-init-quiet /home/jreuter/Projects/Compilers/llvm-project/_build_lld/tools/lldb/test/Shell/Unwind/Output/unwind-plan-dwarf-dump.test.tmp -s /home/jreuter/Projects/Compilers/llvm-project/lldb/test/Shell/Unwind/unwind-plan-dwarf-dump.test -o exit | /home/jreuter/Projects/Compilers/llvm-project/_build_lld/bin/FileCheck /home/jreuter/Projects/Compilers/llvm-project/lldb/test/Shell/Unwind/unwind-plan-dwarf-dump.test
# executed command: /home/jreuter/Projects/Compilers/llvm-project/_build_lld/bin/lldb --no-lldbinit -S /home/jreuter/Projects/Compilers/llvm-project/_build_lld/tools/lldb/test/Shell/lit-lldb-init-quiet /home/jreuter/Projects/Compilers/llvm-project/_build_lld/tools/lldb/test/Shell/Unwind/Output/unwind-plan-dwarf-dump.test.tmp -s /home/jreuter/Projects/Compilers/llvm-project/lldb/test/Shell/Unwind/unwind-plan-dwarf-dump.test -o exit
# .---command stderr------------
# | error: Cannot launch '/home/jreuter/Projects/Compilers/llvm-project/_build_lld/tools/lldb/test/Shell/Unwind/Output/unwind-plan-dwarf-dump.test.tmp': ptrace failed: Operation not permitted
# `-----------------------------
# executed command: /home/jreuter/Projects/Compilers/llvm-project/_build_lld/bin/FileCheck /home/jreuter/Projects/Compilers/llvm-project/lldb/test/Shell/Unwind/unwind-plan-dwarf-dump.test
# .---command stderr------------
# | /home/jreuter/Projects/Compilers/llvm-project/lldb/test/Shell/Unwind/unwind-plan-dwarf-dump.test:10:10: error: CHECK: expected string not found in input
# | # CHECK: stop reason = breakpoint 1.1
# | ^
# | <stdin>:9:14: note: scanning from here
# | Breakpoint 1: where = unwind-plan-dwarf-dump.test.tmp`main, address = 0x000000000000113c
# | ^
# | <stdin>:10:8: note: possible intended match here
# | (lldb) process launch
# | ^
# |
# | Input file: <stdin>
# | Check file: /home/jreuter/Projects/Compilers/llvm-project/lldb/test/Shell/Unwind/unwind-plan-dwarf-dump.test
# |
# | -dump-input=help explains the following input dump.
# |
# | Input was:
# | <<<<<<
# | 1: (lldb) command source -s 0 '/home/jreuter/Projects/Compilers/llvm-project/_build_lld/tools/lldb/test/Shell/lit-lldb-init-quiet'
# | 2: Executing commands in '/home/jreuter/Projects/Compilers/llvm-project/_build_lld/tools/lldb/test/Shell/lit-lldb-init-quiet'.
# | 3: (lldb) command source -C --silent-run true lit-lldb-init
# | 4: (lldb) target create "/home/jreuter/Projects/Compilers/llvm-project/_build_lld/tools/lldb/test/Shell/Unwind/Output/unwind-plan-dwarf-dump.test.tmp"
# | 5: Current executable set to '/home/jreuter/Projects/Compilers/llvm-project/_build_lld/tools/lldb/test/Shell/Unwind/Output/unwind-plan-dwarf-dump.test.tmp' (x86_64).
# | 6: (lldb) command source -s 0 '/home/jreuter/Projects/Compilers/ll<truncated>Please see the issue for the entire body.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs