diff options
author | Alexander Graf <agraf@suse.de> | 2014-11-10 21:33:03 +0100 |
---|---|---|
committer | Riku Voipio <riku.voipio@linaro.org> | 2014-11-11 08:13:09 +0200 |
commit | aecc88616a64a4e0a1ae0d6986de0054ea9f37d2 (patch) | |
tree | ff3f27cb5e8e23ae7bc3e146f97f7ccbbd406e1c /linux-user/syscall_defs.h | |
parent | ccf661f827faf700b03a30076b5f944e8f787280 (diff) |
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 e52a99f756e ("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>
Diffstat (limited to 'linux-user/syscall_defs.h')
-rw-r--r-- | linux-user/syscall_defs.h | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index c9e6323905..ebb3be1196 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -2564,10 +2564,7 @@ struct target_ucred { #endif - -struct target_timer_t { - abi_ulong ptr; -}; +typedef int32_t target_timer_t; #define TARGET_SIGEV_MAX_SIZE 64 |