Skip to content

Commit

Permalink
linux-user: fix target_to_host_timespec64()
Browse files Browse the repository at this point in the history
in 32 bit mode, drop the padding in tv_nsec. If host is 64bit and target
is 32bit, the padding bytes will be copied from the target and as the
kernel checks the value, the syscall exits with EINVAL.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200827070449.2386007-1-laurent@vivier.eu>
Fixes: c6c8d10 ("linux-user/syscall: Add support for clock_gettime64/clock_settime64")
  • Loading branch information
vivier committed Aug 27, 2020
1 parent dcbcf5c commit 0057675
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions linux-user/syscall.c
Expand Up @@ -1229,6 +1229,8 @@ static inline abi_long target_to_host_timespec64(struct timespec *host_ts,
}
__get_user(host_ts->tv_sec, &target_ts->tv_sec);
__get_user(host_ts->tv_nsec, &target_ts->tv_nsec);
/* in 32bit mode, this drops the padding */
host_ts->tv_nsec = (long)(abi_long)host_ts->tv_nsec;
unlock_user_struct(target_ts, target_addr, 0);
return 0;
}
Expand Down

0 comments on commit 0057675

Please sign in to comment.