qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Riku Voipio <riku.voipio@iki.fi>
To: Richard Henderson <rth@twiddle.net>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 4/6] alpha-linux-user: Fix sigaction
Date: Thu, 11 Oct 2012 15:51:19 +0300	[thread overview]
Message-ID: <20121011125119.GA24956@afflict.kos.to> (raw)
In-Reply-To: <1348237034-15851-5-git-send-email-rth@twiddle.net>

Hi,

This patch doesn't compile for me on ubuntu 12.04 x86_64 host:

  CC    linux-user/signal.o 
/home/voipio/test/qemu/linux-user/signal.c: In function ‘do_sigaction’:
/home/voipio/test/qemu/linux-user/signal.c:620:9: error: passing
argument 1 of ‘memcpy’ discards ‘const’ qualifier from pointer target
type [-Werror]
/usr/include/x86_64-linux-gnu/bits/string3.h:49:1: note: expected ‘void
* __restrict__’ but argument is of type ‘const long unsigned int *’
/home/voipio/test/qemu/linux-user/signal.c:620:9: error: assignment of
read-only variable ‘gu_’
/home/voipio/test/qemu/linux-user/signal.c:620:9: error: assignment of
read-only variable ‘gu_’
/home/voipio/test/qemu/linux-user/signal.c:620:9: error: assignment of
read-only variable ‘gu_’
/home/voipio/test/qemu/linux-user/signal.c:621:9: error: passing
argument 1 of ‘memcpy’ discards ‘const’ qualifier from pointer target
type [-Werror]
/usr/include/x86_64-linux-gnu/bits/string3.h:49:1: note: expected ‘void
* __restrict__’ but argument is of type ‘const long unsigned int *’
/home/voipio/test/qemu/linux-user/signal.c:621:9: error: assignment of
read-only variable ‘gu_’
/home/voipio/test/qemu/linux-user/signal.c:621:9: error: assignment of
read-only variable ‘gu_’
/home/voipio/test/qemu/linux-user/signal.c:621:9: error: assignment of
read-only variable ‘gu_’
/home/voipio/test/qemu/linux-user/signal.c:623:9: error: passing
argument 1 of ‘memcpy’ discards ‘const’ qualifier from pointer target
type [-Werror]
/usr/include/x86_64-linux-gnu/bits/string3.h:49:1: note: expected ‘void
* __restrict__’ but argument is of type ‘const long unsigned int *’
/home/voipio/test/qemu/linux-user/signal.c:623:9: error: assignment of
read-only variable ‘gu_’
/home/voipio/test/qemu/linux-user/signal.c:623:9: error: assignment of
read-only variable ‘gu_’
/home/voipio/test/qemu/linux-user/signal.c:623:9: error: assignment of
read-only variable ‘gu_’
cc1: all warnings being treated as errors
make: *** [linux-user/signal.o] Error 1


On Fri, Sep 21, 2012 at 07:17:12AM -0700, Richard Henderson wrote:
> Unconditional bswap replaced by __get_user/__put_user.
> 
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  linux-user/signal.c       | 22 ++++++++--------------
>  linux-user/syscall_defs.h |  2 +-
>  2 files changed, 9 insertions(+), 15 deletions(-)
> 
> diff --git a/linux-user/signal.c b/linux-user/signal.c
> index 7869147..bf2dfb8 100644
> --- a/linux-user/signal.c
> +++ b/linux-user/signal.c
> @@ -586,28 +586,22 @@ int do_sigaction(int sig, const struct target_sigaction *act,
>              sig, act, oact);
>  #endif
>      if (oact) {
> -        oact->_sa_handler = tswapal(k->_sa_handler);
> -#if defined(TARGET_MIPS) || defined (TARGET_ALPHA)
> -        oact->sa_flags = bswap32(k->sa_flags);
> -#else
> -        oact->sa_flags = tswapal(k->sa_flags);
> -#endif
> +        __put_user(k->_sa_handler, &oact->_sa_handler);
> +        __put_user(k->sa_flags, &oact->sa_flags);
>  #if !defined(TARGET_MIPS)
> -        oact->sa_restorer = tswapal(k->sa_restorer);
> +        __put_user(k->sa_restorer, &oact->sa_restorer);
>  #endif
> +        /* Not swapped.  */
>          oact->sa_mask = k->sa_mask;
>      }
>      if (act) {
>          /* FIXME: This is not threadsafe.  */
> -        k->_sa_handler = tswapal(act->_sa_handler);
> -#if defined(TARGET_MIPS) || defined (TARGET_ALPHA)
> -        k->sa_flags = bswap32(act->sa_flags);
> -#else
> -        k->sa_flags = tswapal(act->sa_flags);
> -#endif
> +        __get_user(k->_sa_handler, &act->_sa_handler);
> +        __get_user(k->sa_flags, &act->sa_flags);
>  #if !defined(TARGET_MIPS)
> -        k->sa_restorer = tswapal(act->sa_restorer);
> +        __get_user(k->sa_restorer, &act->sa_restorer);
>  #endif
> +        /* To be swapped in target_to_host_sigset.  */
>          k->sa_mask = act->sa_mask;
>  
>          /* we update the host linux signal state */
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index a98cbf7..8ca70b9 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -540,7 +540,7 @@ int do_sigaction(int sig, const struct target_sigaction *act,
>  struct target_old_sigaction {
>      abi_ulong _sa_handler;
>      abi_ulong sa_mask;
> -    abi_ulong sa_flags;
> +    int32_t sa_flags;
>  };
>  
>  struct target_rt_sigaction {
> -- 
> 1.7.11.4

  reply	other threads:[~2012-10-11 12:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-21 14:17 [Qemu-devel] [PATCH v2 0/6] linux-user improvements Richard Henderson
2012-09-21 14:17 ` [Qemu-devel] [PATCH 1/6] linux-user: Perform more checks on iovec lists Richard Henderson
2012-09-21 14:17 ` [Qemu-devel] [PATCH 2/6] linux-user: Implement gethostname Richard Henderson
2012-09-21 14:17 ` [Qemu-devel] [PATCH 3/6] alpha-linux-user: Fix sigaltstack structure definition Richard Henderson
2012-09-21 14:17 ` [Qemu-devel] [PATCH 4/6] alpha-linux-user: Fix sigaction Richard Henderson
2012-10-11 12:51   ` Riku Voipio [this message]
2012-09-21 14:17 ` [Qemu-devel] [PATCH 5/6] target-alpha: Fix cpu_alpha_init Richard Henderson
2012-09-21 14:17 ` [Qemu-devel] [PATCH 6/6] linux-user: Fix siginfo handling Richard Henderson
2012-09-21 14:54 ` [Qemu-devel] [PATCH v2 0/6] linux-user improvements Andreas Färber
2012-09-21 17:16   ` Richard Henderson
  -- strict thread matches above, loose matches on Subject: below --
2012-09-15 20:24 [Qemu-devel] [PATCH " Richard Henderson
2012-09-15 20:24 ` [Qemu-devel] [PATCH 4/6] alpha-linux-user: Fix sigaction Richard Henderson
2012-09-16 12:58   ` Andreas Färber
2012-09-16 13:21     ` Peter Maydell
2012-09-16 16:54     ` 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=20121011125119.GA24956@afflict.kos.to \
    --to=riku.voipio@iki.fi \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).