When timespec stucture pointer points outside the accessible address space (i.e. it's an invalid pointer), the clock_gettime() syscall should return with -1 and set the errno to EFAULT. This wasn't the case, since there was no check if the host_to_target_timespec() failed. This check was added and now the syscall behaves appropriately in this situation.
Signed-off-by: Dejan Jovicevic <dejan.jovice...@rt-rk.com> --- linux-user/syscall.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 03339ba..e6abfc5 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -11247,7 +11247,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, struct timespec ts; ret = get_errno(clock_gettime(arg1, &ts)); if (!is_error(ret)) { - host_to_target_timespec(arg2, &ts); + if (host_to_target_timespec(arg2, &ts)) { + goto efault; + } } break; } -- 1.9.1