* [PATCH] qemu/osdep: Remove fallback for MAP_FIXED_NOREPLACE
@ 2023-08-08 16:44 Richard Henderson
2023-08-08 22:16 ` Alex Bennée
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Richard Henderson @ 2023-08-08 16:44 UTC (permalink / raw)
To: qemu-devel; +Cc: Akihiko Odaki
In order for our emulation of MAP_FIXED_NOREPLACE to succeed within
linux-user target_mmap, we require a non-zero value. This does not
require host kernel support, merely the bit being defined.
MAP_FIXED_NOREPLACE was added with glibc 2.28. From repology.org:
Fedora 36: 2.35
CentOS 8 (RHEL-8): 2.28
Debian 11: 2.31
OpenSUSE Leap 15.4: 2.31
Ubuntu LTS 20.04: 2.31
Reported-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
include/qemu/osdep.h | 3 ---
linux-user/elfload.c | 1 -
2 files changed, 4 deletions(-)
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index cc61b00ba9..21ef8f1699 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -289,9 +289,6 @@ void QEMU_ERROR("code path is reachable")
#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
#endif
-#ifndef MAP_FIXED_NOREPLACE
-#define MAP_FIXED_NOREPLACE 0
-#endif
#ifndef MAP_NORESERVE
#define MAP_NORESERVE 0
#endif
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 36e4026f05..9d9c79a653 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2807,7 +2807,6 @@ static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr,
/* Widen the "image" to the entire reserved address space. */
pgb_static(image_name, 0, reserved_va, align);
- /* osdep.h defines this as 0 if it's missing */
flags |= MAP_FIXED_NOREPLACE;
/* Reserve the memory on the host. */
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] qemu/osdep: Remove fallback for MAP_FIXED_NOREPLACE
2023-08-08 16:44 [PATCH] qemu/osdep: Remove fallback for MAP_FIXED_NOREPLACE Richard Henderson
@ 2023-08-08 22:16 ` Alex Bennée
2023-08-09 3:43 ` Akihiko Odaki
2023-08-09 3:50 ` Michael Tokarev
2 siblings, 0 replies; 5+ messages in thread
From: Alex Bennée @ 2023-08-08 22:16 UTC (permalink / raw)
To: Richard Henderson; +Cc: Akihiko Odaki, qemu-devel
Richard Henderson <richard.henderson@linaro.org> writes:
> In order for our emulation of MAP_FIXED_NOREPLACE to succeed within
> linux-user target_mmap, we require a non-zero value. This does not
> require host kernel support, merely the bit being defined.
>
> MAP_FIXED_NOREPLACE was added with glibc 2.28. From repology.org:
>
> Fedora 36: 2.35
> CentOS 8 (RHEL-8): 2.28
> Debian 11: 2.31
> OpenSUSE Leap 15.4: 2.31
> Ubuntu LTS 20.04: 2.31
>
> Reported-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] qemu/osdep: Remove fallback for MAP_FIXED_NOREPLACE
2023-08-08 16:44 [PATCH] qemu/osdep: Remove fallback for MAP_FIXED_NOREPLACE Richard Henderson
2023-08-08 22:16 ` Alex Bennée
@ 2023-08-09 3:43 ` Akihiko Odaki
2023-08-09 3:50 ` Michael Tokarev
2 siblings, 0 replies; 5+ messages in thread
From: Akihiko Odaki @ 2023-08-09 3:43 UTC (permalink / raw)
To: Richard Henderson, qemu-devel
On 2023/08/09 1:44, Richard Henderson wrote:
> In order for our emulation of MAP_FIXED_NOREPLACE to succeed within
> linux-user target_mmap, we require a non-zero value. This does not
> require host kernel support, merely the bit being defined.
>
> MAP_FIXED_NOREPLACE was added with glibc 2.28. From repology.org:
>
> Fedora 36: 2.35
> CentOS 8 (RHEL-8): 2.28
> Debian 11: 2.31
> OpenSUSE Leap 15.4: 2.31
> Ubuntu LTS 20.04: 2.31
>
> Reported-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] qemu/osdep: Remove fallback for MAP_FIXED_NOREPLACE
2023-08-08 16:44 [PATCH] qemu/osdep: Remove fallback for MAP_FIXED_NOREPLACE Richard Henderson
2023-08-08 22:16 ` Alex Bennée
2023-08-09 3:43 ` Akihiko Odaki
@ 2023-08-09 3:50 ` Michael Tokarev
2023-08-09 3:51 ` Richard Henderson
2 siblings, 1 reply; 5+ messages in thread
From: Michael Tokarev @ 2023-08-09 3:50 UTC (permalink / raw)
To: Richard Henderson, qemu-devel; +Cc: Akihiko Odaki
08.08.2023 19:44, Richard Henderson пишет:
> In order for our emulation of MAP_FIXED_NOREPLACE to succeed within
> linux-user target_mmap, we require a non-zero value. This does not
> require host kernel support, merely the bit being defined.
Hm. Should we add something like
assert(MAP_FIXED_NOREPLACE != 0)
somewhere?
/mjt
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] qemu/osdep: Remove fallback for MAP_FIXED_NOREPLACE
2023-08-09 3:50 ` Michael Tokarev
@ 2023-08-09 3:51 ` Richard Henderson
0 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2023-08-09 3:51 UTC (permalink / raw)
To: Michael Tokarev, qemu-devel; +Cc: Akihiko Odaki
On 8/8/23 20:50, Michael Tokarev wrote:
> 08.08.2023 19:44, Richard Henderson пишет:
>> In order for our emulation of MAP_FIXED_NOREPLACE to succeed within
>> linux-user target_mmap, we require a non-zero value. This does not
>> require host kernel support, merely the bit being defined.
>
> Hm. Should we add something like
>
> assert(MAP_FIXED_NOREPLACE != 0)
>
> somewhere?
I wouldn't think so. Where would a zero come from?
r~
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-08-09 3:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-08 16:44 [PATCH] qemu/osdep: Remove fallback for MAP_FIXED_NOREPLACE Richard Henderson
2023-08-08 22:16 ` Alex Bennée
2023-08-09 3:43 ` Akihiko Odaki
2023-08-09 3:50 ` Michael Tokarev
2023-08-09 3:51 ` Richard Henderson
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).