[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 1/6] linux-user: Unset MAP_FIXED_NOREPLACE for host
From: |
Akihiko Odaki |
Subject: |
[PATCH v2 1/6] linux-user: Unset MAP_FIXED_NOREPLACE for host |
Date: |
Wed, 2 Aug 2023 16:17:47 +0900 |
Passing MAP_FIXED_NOREPLACE to host will fail if the virtual
address space is reserved with mmap. Replace it with MAP_FIXED in such
a case.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
linux-user/mmap.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index a5dfb56545..14cd1b9feb 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -610,6 +610,10 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int
target_prot,
goto fail;
}
+ if (reserved_va) {
+ flags = (flags & ~MAP_FIXED_NOREPLACE) | MAP_FIXED;
+ }
+
/*
* worst case: we cannot map the file because the offset is not
* aligned, so we read it
--
2.41.0
- [PATCH v2 0/6] linux-user: brk/mmap fixes, Akihiko Odaki, 2023/08/02
- [PATCH v2 1/6] linux-user: Unset MAP_FIXED_NOREPLACE for host,
Akihiko Odaki <=
- [PATCH v2 2/6] linux-user: Fix MAP_FIXED_NOREPLACE on old kernels, Akihiko Odaki, 2023/08/02
- [PATCH v2 4/6] linux-user: Use MAP_FIXED_NOREPLACE for do_brk(), Akihiko Odaki, 2023/08/02
- [PATCH v2 3/6] linux-user: Do not call get_errno() in do_brk(), Akihiko Odaki, 2023/08/02
- [PATCH v2 5/6] linux-user: Do nothing if too small brk is specified, Akihiko Odaki, 2023/08/02
- [PATCH v2 6/6] linux-user: Do not align brk with host page size, Akihiko Odaki, 2023/08/02