Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Rapoport <rppt@linux.vnet.ibm.com>2018-06-06 17:30:57 +0300
committerAndrei Vagin <avagin@virtuozzo.com>2018-06-15 02:17:42 +0300
commita72719d36562e0890b988e6cc2b5e9041628c9b7 (patch)
tree563d6aca3a84599e722b12c73cfdd2b694e255d1
parentfcfcc13ca4bb40d481a524a2b0cac3bcf8a72cb5 (diff)
zdtm/lib: don't close bad criu_status_in file descriptor in signal handler
The criu_status_in is not always used and it may be -1 when the signal handler closes it. With lazy-pages we hit a corner case which clobbers the errno value. This happens when we resume the process inside glibc syscall wrapper and get the signal before the page containing errno is copied. In this case, signal handler is invoked before the syscall return value is written to errno and the actual value of errno seen by the process becomes -EBADF because of close(-1) in the signal handler. Let's ensure that close() in signal handler does not fail to make Jenkins happier while the proper solution for the lazy-pages issue is found. Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
-rw-r--r--test/zdtm/lib/test.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/zdtm/lib/test.c b/test/zdtm/lib/test.c
index 572d160f7..e0ba44b98 100644
--- a/test/zdtm/lib/test.c
+++ b/test/zdtm/lib/test.c
@@ -40,7 +40,8 @@ static void sig_hand(int signo)
if (parent)
futex_set_and_wake(&test_shared_state->stage, TEST_FAIL_STAGE);
futex_set_and_wake(&sig_received, signo);
- close(criu_status_in);
+ if (criu_status_in >= 0)
+ close(criu_status_in);
}
static char *outfile;