On 7/3/23 11:51, Alex Bennée wrote:
@@ -544,7 +544,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int 
target_prot,
          }
      }
- if (!(flags & MAP_FIXED)) {
+    if (!(flags & (MAP_FIXED | MAP_FIXED_NOREPLACE))) {
          unsigned long host_start;
          void *p;
...
@@ -608,7 +615,8 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int 
target_prot,
                  goto fail;
              }
              retaddr = target_mmap(start, len, target_prot | PROT_WRITE,
-                                  MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS,
+                                  (flags & (MAP_FIXED | MAP_FIXED_NOREPLACE))
+                                  | MAP_PRIVATE | MAP_ANONYMOUS,

I thought we always MAP_FIXED because we've already jumped the hoops to
work out where in the memory space this allocation is going.

We have not, no.  Not here, anyway.

IOW I thought the MAP_FIXED here was an internal QEMU implementation
details rather than reflecting the guests wishes.

As I read it, MAP_FIXED was here because we'd already checked for it in the IF that I retained above. But now we're checking for 2 things, and must pass that on to the recursion.


r~

Reply via email to