[LTP] Make ioctl_pidfd02 valgrind-compliant

Cyril Hrubis chrubis@suse.cz
Wed Apr 15 13:34:22 CEST 2026


Hi!
>  #ifdef __s390x__
> -	pid = syscall(__NR_clone, NULL, flags);
> +	pid = syscall(__NR_clone, NULL, flags, args.pidfd);
>  #else
> -	pid = syscall(__NR_clone, flags, NULL);
> +	pid = syscall(__NR_clone, flags, NULL, args.pidfd);
>  #endif

Aren't we missing more that that?

Looking at kernel/fork.c:

#ifdef __ARCH_WANT_SYS_CLONE
#ifdef CONFIG_CLONE_BACKWARDS
SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
                 int __user *, parent_tidptr,
                 unsigned long, tls,
                 int __user *, child_tidptr)
#elif defined(CONFIG_CLONE_BACKWARDS2)
SYSCALL_DEFINE5(clone, unsigned long, newsp, unsigned long, clone_flags,
                 int __user *, parent_tidptr,
                 int __user *, child_tidptr,
                 unsigned long, tls)
#elif defined(CONFIG_CLONE_BACKWARDS3)
SYSCALL_DEFINE6(clone, unsigned long, clone_flags, unsigned long, newsp,
                int, stack_size,
                int __user *, parent_tidptr,
                int __user *, child_tidptr,
                unsigned long, tls)
#else
SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
                 int __user *, parent_tidptr,
                 int __user *, child_tidptr,
                 unsigned long, tls)
#endif
{
        struct kernel_clone_args args = {
                .flags          = (lower_32_bits(clone_flags) & ~CSIGNAL),
                .pidfd          = parent_tidptr,
                .child_tid      = child_tidptr,
                .parent_tid     = parent_tidptr,
                .exit_signal    = (lower_32_bits(clone_flags) & CSIGNAL),
                .stack          = newsp,
                .tls            = tls,
        };

        return kernel_clone(&args);
}
#endif

there is at least child_tidptr and tls as well.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list