[CRIU] zdtm test build failure on s390x (s390x_regs_check.c)

Adrian Reber adrian at lisas.de
Tue Sep 26 18:49:26 MSK 2017


On Tue, Sep 26, 2017 at 04:58:32PM +0200, Michael Holzheu wrote:
> I could reproduce the problem with the kernel that you have
> provided. The following patch solved the problem, but we still
> have a problem for uns:

Flavor 'uns' does not work on the RHEL kernel. All tests will fail.

> =================== Run zdtm/static/s390x_regs_check in uns ====================
> Start test
> ./s390x_regs_check --pidfile=s390x_regs_check.pid --outfile=s390x_regs_check.out
> clone() failed: Invalid argument
> make: *** [s390x_regs_check.pid] Error 1
> ############### Test zdtm/static/s390x_regs_check FAIL at start ################
> ##################################### FAIL #####################################
> 
> Looks like the ptrace_create() call has a problem in that case.
> 
> Here the patch that fixes "h" and "ns".
> ---
> Subject: [PATCH] zdtm/s390x_regs_check: Fix wait() for threads
> 
> For older kernels (e.g. RHEL7 4.10) it seems that wait(NULL) after

 this should probably be        3.10



> ptrace(PTHREAD_ATTACH) does not work properly for threads that have
> to be created via clone().
> 
> Fix this by using waitpid() with the __WALL flag.
> 
> From the waitpid() man page:
> 
>  __WALL (since Linux 2.4)
>  Wait  for  all  children, regardless of type ("clone" or "non-clone").
> 
> Reported-by: Adrian Reber <areber at redhat.com>
> Signed-off-by: Michael Holzheu <holzheu at linux.vnet.ibm.com>
> ---
>  test/zdtm/static/s390x_regs_check.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/test/zdtm/static/s390x_regs_check.c b/test/zdtm/static/s390x_regs_check.c
> index a92679ab0..4854b534a 100644
> --- a/test/zdtm/static/s390x_regs_check.c
> +++ b/test/zdtm/static/s390x_regs_check.c
> @@ -391,7 +391,10 @@ static void child_func(void)
>  static int ptrace_attach(pid_t pid)
>  {
>  	if (ptrace(PTRACE_ATTACH, pid, 0, 0) == 0) {
> -		wait(NULL);
> +		if (waitpid(pid, NULL, __WALL) < 0) {
> +			pr_perror("Waiting for thread %d failed", pid);
> +			return -1;
> +		}
>  		return 0;
>  	}
>  	pr_perror("Attach to thread %d failed", pid);
> -- 
> 2.11.0

Patch works for me in the flavors h and ns (uns is known to not work on
the RHEL kernel), thanks.


		Adrian


More information about the CRIU mailing list