mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
selftests: riscv: Bypass libc in inactive vector ptrace test
The ptrace_v_not_enabled test expects the child to reach its ebreak before it has used the vector extension. That is not guaranteed when using fork(), because libc may run child atfork handlers before returning to the test code. In those cases PTRACE_GETREGSET for NT_RISCV_VECTOR then succeeds instead of returning ENODATA for inactive vector state. Use the raw clone syscall with SIGCHLD to keep fork-like semantics while bypassing libc's fork wrapper and atfork handler chain. Cc: Andy Chiu <tchiu@tenstorrent.com> Assisted-by: Claude:claude-sonnet-4-6 Signed-off-by: Andrew Jones <andrew.jones@oss.qualcomm.com> Link: https://patch.msgid.link/20260707153827.175245-1-andrew.jones@oss.qualcomm.com Signed-off-by: Paul Walmsley <pjw@kernel.org>
This commit is contained in:
parent
81bbcff0c0
commit
70b439e46e
|
|
@ -1,5 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/uio.h>
|
||||
|
|
@ -25,9 +26,9 @@ TEST(ptrace_v_not_enabled)
|
|||
SKIP(return, "Vector not supported");
|
||||
|
||||
chld_lock = 1;
|
||||
pid = fork();
|
||||
pid = (pid_t)syscall(SYS_clone, SIGCHLD, 0, NULL, 0, NULL);
|
||||
ASSERT_LE(0, pid)
|
||||
TH_LOG("fork: %m");
|
||||
TH_LOG("clone: %m");
|
||||
|
||||
if (pid == 0) {
|
||||
while (chld_lock == 1)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user