[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 18/19] linux-user: Avoid possible misalignment in
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PATCH v2 18/19] linux-user: Avoid possible misalignment in host_to_target_siginfo() |
Date: |
Fri, 27 May 2016 15:52:00 +0100 |
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.)
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. */
--
1.9.1
- [Qemu-devel] [PATCH v2 00/19] linux-user: fix various signal race conditions, Peter Maydell, 2016/05/27
- [Qemu-devel] [PATCH v2 16/19] linux-user: Restart fork() if signals pending, Peter Maydell, 2016/05/27
- [Qemu-devel] [PATCH v2 18/19] linux-user: Avoid possible misalignment in host_to_target_siginfo(),
Peter Maydell <=
- [Qemu-devel] [PATCH v2 14/19] linux-user: Restart exit() if signal pending, Peter Maydell, 2016/05/27
- [Qemu-devel] [PATCH v2 11/19] linux-user: Queue synchronous signals separately, Peter Maydell, 2016/05/27
- [Qemu-devel] [PATCH v2 12/19] linux-user: Block signals during sigaction() handling, Peter Maydell, 2016/05/27
- [Qemu-devel] [PATCH v2 13/19] linux-user: pause() should not pause if signal pending, Peter Maydell, 2016/05/27
- [Qemu-devel] [PATCH v2 03/19] linux-user: Fix stray tab-indent, Peter Maydell, 2016/05/27
- [Qemu-devel] [PATCH v2 09/19] linux-user: Remove redundant gdb_queuesig(), Peter Maydell, 2016/05/27
- [Qemu-devel] [PATCH v2 08/19] linux-user: Remove redundant default action check in queue_signal(), Peter Maydell, 2016/05/27
- [Qemu-devel] [PATCH v2 10/19] linux-user: Remove real-time signal queuing, Peter Maydell, 2016/05/27
- [Qemu-devel] [PATCH v2 06/19] linux-user: Use safe_syscall for sigsuspend syscalls, Peter Maydell, 2016/05/27
- [Qemu-devel] [PATCH v2 05/19] linux-user: Define macro for size of host kernel sigset_t, Peter Maydell, 2016/05/27