qemu-e2k/linux-user
Alexander Graf aecc88616a linux-user: Fix up timer id handling
When creating a timer handle, we give the timer id a special magic offset
of 0xcafe0000. However, we never mask that offset out of the timer id before
we start using it to dereference our timer array. So we always end up aborting
timer operations because the timer id is out of bounds.

This was not an issue before my patch e52a99f756 ("linux-user: Simplify
timerid checks on g_posix_timers range") because before we would blindly mask
anything above the first 16 bits.

This patch simplifies the code around timer id creation by introducing a proper
target_timer_id typedef that is s32, just like Linux has it. It also changes the
magic offset to a value that makes all timer ids be positive.

Reported-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Tom Musta <tommusta@gmail.com>
Tested-by: Tom Musta <tommusta@gmail.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2014-11-11 08:13:09 +02:00
..
aarch64 linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
alpha linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
arm linux-user: Enable epoll_pwait syscall for ARM 2014-10-06 21:52:45 +03:00
cris linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
i386 linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
m68k linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
microblaze linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
mips linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
mips64 linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
openrisc linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
ppc linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
s390x linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
sh4 linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
sparc linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
sparc64 linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
unicore32 linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
x86_64 linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
Makefile.objs linux-user: rename cpu-uname -> uname 2014-05-02 21:59:36 +03:00
elfload.c linux-user: Do not subtract offset from end address 2014-11-11 08:12:45 +02:00
errno_defs.h Remove unnecessary trailing newlines 2008-12-13 09:32:43 +00:00
flat.h Support for 32 bit ABI on 64 bit targets (only enabled Sparc64) 2007-10-14 16:27:31 +00:00
flatload.c linux-user: Remove regs parameter of load_elf_binary and load_flt_binary 2014-01-10 08:51:37 +02:00
ioctls.h linux-user: Convert blkpg to use a special subop handler 2014-10-06 21:52:45 +03:00
linux_loop.h Fix build failure with old kernel headers (loop.h is incompatible with 2008-05-23 16:06:43 +00:00
linuxload.c cpu: Move opaque field from CPU_COMMON to CPUState 2014-03-13 19:20:47 +01:00
m68k-sim.c exec: Change cpu_abort() argument to CPUState 2014-03-13 19:52:28 +01:00
main.c linux-user: Fix fault address truncation AArch64 2014-11-03 11:03:34 +02:00
mmap.c configure: Make NPTL non-optional 2013-07-22 21:54:52 +03:00
qemu.h linux-user: fix gcc-4.9 compiler error on __{get,put]}_user 2014-06-17 08:52:08 +03:00
signal.c linux-user: Handle PPC64 ELFv2 Function Pointers 2014-09-08 12:50:46 +02:00
socket.h linux-user: support SO_PASSSEC setsockopt option 2014-06-29 14:19:59 +03:00
strace.c linux-user: Don't omit comma for strace of rt_sigaction() 2013-04-05 14:40:54 +02:00
strace.list linux-user: add setns and unshare 2014-08-22 15:06:34 +03:00
syscall.c linux-user: Fix up timer id handling 2014-11-11 08:13:09 +02:00
syscall_defs.h linux-user: Fix up timer id handling 2014-11-11 08:13:09 +02:00
syscall_types.h linux-user: Convert blkpg to use a special subop handler 2014-10-06 21:52:45 +03:00
target_flat.h linux-user/FLAT: allow targets to override FLAT processing 2011-02-09 10:33:54 +02:00
uaccess.c Fix missing strnlen problems 2009-07-01 18:24:44 +00:00
uname.c linux-user/uname: Return correct uname string for x86_64 2014-06-17 09:21:40 +03:00
uname.h linux-user: move uname functions to uname.c 2014-05-02 21:59:36 +03:00
vm86.c cpu: Move opaque field from CPU_COMMON to CPUState 2014-03-13 19:20:47 +01:00