[LTP] Make ioctl_pidfd02 valgrind-compliant

Martin Cermak mcermak@redhat.com
Fri Apr 17 10:34:43 CEST 2026


Hi Cyril,

On  Wed  2026-04-15  13:34 , Cyril Hrubis wrote:
> >  #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.

I've updated my patch (and commit message) accordingly, and sent
it via git send-email per your suggestion - as a separate email.
Please check.

Cheers,
Martin



More information about the ltp mailing list