Commit 64dc66c2 authored by Filipe Brandenburger's avatar Filipe Brandenburger Committed by Pavel Emelyanov

dump: do not fail dump when robust_lists are disabled

Robust lists may be disabled, for example if the "futex_cmpxchg_enabled"
variable in the kernel is unset.

Detect that case by checking that both "get_robust_list" and "set_robust_list"
syscalls return ENOSYS and do not make criu dump fail in that case, but simply
assume an empty list, which is consistent with the syscalls not being
available.

Tested: Successfully ran the zdtm test suite on a kernel where the
"get_robust_list" and "set_robust_list" syscalls are disabled.
Signed-off-by: 's avatarFilipe Brandenburger <filbranden@google.com>
Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent bbb3299f
...@@ -539,15 +539,35 @@ static int get_task_futex_robust_list(pid_t pid, ThreadCoreEntry *info) ...@@ -539,15 +539,35 @@ static int get_task_futex_robust_list(pid_t pid, ThreadCoreEntry *info)
int ret; int ret;
ret = sys_get_robust_list(pid, &head, &len); ret = sys_get_robust_list(pid, &head, &len);
if (ret) { if (ret == -ENOSYS) {
pr_err("Failed obtaining futex robust list on %d\n", pid); /*
return -1; * If the kernel says get_robust_list is not implemented, then
* check whether set_robust_list is also not implemented, in
* that case we can assume it is empty, since set_robust_list
* is the only way to populate it. This case is possible when
* "futex_cmpxchg_enabled" is unset in the kernel.
*
* The following system call should always fail, even if it is
* implemented, in which case it will return -EINVAL because
* len should be greater than zero.
*/
if (sys_set_robust_list(NULL, 0) != -ENOSYS)
goto err;
head = NULL;
len = 0;
} else if (ret) {
goto err;
} }
info->futex_rla = encode_pointer(head); info->futex_rla = encode_pointer(head);
info->futex_rla_len = (u32)len; info->futex_rla_len = (u32)len;
return 0; return 0;
err:
pr_err("Failed obtaining futex robust list on %d\n", pid);
return -1;
} }
static int get_task_personality(pid_t pid, u32 *personality) static int get_task_personality(pid_t pid, u32 *personality)
......
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