Commit 18dee445 authored by Pavel Emelyanov's avatar Pavel Emelyanov

tcp: Restore creds after turning off tcp repair mode

The tcp repair manipulations require CAP_SYS_NET_ADMIN on
a calling task. Thus, if the task to restore is run from
non-root user, the tcp socket repair off will fail, but
restoration wouldn't abort.

Fix this by moving creds restore after tcp restore finish.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 2ab06c9c
...@@ -739,13 +739,6 @@ long __export_restore_task(struct task_restore_core_args *args) ...@@ -739,13 +739,6 @@ long __export_restore_task(struct task_restore_core_args *args)
restore_rlims(args); restore_rlims(args);
/*
* Writing to last-pid is CAP_SYS_ADMIN protected, thus restore
* creds _after_ all threads creation.
*/
restore_creds(&args->creds);
pr_info("%ld: Restored\n", sys_getpid()); pr_info("%ld: Restored\n", sys_getpid());
futex_set(&zombies_inprogress, args->nr_zombies); futex_set(&zombies_inprogress, args->nr_zombies);
...@@ -781,6 +774,14 @@ long __export_restore_task(struct task_restore_core_args *args) ...@@ -781,6 +774,14 @@ long __export_restore_task(struct task_restore_core_args *args)
rst_tcp_socks_all(args->rst_tcp_socks, args->rst_tcp_socks_size); rst_tcp_socks_all(args->rst_tcp_socks, args->rst_tcp_socks_size);
/*
* Writing to last-pid is CAP_SYS_ADMIN protected,
* turning off TCP repair is CAP_SYS_NED_ADMIN protected,
* thus restore* creds _after_ all of the above.
*/
restore_creds(&args->creds);
log_set_fd(-1); log_set_fd(-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