Commit 80c92e90 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Pavel Emelyanov

report the potential selinux problem if mmap_seized() fails

selinux can deny mmap(PROT_WRITE | PROT_EXEC) and in this case it is
not clear why CRIU fails, "Can't allocate memory for parasite blob"
doesn't tell too much. Add a pr_warn() hint for the user.
Signed-off-by: 's avatarOleg Nesterov <oleg@redhat.com>
Acked-by: Cyrill Gorcunov<gorcunov@openvz.org>
Acked-by: 's avatarRuslan Kuprieiev <rkuprieiev@cloudlinux.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent d885caf9
...@@ -445,8 +445,15 @@ void *mmap_seized(struct parasite_ctl *ctl, ...@@ -445,8 +445,15 @@ void *mmap_seized(struct parasite_ctl *ctl,
err = syscall_seized(ctl, __NR_mmap, &map, err = syscall_seized(ctl, __NR_mmap, &map,
(unsigned long)addr, length, prot, flags, fd, offset); (unsigned long)addr, length, prot, flags, fd, offset);
if (err < 0 || map > TASK_SIZE) if (err < 0)
map = 0; return NULL;
if (IS_ERR_VALUE(map)) {
if (map == -EACCES && (prot & PROT_WRITE) && (prot & PROT_EXEC))
pr_warn("mmap(PROT_WRITE | PROT_EXEC) failed for %d, "
"check selinux execmem policy\n", ctl->pid.real);
return NULL;
}
return (void *)map; return (void *)map;
} }
......
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