Commit 95ae8ae5 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

restorer: Eliminate possible shadowing of @task_entries

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@kyup.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent b5d2b603
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
__ret; \ __ret; \
}) })
static struct task_entries *task_entries; static struct task_entries *task_entries_local;
static futex_t thread_inprogress; static futex_t thread_inprogress;
static pid_t *helpers; static pid_t *helpers;
static int n_helpers; static int n_helpers;
...@@ -86,7 +86,7 @@ static void sigchld_handler(int signal, siginfo_t *siginfo, void *data) ...@@ -86,7 +86,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); 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*/ /* sa_restorer may be unmaped, so we can't go back to userspace*/
sys_kill(sys_getpid(), SIGSTOP); sys_kill(sys_getpid(), SIGSTOP);
sys_exit_group(1); sys_exit_group(1);
...@@ -467,18 +467,18 @@ long __export_restore_thread(struct thread_restore_args *args) ...@@ -467,18 +467,18 @@ long __export_restore_thread(struct thread_restore_args *args)
pr_info("%ld: Restored\n", sys_gettid()); 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)) if (restore_signals(args->siginfo, args->siginfo_n, false))
goto core_restore_end; 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); restore_pdeath_sig(args);
if (args->ta->seccomp_mode != SECCOMP_MODE_DISABLED) if (args->ta->seccomp_mode != SECCOMP_MODE_DISABLED)
pr_info("Restoring seccomp mode %d for %ld\n", args->ta->seccomp_mode, sys_getpid()); 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); futex_dec_and_wake(&thread_inprogress);
...@@ -487,7 +487,7 @@ long __export_restore_thread(struct thread_restore_args *args) ...@@ -487,7 +487,7 @@ long __export_restore_thread(struct thread_restore_args *args)
core_restore_end: core_restore_end:
pr_err("Restorer abnormal termination for %ld\n", sys_getpid()); 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); sys_exit_group(1);
return -1; return -1;
} }
...@@ -988,7 +988,7 @@ static int wait_zombies(struct task_restore_args *task_args) ...@@ -988,7 +988,7 @@ static int wait_zombies(struct task_restore_args *task_args)
for (i = 0; i < task_args->zombies_n; i++) { for (i = 0; i < task_args->zombies_n; i++) {
int ret, nr_in_progress; 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); ret = sys_waitid(P_PID, task_args->zombies[i], NULL, WNOWAIT | WEXITED, NULL);
if (ret == -ECHILD) { if (ret == -ECHILD) {
...@@ -996,7 +996,7 @@ static int wait_zombies(struct task_restore_args *task_args) ...@@ -996,7 +996,7 @@ static int wait_zombies(struct task_restore_args *task_args)
* Let's wait when someone complete this stage * Let's wait when someone complete this stage
* and try again. * 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); nr_in_progress);
i--; i--;
continue; continue;
...@@ -1040,7 +1040,7 @@ long __export_restore_task(struct task_restore_args *args) ...@@ -1040,7 +1040,7 @@ long __export_restore_task(struct task_restore_args *args)
vdso_rt_size = args->vdso_rt_size; vdso_rt_size = args->vdso_rt_size;
#endif #endif
task_entries = args->task_entries; task_entries_local = args->task_entries;
helpers = args->helpers; helpers = args->helpers;
n_helpers = args->helpers_n; n_helpers = args->helpers_n;
zombies = args->zombies; zombies = args->zombies;
...@@ -1352,7 +1352,7 @@ long __export_restore_task(struct task_restore_args *args) ...@@ -1352,7 +1352,7 @@ long __export_restore_task(struct task_restore_args *args)
pr_info("%ld: Restored\n", sys_getpid()); 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) if (wait_helpers(args) < 0)
goto core_restore_end; goto core_restore_end;
...@@ -1376,7 +1376,7 @@ long __export_restore_task(struct task_restore_args *args) ...@@ -1376,7 +1376,7 @@ long __export_restore_task(struct task_restore_args *args)
if (ret) if (ret)
goto core_restore_end; 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); rst_tcp_socks_all(args);
...@@ -1398,7 +1398,7 @@ long __export_restore_task(struct task_restore_args *args) ...@@ -1398,7 +1398,7 @@ long __export_restore_task(struct task_restore_args *args)
futex_set_and_wake(&thread_inprogress, args->nr_threads); 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) if (ret)
BUG(); BUG();
...@@ -1442,7 +1442,7 @@ long __export_restore_task(struct task_restore_args *args) ...@@ -1442,7 +1442,7 @@ long __export_restore_task(struct task_restore_args *args)
rst_sigreturn(new_sp); rst_sigreturn(new_sp);
core_restore_end: 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()); pr_err("Restorer fail %ld\n", sys_getpid());
sys_exit_group(1); sys_exit_group(1);
return -1; return -1;
......
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