time: Zero the upper 32-bits in __kernel_timespec on 32-bit
authorDmitry Safonov <dima@arista.com>
Thu, 21 Nov 2019 00:03:03 +0000 (00:03 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Dec 2019 07:48:18 +0000 (08:48 +0100)
commitbf4c4d71b74e2d85985a304d4df1dee8450df05f
treed778d3c03831208b4161b79303ad1b6e119a5d29
parentd91eb29a24cc7a3c790b8d82b8010712e9460900
time: Zero the upper 32-bits in __kernel_timespec on 32-bit

commit 7b8474466ed97be458c825f34a85f2c2b84c3f95 upstream.

On compat interfaces, the high order bits of nanoseconds should be zeroed
out. This is because the application code or the libc do not guarantee
zeroing of these. If used without zeroing, kernel might be at risk of using
timespec values incorrectly.

Originally it was handled correctly, but lost during is_compat_syscall()
cleanup. Revert the condition back to check CONFIG_64BIT.

Fixes: 98f76206b335 ("compat: Cleanup in_compat_syscall() callers")
Reported-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Dmitry Safonov <dima@arista.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20191121000303.126523-1-dima@arista.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/time/time.c