Re: [PATCH 3/6] y2038: linux: Provide __clock_settime64 implementation

From: Stepan Golosunov
Date: Fri Apr 19 2019 - 20:31:13 EST


15.04.2019 в 00:08:38 +0200 Lukasz Majewski написал:
> +# if defined __NR_clock_settime64
> + /* Make sure that passed __timespec64 struct pad is 0. */
> + struct __timespec64 ts = *tp;
> + ts.tv_pad = 0;
> + return INLINE_SYSCALL_CALL (clock_settime64, clock_id, &ts);

Isn't kernel supposed to zero out padding on its own?
At least comment in kernel's get_timespec64 says so:

/* Zero out the padding for 32 bit systems or in compat mode */
if (IS_ENABLED(CONFIG_64BIT_TIME) && in_compat_syscall())
kts.tv_nsec &= 0xFFFFFFFFUL;

The code looks buggy though. It fails to zero out the padding in
32-bit kernels. That part is probably broken since
98f76206b3350 ("compat: Cleanup in_compat_syscall() callers").

And, hmm, is CONFIG_64BIT_TIME enabled anywhere?