All of lore.kernel.org
 help / color / mirror / Atom feed
From: Riku Voipio <riku.voipio@iki.fi>
To: Felix Janda <felix.janda@posteo.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] linux-user: use libc wrapper instead of direct mremap syscall
Date: Fri, 7 Oct 2016 12:21:43 +0000	[thread overview]
Message-ID: <20161007122143.GC28620@kos.to> (raw)
In-Reply-To: <20160930233927.GA5887@nyan>

On Fri, Sep 30, 2016 at 07:39:27PM -0400, Felix Janda wrote:
> This commit essentially reverts commit
> 3af72a4d98dca033492102603734cbc63cd2694a, which has replaced
> five-argument calls to mremap() by direct mremap syscalls for
> compatibility with glibc older than version 2.4.
> 
> The direct syscall was buggy for 64bit targets on 32bit hosts
> because of the default integer type promotions. Since glibc-2.4
> is now a decade old, we can remove this workaround.

Applied this and the <poll.h> patch to linux-user

Thanks,
Riku
 
> Signed-off-by: Felix Janda <felix.janda@posteo.de>
> ---
>  linux-user/mmap.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/linux-user/mmap.c b/linux-user/mmap.c
> index c4371d9..ffd099d 100644
> --- a/linux-user/mmap.c
> +++ b/linux-user/mmap.c
> @@ -17,8 +17,6 @@
>   *  along with this program; if not, see <http://www.gnu.org/licenses/>.
>   */
>  #include "qemu/osdep.h"
> -#include <linux/mman.h>
> -#include <linux/unistd.h>
>  
>  #include "qemu.h"
>  #include "qemu-common.h"
> @@ -681,10 +679,8 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
>      mmap_lock();
>  
>      if (flags & MREMAP_FIXED) {
> -        host_addr = (void *) syscall(__NR_mremap, g2h(old_addr),
> -                                     old_size, new_size,
> -                                     flags,
> -                                     g2h(new_addr));
> +        host_addr = mremap(g2h(old_addr), old_size, new_size,
> +                           flags, g2h(new_addr));
>  
>          if (reserved_va && host_addr != MAP_FAILED) {
>              /* If new and old addresses overlap then the above mremap will
> @@ -700,10 +696,8 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
>              errno = ENOMEM;
>              host_addr = MAP_FAILED;
>          } else {
> -            host_addr = (void *) syscall(__NR_mremap, g2h(old_addr),
> -                                         old_size, new_size,
> -                                         flags | MREMAP_FIXED,
> -                                         g2h(mmap_start));
> +            host_addr = mremap(g2h(old_addr), old_size, new_size,
> +                               flags | MREMAP_FIXED, g2h(mmap_start));
>              if (reserved_va) {
>                  mmap_reserve(old_addr, old_size);
>              }
> -- 
> 2.7.3
> 
> 

      parent reply	other threads:[~2016-10-07 12:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-30 23:39 [Qemu-devel] [PATCH] linux-user: use libc wrapper instead of direct mremap syscall Felix Janda
2016-10-01  2:35 ` Peter Maydell
2016-10-07 12:19   ` Riku Voipio
2016-10-07 12:21 ` Riku Voipio [this message]

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=20161007122143.GC28620@kos.to \
    --to=riku.voipio@iki.fi \
    --cc=felix.janda@posteo.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.