From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D8A7480947; Tue, 7 Jul 2026 21:54:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783461293; cv=none; b=NR4DlxkRbkjEPfC5sOkzamC3TI7Rt80b9xBbZcQzbYkrooHmHEVAc95zjikoHjEnnj4HUnuHkeP6me/ZZ1C+Pr0w5WDSTicPeCu/PdnE4+c5pMh4jj1vpm+tNaNxDMzN6DZPOtkrT1c5od/iRRpGoqesWxkvbwm1YIwnXrqOCSc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783461293; c=relaxed/simple; bh=WERFzXINuUqGAGNk4gVzR5shrOsyznt1yCnXVs1AN0Y=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=MrwyQz7wOxKyLYKR9IeoNQr1s4aGV1sF84u22gXQJLs6tAlnhMjXSl3rjFii1swXwfPSiEkNFEpbyJvlPI1tzohordR+RSQsVO88pIG5zu5KVWE01mYZLayBQYF7/nuiXAaehvsXua5Jfv3q7SIvxYYBjoYKU94NQN+1+fhoybc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=SixZVz3p; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=vDdPvgZJ; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="SixZVz3p"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="vDdPvgZJ" Date: Tue, 07 Jul 2026 21:54:48 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1783461290; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2MldPG+SbSSbheFIWR37D8bidfzlLc8z6oAm9uaWxCc=; b=SixZVz3pXjUI2hGzyz/K+GKQ4FGgnv6wfSPEktFjBdtBBjgkda7xeaMqRc4oaebp/qTpn1 dGUIQAay3dtPaIxDj1GLaK+fTE7r3NLgU1Yb0vdEJC0DTL7n/X0+hgFJxGvTIquuw6Q7qW bRMU5qRZtjKE/6hUUDnA5/LKTXr3yHcwbtL/8EXorGgpo7t7y1qGTdPXYU/ZtKFWNsMTTn /F1C5+pbxpZIQr8IpxC6AcKNHk1F9YgxOvfO9cnjrQQP4mJMHn2T68NupKTJ5VTQgVDPvK wh2gLAkPogLET76wkzmPkXQy7jj7Zw8WRDWzgcwaO6R/j4d/bsbLrNFvDpBqVw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1783461290; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2MldPG+SbSSbheFIWR37D8bidfzlLc8z6oAm9uaWxCc=; b=vDdPvgZJZMyt4Sj4lvKjWG5Od8VyEHxR5ATLKe9DrUOgfVe2hqD8K7lpVEGyrwMnPPGA7C RSPsBAsCIu0dhDAg== From: tip-bot2 for Thomas =?utf-8?q?Wei=C3=9Fschuh?= Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/vdso] time: Respect COMPAT_32BIT_TIME for old time type functions Cc: thomas.weissschuh@linutronix.de, Thomas Gleixner , Arnd Bergmann , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260702-vdso-compat_32bit_time-v3-1-db9f36d8d432@linutronix.de> References: <20260702-vdso-compat_32bit_time-v3-1-db9f36d8d432@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178346128855.744054.2180339315206724030.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the timers/vdso branch of tip: Commit-ID: dce21fb3d570169388e2e9d8a60e8d42c1c82a51 Gitweb: https://git.kernel.org/tip/dce21fb3d570169388e2e9d8a60e8d42c1c= 82a51 Author: Thomas Wei=C3=9Fschuh AuthorDate: Thu, 02 Jul 2026 10:21:25 +02:00 Committer: Thomas Gleixner CommitterDate: Tue, 07 Jul 2026 23:52:53 +02:00 time: Respect COMPAT_32BIT_TIME for old time type functions The "old" time types use 32-bit seconds which are not y2038-safe. Respect COMPAT_32BIT_TIME for functions using those types. time(), stime() and gettimeofday() are disabled completely. settimeofday() is kept as it is required to do the initial timewarping after boot. However the 'tv' argument will be rejected. Signed-off-by: Thomas Wei=C3=9Fschuh Signed-off-by: Thomas Gleixner Reviewed-by: Arnd Bergmann Link: https://lore.kernel.org/lkml/e9487ebe-3730-438a-9c23-e45f75986ecc@app.f= astmail.com/ Link: https://patch.msgid.link/20260702-vdso-compat_32bit_time-v3-1-db9f36d8d= 432@linutronix.de --- kernel/sys_ni.c | 4 ++++ kernel/time/time.c | 24 ++++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c index add3032..c8be0ab 100644 --- a/kernel/sys_ni.c +++ b/kernel/sys_ni.c @@ -351,6 +351,10 @@ COND_SYSCALL(ppoll_time32); COND_SYSCALL_COMPAT(ppoll_time32); COND_SYSCALL(utimensat_time32); COND_SYSCALL(clock_adjtime32); +COND_SYSCALL(gettimeofday); +COND_SYSCALL_COMPAT(gettimeofday); +COND_SYSCALL(time); +COND_SYSCALL(stime); =20 /* * The syscalls below are not found in include/uapi/asm-generic/unistd.h diff --git a/kernel/time/time.c b/kernel/time/time.c index 0dd63a9..f836a31 100644 --- a/kernel/time/time.c +++ b/kernel/time/time.c @@ -43,6 +43,12 @@ #include #include "timekeeping.h" =20 +#if defined(CONFIG_64BIT) || defined(CONFIG_COMPAT_32BIT_TIME) +#define __WANT_OLD_TIME_TYPE_SYSCALL 1 +#endif + +static_assert(sizeof(__kernel_old_time_t) =3D=3D 8 ? IS_ENABLED(__WANT_OLD_T= IME_TYPE_SYSCALL) : true); + /* * The timezone where the local system is located. Used as a default by some * programs who obtain this value by using gettimeofday. @@ -51,7 +57,7 @@ struct timezone sys_tz; =20 EXPORT_SYMBOL(sys_tz); =20 -#ifdef __ARCH_WANT_SYS_TIME +#if defined(__ARCH_WANT_SYS_TIME) && defined(__WANT_OLD_TIME_TYPE_SYSCALL) =20 /* * sys_time() can be implemented in user-level using @@ -96,7 +102,7 @@ SYSCALL_DEFINE1(stime, __kernel_old_time_t __user *, tptr) return 0; } =20 -#endif /* __ARCH_WANT_SYS_TIME */ +#endif /* __ARCH_WANT_SYS_TIME && __WANT_OLD_TIME_TYPE_SYSCALL */ =20 #ifdef CONFIG_COMPAT_32BIT_TIME #ifdef __ARCH_WANT_SYS_TIME32 @@ -137,6 +143,7 @@ SYSCALL_DEFINE1(stime32, old_time32_t __user *, tptr) #endif /* __ARCH_WANT_SYS_TIME32 */ #endif =20 +#ifdef __WANT_OLD_TIME_TYPE_SYSCALL SYSCALL_DEFINE2(gettimeofday, struct __kernel_old_timeval __user *, tv, struct timezone __user *, tz) { @@ -154,6 +161,7 @@ SYSCALL_DEFINE2(gettimeofday, struct __kernel_old_timeval= __user *, tv, } return 0; } +#endif /* __WANT_OLD_TIME_TYPE_SYSCALL */ =20 /* * In case for some reason the CMOS clock has not already been running @@ -203,6 +211,9 @@ SYSCALL_DEFINE2(settimeofday, struct __kernel_old_timeval= __user *, tv, struct timezone new_tz; =20 if (tv) { + if (!IS_ENABLED(__WANT_OLD_TIME_TYPE_SYSCALL)) + return -EINVAL; + if (get_user(new_ts.tv_sec, &tv->tv_sec) || get_user(new_ts.tv_nsec, &tv->tv_usec)) return -EFAULT; @@ -220,7 +231,7 @@ SYSCALL_DEFINE2(settimeofday, struct __kernel_old_timeval= __user *, tv, return do_sys_settimeofday64(tv ? &new_ts : NULL, tz ? &new_tz : NULL); } =20 -#ifdef CONFIG_COMPAT +#ifdef CONFIG_COMPAT_32BIT_TIME COMPAT_SYSCALL_DEFINE2(gettimeofday, struct old_timeval32 __user *, tv, struct timezone __user *, tz) { @@ -239,7 +250,9 @@ COMPAT_SYSCALL_DEFINE2(gettimeofday, struct old_timeval32= __user *, tv, =20 return 0; } +#endif /* CONFIG_COMPAT_32BIT_TIME */ =20 +#ifdef CONFIG_COMPAT COMPAT_SYSCALL_DEFINE2(settimeofday, struct old_timeval32 __user *, tv, struct timezone __user *, tz) { @@ -247,6 +260,9 @@ COMPAT_SYSCALL_DEFINE2(settimeofday, struct old_timeval32= __user *, tv, struct timezone new_tz; =20 if (tv) { + if (!IS_ENABLED(CONFIG_COMPAT_32BIT_TIME)) + return -EINVAL; + if (get_user(new_ts.tv_sec, &tv->tv_sec) || get_user(new_ts.tv_nsec, &tv->tv_usec)) return -EFAULT; @@ -263,7 +279,7 @@ COMPAT_SYSCALL_DEFINE2(settimeofday, struct old_timeval32= __user *, tv, =20 return do_sys_settimeofday64(tv ? &new_ts : NULL, tz ? &new_tz : NULL); } -#endif +#endif /* CONFIG_COMPAT */ =20 #ifdef CONFIG_64BIT SYSCALL_DEFINE1(adjtimex, struct __kernel_timex __user *, txc_p)