qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Akihiko Odaki <akihiko.odaki@daynix.com>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	pbonzini@redhat.com, philmd@linaro.org, laurent@vivier.eu,
	deller@gmx.de, qemu-devel@nongnu.org
Subject: Re: [PATCH for-8.1] linux-user: Define real MAP_FIXED_NOREPLACE value
Date: Wed, 9 Aug 2023 00:16:51 +0900	[thread overview]
Message-ID: <5e416a73-365e-407d-98fa-3b48be20045d@daynix.com> (raw)
In-Reply-To: <637ce4c6-9ac6-0bb2-aedb-632f79777902@linaro.org>

On 2023/08/08 23:42, Richard Henderson wrote:
> On 8/8/23 04:52, Akihiko Odaki wrote:
>> do_brk() assumes target_mmap() emulates MAP_FIXED_NOREPLACE even when
>> the host does not support it. However, such emulation is not possible
>> if MAP_FIXED_NOREPLACE is defined as zero.
>>
>> Define MAP_FIXED_NOREPLACE with the real value instead of zero if it is
>> not defined.
>>
>> Fixes: e69e032d1a ("linux-user: Use MAP_FIXED_NOREPLACE for do_brk()")
>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>> ---
>>   include/qemu/osdep.h | 8 ++++++--
>>   linux-user/elfload.c | 1 -
>>   2 files changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
>> index cc61b00ba9..1aac17ec2f 100644
>> --- a/include/qemu/osdep.h
>> +++ b/include/qemu/osdep.h
>> @@ -289,8 +289,12 @@ 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
>> +#if defined(__linux__) && !defined(MAP_FIXED_NOREPLACE)
>> +#if HOST_ALPHA
> 
> HOST_ALPHA is not a thing.  Also, see
> 
> https://lore.kernel.org/qemu-devel/20230808120303.585509-3-pbonzini@redhat.com/
> 
> where host support for Alpha is completely removed.

I sent v2 with the condition HOST_ALPHA replaced with
MAP_HUGETLB == 0x100000.

While Alpha is no longer supported, and linux-user will not work on 
Alpha, code outside linux-user also refers to osdep.h and the build 
script does not actively block building QEMU on an unsupported host so I 
left the definition for Alpha just in case.

> 
> 
>> +#define MAP_FIXED_NOREPLACE 0x200000
>> +#else
>> +#define MAP_FIXED_NOREPLACE 0x100000
>> +#endif
> 
> Which supported hosts do not define this value?  Can we simply remove 
> the fallback?

glibc didn't have this defined until 2.28. The older releases still 
maintained are 2.26, and 2.27, according to:
https://sourceware.org/glibc/wiki/Release

The page says ALT Linux p9 and Ubuntu 18.04 LTS (Bionic Beaver) has 
glibc 2.27.

> 
> 
> r~


  reply	other threads:[~2023-08-08 15:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-08 11:52 [PATCH for-8.1] linux-user: Define real MAP_FIXED_NOREPLACE value Akihiko Odaki
2023-08-08 14:42 ` Richard Henderson
2023-08-08 15:16   ` Akihiko Odaki [this message]
2023-08-08 16:19     ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5e416a73-365e-407d-98fa-3b48be20045d@daynix.com \
    --to=akihiko.odaki@daynix.com \
    --cc=alex.bennee@linaro.org \
    --cc=deller@gmx.de \
    --cc=laurent@vivier.eu \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).