timers: Prevent multiplication overflow in timespec/val conversions
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | itimer: Make timeval to nsec conversion range limitedkernel/ | +6 | 0 replies | |
| 2/2 | posix-cpu-timers: Make timespec to nsec conversion safekernel/ | +5 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [patch 0/2] timers: Prevent multiplication overflow in timespec/val conversions
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