Commit d6d9d7f7 authored by Mike Rapoport's avatar Mike Rapoport Committed by Pavel Emelyanov

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: 's avatarMike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent b4afa080
...@@ -40,7 +40,8 @@ static void sig_hand(int signo) ...@@ -40,7 +40,8 @@ static void sig_hand(int signo)
if (parent) if (parent)
futex_set_and_wake(&test_shared_state->stage, TEST_FAIL_STAGE); futex_set_and_wake(&test_shared_state->stage, TEST_FAIL_STAGE);
futex_set_and_wake(&sig_received, signo); futex_set_and_wake(&sig_received, signo);
close(criu_status_in); if (criu_status_in >= 0)
close(criu_status_in);
} }
static char *outfile; static char *outfile;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment