[4/5] x86/compel/infect: Be verbose on remote mmap failure

Submitted by Dmitry Safonov on May 2, 2019, 1:34 a.m.

Details

Message ID 20190502013445.528-5-dima@arista.com
State Accepted
Series "ia32/zdtm: A couple of 32bit fixes"
Commit 4aa952102b30d0df5e5d9e2f42951d9874afb5ea
Headers show

Commit Message

Dmitry Safonov May 2, 2019, 1:34 a.m.
Error-case print missing.

Signed-off-by: Dmitry Safonov <dima@arista.com>
---
 compel/arch/x86/src/lib/infect.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/compel/arch/x86/src/lib/infect.c b/compel/arch/x86/src/lib/infect.c
index 0737e07a3d27..11e7f4c91f4a 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;
 	}