linux/kernel/time
Wang Yan 269f2b43fa time: Fix off-by-one in compat settimeofday() usec validation
The compat version of settimeofday() uses '>' instead of '>=' when
validating tv_usec against USEC_PER_SEC, allowing the value 1000000 to pass
the check. After the subsequent conversion to nanoseconds (tv_nsec *=
NSEC_PER_USEC), this results in tv_nsec == NSEC_PER_SEC, which violates the
timespec invariant that tv_nsec must be strictly less than NSEC_PER_SEC.

The native settimeofday() was already fixed in commit ce4abda5e1 ("time:
Fix off-by-one in settimeofday() usec validation"), but the compat
counterpart was missed.

Fix it by using '>=' to reject tv_usec values outside the valid range [0,
USEC_PER_SEC - 1].

Fixes: 5e0fb1b57b ("y2038: time: avoid timespec usage in settimeofday()")
Signed-off-by: Wang Yan <wangyan01@kylinos.cn>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260622103348.120255-1-wangyan01@kylinos.cn
2026-06-22 13:20:20 +02:00
..
.kunitconfig time/kunit: Add .kunitconfig 2026-02-24 08:41:51 +01:00
alarmtimer.c alarmtimer: Remove stale return description from alarm_handle_timer() 2026-05-06 08:33:08 +02:00
clockevents.c clockevents: Fix duplicate type specifier in stub function parameter 2026-06-02 21:07:55 +02:00
clocksource-wdtest.c clocksource: Rewrite watchdog code completely 2026-03-20 13:36:32 +01:00
clocksource.c Updates for the time/timer core subsystem: 2026-06-15 13:39:12 +05:30
hrtimer.c hrtimer: Correct CONFIG_NO_HZ_COMMON macro name in comment 2026-06-17 17:59:45 +02:00
itimer.c timers/itimer: Avoid direct access to hrtimer clockbase 2025-09-09 12:27:17 +02:00
jiffies.c time/jiffies: Register jiffies clocksource before usage 2026-06-13 15:22:40 +02:00
Kconfig vdso/treewide: Drop GENERIC_TIME_VSYSCALL 2026-06-02 21:41:23 +02:00
Makefile timens: Remove dependency on the vDSO 2026-03-26 15:44:23 +01:00
namespace_internal.h timens: Remove dependency on the vDSO 2026-03-26 15:44:23 +01:00
namespace_vdso.c mm.git review status for linus..mm-stable 2026-04-15 12:59:16 -07:00
namespace.c time/namespace: Export init_time_ns and do_timens_ktime_to_host() 2026-06-02 21:05:36 +02:00
ntp_internal.h ntp: Rename __do_adjtimex() to ntp_adjtimex() 2025-06-19 14:28:23 +02:00
ntp.c ntp: Use ktime_get_ntp_seconds() 2025-06-19 14:28:24 +02:00
posix-clock.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
posix-cpu-timers.c posix-cpu-timers: Use u64 multiplication in update_rlimit_cpu() 2026-06-17 17:58:34 +02:00
posix-stubs.c posix-timers: Get rid of [COMPAT_]SYS_NI() uses 2023-12-20 21:30:27 -08:00
posix-timers.c posix-timers: Switch to hrtimer_start_expires_user() 2026-05-01 21:36:12 +02:00
posix-timers.h posix-timers: Expand timer_[re]arm() callbacks with a boolean return value 2026-05-01 21:36:11 +02:00
sched_clock.c time/sched_clock: Use ACCESS_PRIVATE() to evaluate hrtimer::function 2026-01-13 18:08:57 +01:00
sleep_timeout.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
test_udelay.c time: Add MODULE_DESCRIPTION() to time test modules 2024-06-03 11:18:50 +02:00
tick-broadcast-hrtimer.c clockevents: Remove redundant CLOCK_EVT_FEAT_KTIME 2026-02-27 16:40:06 +01:00
tick-broadcast.c clockevents: Add missing resets of the next_event_forced flag 2026-04-16 21:22:04 +02:00
tick-common.c clockevents: Prevent timer interrupt starvation 2026-04-10 22:45:38 +02:00
tick-internal.h cpufreq: ondemand: Simplify idle cputime granularity test 2026-01-28 22:24:58 +01:00
tick-legacy.c timekeeping: remove xtime_update 2020-10-30 21:57:07 +01:00
tick-oneshot.c treewide: Update email address 2026-01-11 06:09:11 -10:00
tick-sched.c Updates for the NOHZ subsystem: 2026-06-15 13:48:52 +05:30
tick-sched.h tick/sched: Remove unused fields 2026-06-02 21:27:25 +02:00
time_test.c time/kunit: Document handling of negative years of is_leap() 2026-02-02 12:37:54 +01:00
time.c time: Fix off-by-one in compat settimeofday() usec validation 2026-06-22 13:20:20 +02:00
timeconst.bc time: Add SPDX license identifiers 2018-11-23 11:51:20 +01:00
timeconv.c time: Improve performance of time64_to_tm() 2021-06-24 11:51:59 +02:00
timecounter.c time/timecounter: Inline timecounter_cyc2time() 2025-12-15 20:16:49 +01:00
timekeeping_debug.c timekeeping: Add percpu counter for tracking floor swap events 2024-10-10 10:20:46 +02:00
timekeeping_internal.h timekeeping: Provide ktime_get_ntp_seconds() 2025-06-19 14:28:23 +02:00
timekeeping.c timekeeping: Register default clocksource before taking tk_core.lock 2026-06-17 16:55:26 +02:00
timekeeping.h timekeeping: Provide infrastructure for coupled clockevents 2026-02-27 16:40:08 +01:00
timer_list.c tick/sched: Remove unused fields 2026-06-02 21:27:25 +02:00
timer_migration.c Updates for the time/timer core subsystem: 2026-06-15 13:39:12 +05:30
timer_migration.h timers/migration: Turn tmigr_hierarchy level_list into a flexible array 2026-06-02 21:34:03 +02:00
timer.c hrtimer: Return ktime_t from hrtimer_get_next_event()/hrtimer_next_event_without() 2026-05-06 08:33:09 +02:00
vsyscall.c vdso/vsyscall: Avoid slow division loop in auxiliary clock update 2025-09-03 11:55:11 +02:00