[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 18/19] linux-user: Avoid possible misalignmen
From: |
Laurent Vivier |
Subject: |
Re: [Qemu-devel] [PATCH v2 18/19] linux-user: Avoid possible misalignment in host_to_target_siginfo() |
Date: |
Tue, 7 Jun 2016 21:36:19 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 |
Le 27/05/2016 à 16:52, Peter Maydell a écrit :
> host_to_target_siginfo() is implemented by a combination of
> host_to_target_siginfo_noswap() followed by tswap_siginfo().
> The first of these two functions assumes that the target_siginfo_t
> it is writing to is correctly aligned, but the pointer passed
> into host_to_target_siginfo() is directly from the guest and
> might be misaligned. Use a local variable to avoid this problem.
> (tswap_siginfo() does now correctly handle a misaligned destination.)
You mean the pointer from the guest can not be correctly aligned for the
guest?
Laurent
>
> Signed-off-by: Peter Maydell <address@hidden>
> ---
> linux-user/signal.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/linux-user/signal.c b/linux-user/signal.c
> index 8ea0cbf..7e2a80f 100644
> --- a/linux-user/signal.c
> +++ b/linux-user/signal.c
> @@ -400,8 +400,9 @@ static void tswap_siginfo(target_siginfo_t *tinfo,
>
> void host_to_target_siginfo(target_siginfo_t *tinfo, const siginfo_t *info)
> {
> - host_to_target_siginfo_noswap(tinfo, info);
> - tswap_siginfo(tinfo, tinfo);
> + target_siginfo_t tgt_tmp;
> + host_to_target_siginfo_noswap(&tgt_tmp, info);
> + tswap_siginfo(tinfo, &tgt_tmp);
> }
>
> /* XXX: we support only POSIX RT signals are used. */
>
- Re: [Qemu-devel] [PATCH v2 18/19] linux-user: Avoid possible misalignment in host_to_target_siginfo(),
Laurent Vivier <=