[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 48/51] linux-user: Fix trampoline code for CRIS
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 48/51] linux-user: Fix trampoline code for CRIS |
Date: |
Fri, 21 Feb 2014 02:17:24 -0600 |
From: Stefan Weil <address@hidden>
__put_user can write bytes, words (2 bytes) or longwords (4 bytes).
Here obviously words should have been written, but bytes were written,
so values like 0x9c5f were truncated to 0x5f.
Fix this by changing retcode from uint8_t to to uint16_t in
target_signal_frame and also in the unused rt_signal_frame.
This problem was reported by static code analysis (smatch).
Cc: address@hidden
Signed-off-by: Stefan Weil <address@hidden>
Acked-by: Riku Voipio <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Tested-by: Edgar E. Iglesias <address@hidden>
Reviewed-by: Edgar E. Iglesias <address@hidden>
Signed-off-by: Edgar E. Iglesias <address@hidden>
(cherry picked from commit 8cfc114a2f293c40077d1bdb7500b29db359ca22)
Signed-off-by: Michael Roth <address@hidden>
---
linux-user/signal.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 7751c47..544e77e 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -3653,7 +3653,7 @@ struct target_sigcontext {
struct target_signal_frame {
struct target_sigcontext sc;
uint32_t extramask[TARGET_NSIG_WORDS - 1];
- uint8_t retcode[8]; /* Trampoline code. */
+ uint16_t retcode[4]; /* Trampoline code. */
};
struct rt_signal_frame {
@@ -3661,7 +3661,7 @@ struct rt_signal_frame {
void *puc;
siginfo_t info;
struct ucontext uc;
- uint8_t retcode[8]; /* Trampoline code. */
+ uint16_t retcode[4]; /* Trampoline code. */
};
static void setup_sigcontext(struct target_sigcontext *sc, CPUCRISState *env)
@@ -3739,8 +3739,8 @@ static void setup_frame(int sig, struct target_sigaction
*ka,
*/
err |= __put_user(0x9c5f, frame->retcode+0);
err |= __put_user(TARGET_NR_sigreturn,
- frame->retcode+2);
- err |= __put_user(0xe93d, frame->retcode+4);
+ frame->retcode + 1);
+ err |= __put_user(0xe93d, frame->retcode + 2);
/* Save the mask. */
err |= __put_user(set->sig[0], &frame->sc.oldmask);
--
1.7.9.5
- [Qemu-stable] [PATCH 37/51] seccomp: exit if seccomp_init() fails, (continued)
- [Qemu-stable] [PATCH 37/51] seccomp: exit if seccomp_init() fails, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 39/51] migration: qmp_migrate(): keep working after syntax error, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 40/51] vfio-pci: Release all MSI-X vectors when disabled, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 41/51] block/curl: Implement the libcurl timer callback interface, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 43/51] scsi: Assign cancel_io vector for scsi_disk_emulate_ops, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 42/51] scsi: Support TEST UNIT READY in the dummy LUN0, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 44/51] virtio-scsi: Cleanup of I/Os that never started, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 45/51] virtio-scsi: Prevent assertion on missed events, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 47/51] i386: Add missing include file for QEMU_PACKED, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 46/51] KVM: Retry KVM_CREATE_VM on EINTR, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 48/51] linux-user: Fix trampoline code for CRIS,
Michael Roth <=
- [Qemu-stable] [PATCH 50/51] memory: fix limiting of translation at a page boundary, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 51/51] tcg-arm: The shift count of op_rotl_i32 is in args[2] not args[1]., Michael Roth, 2014/02/21
- Re: [Qemu-stable] Patch Round-up for stable 1.7.1, freeze on 2013-02-27, Paolo Bonzini, 2014/02/21
- Re: [Qemu-stable] Patch Round-up for stable 1.7.1, freeze on 2013-02-27, Legorol, 2014/02/21
- [Qemu-stable] [PATCH 30/51] linux-user: create target_structs header to place ipc_perm and shmid_ds, Michael Roth, 2014/02/21
- [Qemu-stable] [PATCH 49/51] Update OpenBIOS images, Michael Roth, 2014/02/21