qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org, Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Subject: [Qemu-devel] [PATCH] target/s390x/kvm: Fix problem when running with SELinux under z/VM
Date: Fri, 24 Mar 2017 10:26:55 +0100	[thread overview]
Message-ID: <1490347615-19222-1-git-send-email-thuth@redhat.com> (raw)

When running QEMU with KVM under z/VM, the memory for the guest
is allocated via legacy_s390_alloc() since the KVM_CAP_S390_COW
extension is not supported on z/VM. legacy_s390_alloc() then uses
mmap(... PROT_EXEC ...) for the guest memory - but this does not
work when running with SELinux enabled, mmap() fails and QEMU aborts
with the following error message:

 cannot set up guest memory 's390.ram': Permission denied

Looking at the other allocator function qemu_anon_ram_alloc(), it
seems like PROT_EXEC is normally not needed for allocating the
guest RAM, and indeed, the guest also starts successfully under
z/VM when we remove the PROT_EXEC from the legacy_s390_alloc()
function. So let's get rid of that flag here to be able to run
with SELinux under z/VM, too.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 target/s390x/kvm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
index ac47154..5167436 100644
--- a/target/s390x/kvm.c
+++ b/target/s390x/kvm.c
@@ -678,8 +678,7 @@ static void *legacy_s390_alloc(size_t size, uint64_t *align)
 {
     void *mem;
 
-    mem = mmap((void *) 0x800000000ULL, size,
-               PROT_EXEC|PROT_READ|PROT_WRITE,
+    mem = mmap((void *) 0x800000000ULL, size, PROT_READ | PROT_WRITE,
                MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
     return mem == MAP_FAILED ? NULL : mem;
 }
-- 
1.8.3.1

             reply	other threads:[~2017-03-24  9:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-24  9:26 Thomas Huth [this message]
2017-03-24  9:38 ` [Qemu-devel] [PATCH] target/s390x/kvm: Fix problem when running with SELinux under z/VM Cornelia Huck
2017-03-24  9:53   ` Thomas Huth
2017-03-24  9:39 ` Christian Borntraeger
2017-03-24 10:00   ` Thomas Huth
2017-03-29 14:21   ` Thomas Huth
2017-03-29 14:25     ` Christian Borntraeger
2017-09-15 14:36       ` Thomas Huth
2017-09-18  7:43         ` Christian Borntraeger
2017-09-19 12:38           ` David Hildenbrand
2017-09-19 12:48             ` Thomas Huth
2017-09-19 13:03               ` David Hildenbrand
2017-09-19 13:12                 ` Thomas Huth
2017-09-19 13:14                   ` David Hildenbrand
2017-09-19 13:15                 ` Christian Borntraeger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1490347615-19222-1-git-send-email-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).