lineage_android_kernel_xiao.../kernel/time
Thomas Gleixner 65cb24de03 posix-timers: Sanitize overrun handling
[ Upstream commit 78c9c4dfbf8c04883941445a195276bb4bb92c76 ]

The posix timer overrun handling is broken because the forwarding functions
can return a huge number of overruns which does not fit in an int. As a
consequence timer_getoverrun(2) and siginfo::si_overrun can turn into
random number generators.

The k_clock::timer_forward() callbacks return a 64 bit value now. Make
k_itimer::ti_overrun[_last] 64bit as well, so the kernel internal
accounting is correct. 3Remove the temporary (int) casts.

Add a helper function which clamps the overrun value returned to user space
via timer_getoverrun(2) or siginfo::si_overrun limited to a positive value
between 0 and INT_MAX. INT_MAX is an indicator for user space that the
overrun value has been clamped.

Reported-by: Team OWL337 <icytxw@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: John Stultz <john.stultz@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Link: https://lkml.kernel.org/r/20180626132705.018623573@linutronix.de
[florian: Make patch apply to v4.9.135]
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2018-11-10 07:43:01 -08:00
..
Kconfig
Makefile
alarmtimer.c alarmtimer: Prevent overflow for relative nanosleep 2018-10-03 17:01:45 -07:00
clockevents.c
clocksource.c
hrtimer.c
itimer.c
jiffies.c
ntp.c
ntp_internal.h
posix-clock.c
posix-cpu-timers.c posix-timers: Sanitize overrun handling 2018-11-10 07:43:01 -08:00
posix-timers.c posix-timers: Sanitize overrun handling 2018-11-10 07:43:01 -08:00
sched_clock.c
test_udelay.c
tick-broadcast-hrtimer.c
tick-broadcast.c
tick-common.c
tick-internal.h
tick-oneshot.c
tick-sched.c
tick-sched.h
time.c time: Introduce jiffies64_to_nsecs() 2018-10-10 08:53:18 +02:00
timeconst.bc time: Introduce jiffies64_to_nsecs() 2018-10-10 08:53:18 +02:00
timeconv.c
timecounter.c
timekeeping.c
timekeeping.h
timekeeping_debug.c
timekeeping_internal.h
timer.c timers: Clear timer_base::must_forward_clk with timer_base::lock held 2018-09-19 22:47:13 +02:00
timer_list.c
timer_stats.c