From 0e22e245e5429a906efa72e0555600b6488c68dc Mon Sep 17 00:00:00 2001 From: Dmitry Safonov Date: Thu, 2 May 2019 02:34:44 +0100 Subject: [PATCH] x86/compel/infect: Be verbose on remote mmap failure Error-case print missing. Signed-off-by: Dmitry Safonov Signed-off-by: Andrei Vagin --- compel/arch/x86/src/lib/infect.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/compel/arch/x86/src/lib/infect.c b/compel/arch/x86/src/lib/infect.c index 0737e07a3..11e7f4c91 100644 --- a/compel/arch/x86/src/lib/infect.c +++ b/compel/arch/x86/src/lib/infect.c @@ -375,10 +375,13 @@ void *remote_mmap(struct parasite_ctl *ctl, if (err < 0) return NULL; + 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->rpid); + 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->rpid); + pr_err("remote mmap() failed: %s\n", strerror(-map)); return NULL; }