qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: peter.maydell@linaro.org, Paolo Bonzini <pbonzini@redhat.com>,
	jtomko@redhat.com, qemu-devel@nongnu.org, jingqi.liu@intel.com
Subject: Re: [PATCH 2/2] mmap-alloc: Include osdep.h before checking CONFIG_LINUX
Date: Wed, 11 Mar 2020 19:06:39 -0400	[thread overview]
Message-ID: <20200311190618-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20200311225130.1599619-3-ehabkost@redhat.com>

On Wed, Mar 11, 2020 at 06:51:30PM -0400, Eduardo Habkost wrote:
> The CONFIG_LINUX check at the top of mmap-alloc.c never worked
> because it was done before including osdep.h.
> 
> This means MAP_SYNC and MAP_SHARED_VALIDATE would always be set
> to 0 at the beginning of the file.  Luckily, this didn't break
> when using recent glibc versions (2.28+), because those macros
> were redefined by glibc headers.
> 
> Move the CONFIG_LINUX check after the main include lines, so the
> CONFIG_LINUX check works and we actually include <linux/mman.h>.
> This will make MAP_SYNC and MAP_SHARED_VALIDATE available even if
> the host has an older glibc version.
> 
> Reported-by: Jingqi Liu <jingqi.liu@intel.com>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Makes sense, and I guess we should CC stable on this?

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  util/mmap-alloc.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c
> index 27dcccd8ec..7c2ce98eb0 100644
> --- a/util/mmap-alloc.c
> +++ b/util/mmap-alloc.c
> @@ -9,6 +9,9 @@
>   * This work is licensed under the terms of the GNU GPL, version 2 or
>   * later.  See the COPYING file in the top-level directory.
>   */
> +#include "qemu/osdep.h"
> +#include "qemu/mmap-alloc.h"
> +#include "qemu/host-utils.h"
>  
>  #ifdef CONFIG_LINUX
>  #include <linux/mman.h>
> @@ -17,10 +20,6 @@
>  #define MAP_SHARED_VALIDATE   0x0
>  #endif /* CONFIG_LINUX */
>  
> -#include "qemu/osdep.h"
> -#include "qemu/mmap-alloc.h"
> -#include "qemu/host-utils.h"
> -
>  #define HUGETLBFS_MAGIC       0x958458f6
>  
>  #ifdef CONFIG_LINUX
> -- 
> 2.24.1



  reply	other threads:[~2020-03-11 23:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-11 22:51 [PATCH 0/2] Fix MAP_SYNC support when host has older glibc version Eduardo Habkost
2020-03-11 22:51 ` [PATCH 1/2] Use -isystem for linux-headers dir Eduardo Habkost
2020-03-11 23:05   ` Michael S. Tsirkin
2020-03-11 23:08     ` Eduardo Habkost
2020-03-11 23:15       ` Eduardo Habkost
2020-03-12  5:28       ` Michael S. Tsirkin
2020-03-11 22:51 ` [PATCH 2/2] mmap-alloc: Include osdep.h before checking CONFIG_LINUX Eduardo Habkost
2020-03-11 23:06   ` Michael S. Tsirkin [this message]
2020-03-11 23:40 ` [PATCH 0/2] Fix MAP_SYNC support when host has older glibc version no-reply

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=20200311190618-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=jingqi.liu@intel.com \
    --cc=jtomko@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.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).