lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191121000303.126523-1-dima@arista.com>
Date:   Thu, 21 Nov 2019 00:03:03 +0000
From:   Dmitry Safonov <dima@...sta.com>
To:     linux-kernel@...r.kernel.org
Cc:     Dmitry Safonov <0x7f454c46@...il.com>,
        Dmitry Safonov <dima@...sta.com>,
        Ben Hutchings <ben.hutchings@...ethink.co.uk>,
        Arnd Bergmann <arnd@...db.de>,
        John Stultz <john.stultz@...aro.org>,
        Stephen Boyd <sboyd@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>, y2038@...ts.linaro.org,
        stable@...r.kernel.org
Subject: [PATCH] time: Zerofy padding in __kernel_timespec on 32-bit

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.

Reported-by: Ben Hutchings <ben.hutchings@...ethink.co.uk>
Fixes: 98f76206b335 ("compat: Cleanup in_compat_syscall() callers")
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Ben Hutchings <ben.hutchings@...ethink.co.uk>
Cc: John Stultz <john.stultz@...aro.org>
Cc: Stephen Boyd <sboyd@...nel.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: y2038@...ts.linaro.org
Cc: stable@...r.kernel.org # v4.20+
Signed-off-by: Dmitry Safonov <dima@...sta.com>
---
 kernel/time/time.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/time.c b/kernel/time/time.c
index 5c54ca632d08..1cb045c5c97e 100644
--- a/kernel/time/time.c
+++ b/kernel/time/time.c
@@ -881,7 +881,7 @@ int get_timespec64(struct timespec64 *ts,
 	ts->tv_sec = kts.tv_sec;
 
 	/* Zero out the padding for 32 bit systems or in compat mode */
-	if (IS_ENABLED(CONFIG_64BIT_TIME) && in_compat_syscall())
+	if (IS_ENABLED(CONFIG_64BIT_TIME) && (!IS_ENABLED(CONFIG_64BIT) || in_compat_syscall()))
 		kts.tv_nsec &= 0xFFFFFFFFUL;
 
 	ts->tv_nsec = kts.tv_nsec;
-- 
2.24.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ