selftests/clone3: Check that the child exited cleanly
authorMark Brown <broonie@kernel.org>
Tue, 9 Apr 2024 20:39:43 +0000 (21:39 +0100)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 6 May 2024 19:57:20 +0000 (13:57 -0600)
commit698eb790e016427bf3b2e55693e653222af13691
tree07c83ea4ac8ad8956a2dcbed9874d3db25e3b762
parent7b8674cae80f68304ec6628e455c169a7dc2ad0d
selftests/clone3: Check that the child exited cleanly

When the child exits during the clone3() selftest we use WEXITSTATUS() to
get the exit status from the process without first checking WIFEXITED() to
see if the result will be valid. This can lead to incorrect results, for
example if the child exits due to signal. Add a WIFEXTED() check and report
any non-standard exit as a failure, using EXIT_FAILURE as the exit status
for call_clone3() since we otherwise report 0 or negative errnos.

Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/clone3/clone3.c