2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00

compel: set mxcsr during error injection to zero

During error injection tests there are random values loaded in some of
the registers. The kernel, however, has the following check:

    if (mxcsr[0] & ~mxcsr_feature_mask)
        return -EINVAL;

So depending on the random values loaded mxcsr might have values that
the kernel rejects with EINVAL. Setting mxcsr to zero during the tests
lets the error injection test pass.

Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
Adrian Reber
2022-03-09 08:40:35 +00:00
committed by Andrei Vagin
parent ef98a71b16
commit 97a9985673

View File

@@ -272,6 +272,17 @@ static void validate_random_xstate(struct xsave_struct *xsave)
/* No reserved bits may be set */
memset(&hdr->reserved, 0, sizeof(hdr->reserved));
/*
* While using PTRACE_SETREGSET the kernel checks that
* "Reserved bits in MXCSR must be zero."
* if (mxcsr[0] & ~mxcsr_feature_mask)
* return -EINVAL;
*
* As the mxcsr_feature_mask depends on the CPU the easiest solution for
* this error injection test is to set mxcsr just to zero.
*/
xsave->i387.mxcsr = 0;
}
/*