]> code.ossystems Code Review - openembedded-core.git/commitdiff
qemu: Refresh mmap fixes patch status/content
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 16 Feb 2021 19:04:42 +0000 (19:04 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 17 Feb 2021 11:01:14 +0000 (11:01 +0000)
One mmap patch was merged upstream, the other is in progress but after
discussion has been amended and resent. Update the patches as such.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-devtools/qemu/qemu/mmap.patch
meta/recipes-devtools/qemu/qemu/mmap2.patch

index 0f7d2ce04c22948f0e63a7fa3fd776d8656eb3a5..edd9734f30a71c05d2bdb523541dac5f167b7649 100644 (file)
@@ -9,7 +9,7 @@ avoid asserting binaries when reserved_va is set.
 This meant a test case now gives the same behaviour regardless of whether
 reserved_va is set or not.
 
-Upstream-Status: Pending
+Upstream-Status: Backport [https://github.com/qemu/qemu/commit/ccc5ccc17f8cfbfd87d9aede5d12a2d47c56e712]
 Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org
 
 Index: qemu-5.2.0/linux-user/mmap.c
index 9d40565938f7f910166b3efef6afd892c2615411..1652131757bc3718dc375a59864a733ef6c72ede 100644 (file)
@@ -6,21 +6,35 @@ if it only sees ENOMEM and only exits when it hits EFAULT.
 
 According to the docs, trying to mremap outside the address space
 can/should return EFAULT and changing this allows the build to succeed.
-Whether this should be fixed in qemu and/or musl, not sure.
 
-Upstream-Status: Pending
+A better return value for the other cases of invalid addresses is EINVAL
+rather than ENOMEM so adjust the other part of the test to this.
+
+Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2021-01/msg01355.html]
 Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org
 
 Index: qemu-5.2.0/linux-user/mmap.c
 ===================================================================
 --- qemu-5.2.0.orig/linux-user/mmap.c
 +++ qemu-5.2.0/linux-user/mmap.c
-@@ -727,7 +727,7 @@ abi_long target_mremap(abi_ulong old_add
-          !guest_range_valid(new_addr, new_size)) ||
-         ((flags & MREMAP_MAYMOVE) == 0 &&
-          !guest_range_valid(old_addr, new_size))) {
+@@ -722,12 +722,14 @@ abi_long target_mremap(abi_ulong old_add
+     int prot;
+     void *host_addr;
+-    if (!guest_range_valid(old_addr, old_size) ||
+-        ((flags & MREMAP_FIXED) &&
+-         !guest_range_valid(new_addr, new_size)) ||
+-        ((flags & MREMAP_MAYMOVE) == 0 &&
+-         !guest_range_valid(old_addr, new_size))) {
 -        errno = ENOMEM;
++    if (!guest_range_valid(old_addr, old_size)) {
 +        errno = EFAULT;
++        return -1;
++    }
++
++    if (((flags & MREMAP_FIXED) && !guest_range_valid(new_addr, new_size)) ||
++        ((flags & MREMAP_MAYMOVE) == 0 && !guest_range_valid(old_addr, new_size))) {
++        errno = EINVAL;
          return -1;
      }