[CRIU] [PATCH 2/2] restorer: Eliminate possible shadowing of @task_entries
Cyrill Gorcunov
gorcunov at openvz.org
Wed Aug 24 03:32:28 PDT 2016
Lets make name an unique to not shadow the global instance.
On gcc-6.x series this doesn't cause problems but
did on gcc-4.9 series.
Nikolay Borisov <kernel at kyup.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
criu/pie/restorer.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c
index f1d380bd6313..d84d316aa441 100644
--- a/criu/pie/restorer.c
+++ b/criu/pie/restorer.c
@@ -55,7 +55,7 @@
__ret; \
})
-static struct task_entries *task_entries;
+static struct task_entries *task_entries_local;
static futex_t thread_inprogress;
static pid_t *helpers;
static int n_helpers;
@@ -89,7 +89,7 @@ static void sigchld_handler(int signal, siginfo_t *siginfo, void *data)
pr_info("Task %d %s %d\n", siginfo->si_pid, r, siginfo->si_status);
- futex_abort_and_wake(&task_entries->nr_in_progress);
+ futex_abort_and_wake(&task_entries_local->nr_in_progress);
/* sa_restorer may be unmaped, so we can't go back to userspace*/
sys_kill(sys_getpid(), SIGSTOP);
sys_exit_group(1);
@@ -471,18 +471,18 @@ long __export_restore_thread(struct thread_restore_args *args)
pr_info("%ld: Restored\n", sys_gettid());
- restore_finish_stage(task_entries, CR_STATE_RESTORE);
+ restore_finish_stage(task_entries_local, CR_STATE_RESTORE);
if (restore_signals(args->siginfo, args->siginfo_n, false))
goto core_restore_end;
- restore_finish_stage(task_entries, CR_STATE_RESTORE_SIGCHLD);
+ restore_finish_stage(task_entries_local, CR_STATE_RESTORE_SIGCHLD);
restore_pdeath_sig(args);
if (args->ta->seccomp_mode != SECCOMP_MODE_DISABLED)
pr_info("Restoring seccomp mode %d for %ld\n", args->ta->seccomp_mode, sys_getpid());
- restore_finish_stage(task_entries, CR_STATE_RESTORE_CREDS);
+ restore_finish_stage(task_entries_local, CR_STATE_RESTORE_CREDS);
futex_dec_and_wake(&thread_inprogress);
@@ -491,7 +491,7 @@ long __export_restore_thread(struct thread_restore_args *args)
core_restore_end:
pr_err("Restorer abnormal termination for %ld\n", sys_getpid());
- futex_abort_and_wake(&task_entries->nr_in_progress);
+ futex_abort_and_wake(&task_entries_local->nr_in_progress);
sys_exit_group(1);
return -1;
}
@@ -1066,7 +1066,7 @@ static int wait_zombies(struct task_restore_args *task_args)
for (i = 0; i < task_args->zombies_n; i++) {
int ret, nr_in_progress;
- nr_in_progress = futex_get(&task_entries->nr_in_progress);
+ nr_in_progress = futex_get(&task_entries_local->nr_in_progress);
ret = sys_waitid(P_PID, task_args->zombies[i], NULL, WNOWAIT | WEXITED, NULL);
if (ret == -ECHILD) {
@@ -1074,7 +1074,7 @@ static int wait_zombies(struct task_restore_args *task_args)
* Let's wait when someone complete this stage
* and try again.
*/
- futex_wait_while_eq(&task_entries->nr_in_progress,
+ futex_wait_while_eq(&task_entries_local->nr_in_progress,
nr_in_progress);
i--;
continue;
@@ -1118,7 +1118,7 @@ long __export_restore_task(struct task_restore_args *args)
vdso_rt_size = args->vdso_rt_size;
#endif
- task_entries = args->task_entries;
+ task_entries_local = args->task_entries;
helpers = args->helpers;
n_helpers = args->helpers_n;
zombies = args->zombies;
@@ -1454,7 +1454,7 @@ long __export_restore_task(struct task_restore_args *args)
pr_info("%ld: Restored\n", sys_getpid());
- restore_finish_stage(task_entries, CR_STATE_RESTORE);
+ restore_finish_stage(task_entries_local, CR_STATE_RESTORE);
if (wait_helpers(args) < 0)
goto core_restore_end;
@@ -1491,7 +1491,7 @@ long __export_restore_task(struct task_restore_args *args)
if (ret)
goto core_restore_end;
- restore_finish_stage(task_entries, CR_STATE_RESTORE_SIGCHLD);
+ restore_finish_stage(task_entries_local, CR_STATE_RESTORE_SIGCHLD);
rst_tcp_socks_all(args);
@@ -1513,7 +1513,7 @@ long __export_restore_task(struct task_restore_args *args)
futex_set_and_wake(&thread_inprogress, args->nr_threads);
- restore_finish_stage(task_entries, CR_STATE_RESTORE_CREDS);
+ restore_finish_stage(task_entries_local, CR_STATE_RESTORE_CREDS);
if (ret)
BUG();
@@ -1557,7 +1557,7 @@ long __export_restore_task(struct task_restore_args *args)
rst_sigreturn(new_sp, rt_sigframe);
core_restore_end:
- futex_abort_and_wake(&task_entries->nr_in_progress);
+ futex_abort_and_wake(&task_entries_local->nr_in_progress);
pr_err("Restorer fail %ld\n", sys_getpid());
sys_exit_group(1);
return -1;
--
2.7.4
More information about the CRIU
mailing list