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 e52a99f7 ("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: NTom Musta <tommusta@gmail.com> Signed-off-by: NAlexander Graf <agraf@suse.de> Reviewed-by: NPeter Maydell <peter.maydell@linaro.org> Reviewed-by: NTom Musta <tommusta@gmail.com> Tested-by: NTom Musta <tommusta@gmail.com> Signed-off-by: NRiku Voipio <riku.voipio@linaro.org>
Showing
想要评论请 注册 或 登录