runtime: when ptrace_scope is 2 or 3, certain tests in runtime-gdb_test.go fail #69932
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
Go version
go version go1.23.2 linux/arm64
Output of
go env
in your module/workspace:What did you do?
The ptrace_scope kernel parameter controls the level of restrictions on process tracing with ptrace in Linux.
It determines which processes can be traced by others.
The values are:
0 - Default attach security permissions.
1 - Restricted attach. Only child processes plus normal permissions.
2 - Admin-only attach. Only executables with CAP_SYS_PTRACE.
3 - No attach. No process may call ptrace at all. Irrevocable.
This parameter enhances security by limiting unauthorized access to process memory and control.
When kernel parameter ptrace_scope is set to 2 or 3, certain test cases within runtime-gdb_test.go will fail.
Steps 1.
cat /proc/sys/kernel/yama/ptrace_scope
Steps 2.
whoami && id -u
Steps 3.
cd /usr/lib/golang/src/runtime && go test ./runtime-gdb_test.go --count=1
What did you see happen?
The value of ptrace_scope is 0 or 1. Non-root and root user.
The test passes.
The value of ptrace_scope is 2. Non-root user.
2.1 The failed test cases are: TestGdbBacktrace, TestGdbPanic, TestGdbPython, TestGdbInfCallstack, TestGdbPythonCgo
2.2 The abnormal test cases are: TestGdbAutotmpTypes, TestGdbConst
The value of ptrace_scope is 2. Root user.
The test passes.
The value of ptrace_scope is 3. Non-root and root user.
Same as the second scenario.
What did you expect to see?
When the kernel parameter ptrace_scope is set to 2 or 3, certain test cases in runtime-gdb_test.go will fail. We should skip these tests.
The text was updated successfully, but these errors were encountered: