[patch 0/2] timers: Prevent multiplication overflow in timespec/val conversions

From: Thomas Gleixner
Date: Tue Jun 20 2017 - 11:42:16 EST


KASAN detected a multiplication overflow in the sys_setitimer() timeval
conversion. The same issue is possible the posix-cpu-timer sys_timer_set()
implementation.

In both cases the conversion of the tv_sec part overflows when multiplied
with NSEC_PER_SEC, i.e. 1e9.

This can be mitigated by using the timespec/val_to_ktime() helper, which
prevents the overflow and clamps the result to KTIME_MAX (~292 years).

Thanks,

tglx