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

Stepan Golosunov stepan@golosunov.pp.ru
Sat Apr 20 11:21:00 GMT 2019


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?



More information about the Libc-alpha mailing list