[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 13/15] s390x/kvm: legacy_s390_alloc() only supports o
From: |
Cornelia Huck |
Subject: |
[Qemu-devel] [PULL 13/15] s390x/kvm: legacy_s390_alloc() only supports one allocation |
Date: |
Mon, 2 Jul 2018 13:17:35 +0200 |
From: David Hildenbrand <address@hidden>
We always allocate at a fixed address, a second allocation can therefore
of course never work. We would simply overwrite mappings.
This can e.g. happen in s390_memory_init(), if trying to allocate more
than > 8TB. Let's just bail out, as there is no need for supporting it
(legacy handling for z/VM).
Signed-off-by: David Hildenbrand <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Christian Borntraeger <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>
---
target/s390x/kvm.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
index 8bcd832123..a9d6d606df 100644
--- a/target/s390x/kvm.c
+++ b/target/s390x/kvm.c
@@ -752,12 +752,20 @@ int kvm_s390_mem_op(S390CPU *cpu, vaddr addr, uint8_t ar,
void *hostbuf,
*/
static void *legacy_s390_alloc(size_t size, uint64_t *align, bool shared)
{
- void *mem;
+ static void *mem;
+
+ if (mem) {
+ /* we only support one allocation, which is enough for initial ram */
+ return NULL;
+ }
mem = mmap((void *) 0x800000000ULL, size,
PROT_EXEC|PROT_READ|PROT_WRITE,
MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
- return mem == MAP_FAILED ? NULL : mem;
+ if (mem == MAP_FAILED) {
+ mem = NULL;
+ }
+ return mem;
}
static uint8_t const *sw_bp_inst;
--
2.14.4
- [Qemu-devel] [PULL 03/15] s390x/cpumodel: default enable bpb and ppa15 for z196 and later, (continued)
- [Qemu-devel] [PULL 03/15] s390x/cpumodel: default enable bpb and ppa15 for z196 and later, Cornelia Huck, 2018/07/02
- [Qemu-devel] [PULL 04/15] s390x/tcg: avoid overflows in time2tod/tod2time, Cornelia Huck, 2018/07/02
- [Qemu-devel] [PULL 05/15] s390x/kvm: pass values instead of pointers to kvm_s390_set_clock_*(), Cornelia Huck, 2018/07/02
- [Qemu-devel] [PULL 07/15] s390x/tcg: drop tod_basetime, Cornelia Huck, 2018/07/02
- [Qemu-devel] [PULL 08/15] s390x/tcg: properly implement the TOD, Cornelia Huck, 2018/07/02
- [Qemu-devel] [PULL 09/15] s390x/tcg: SET CLOCK COMPARATOR can clear CKC interrupts, Cornelia Huck, 2018/07/02
- [Qemu-devel] [PULL 06/15] s390x/tod: factor out TOD into separate device, Cornelia Huck, 2018/07/02
- [Qemu-devel] [PULL 11/15] s390x/tcg: rearm the CKC timer during migration, Cornelia Huck, 2018/07/02
- [Qemu-devel] [PULL 10/15] s390x/tcg: implement SET CLOCK, Cornelia Huck, 2018/07/02
- [Qemu-devel] [PULL 12/15] s390x/tcg: fix CPU hotplug with single-threaded TCG, Cornelia Huck, 2018/07/02
- [Qemu-devel] [PULL 13/15] s390x/kvm: legacy_s390_alloc() only supports one allocation,
Cornelia Huck <=
- [Qemu-devel] [PULL 14/15] s390x/kvm: indicate alignment in legacy_s390_alloc(), Cornelia Huck, 2018/07/02
- [Qemu-devel] [PULL 15/15] s390x/tcg: fix locking problem with tcg_s390_tod_updated, Cornelia Huck, 2018/07/02
- Re: [Qemu-devel] [PULL 00/15] s390x patches for 3.0, Peter Maydell, 2018/07/02