Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'timers-urgent-2020-11-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer fixes from Thomas Gleixner:
"A few fixes for timers/timekeeping:

- Prevent undefined behaviour in the timespec64_to_ns() conversion
which is used for converting user supplied time input to
nanoseconds. It lacked overflow protection.

- Mark sched_clock_read_begin/retry() to prevent recursion in the
tracer

- Remove unused debug functions in the hrtimer and timerlist code"

* tag 'timers-urgent-2020-11-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
time: Prevent undefined behaviour in timespec64_to_ns()
timers: Remove unused inline funtion debug_timer_free()
hrtimer: Remove unused inline function debug_hrtimer_free()
time/sched_clock: Mark sched_clock_read_begin/retry() as notrace

+6 -16
+4
include/linux/time64.h
··· 124 124 */ 125 125 static inline s64 timespec64_to_ns(const struct timespec64 *ts) 126 126 { 127 + /* Prevent multiplication overflow */ 128 + if ((unsigned long long)ts->tv_sec >= KTIME_SEC_MAX) 129 + return KTIME_MAX; 130 + 127 131 return ((s64) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec; 128 132 } 129 133
-5
kernel/time/hrtimer.c
··· 425 425 debug_object_deactivate(timer, &hrtimer_debug_descr); 426 426 } 427 427 428 - static inline void debug_hrtimer_free(struct hrtimer *timer) 429 - { 430 - debug_object_free(timer, &hrtimer_debug_descr); 431 - } 432 - 433 428 static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id, 434 429 enum hrtimer_mode mode); 435 430
-4
kernel/time/itimer.c
··· 172 172 u64 oval, nval, ointerval, ninterval; 173 173 struct cpu_itimer *it = &tsk->signal->it[clock_id]; 174 174 175 - /* 176 - * Use the to_ktime conversion because that clamps the maximum 177 - * value to KTIME_MAX and avoid multiplication overflows. 178 - */ 179 175 nval = timespec64_to_ns(&value->it_value); 180 176 ninterval = timespec64_to_ns(&value->it_interval); 181 177
+2 -2
kernel/time/sched_clock.c
··· 68 68 return (cyc * mult) >> shift; 69 69 } 70 70 71 - struct clock_read_data *sched_clock_read_begin(unsigned int *seq) 71 + notrace struct clock_read_data *sched_clock_read_begin(unsigned int *seq) 72 72 { 73 73 *seq = raw_read_seqcount_latch(&cd.seq); 74 74 return cd.read_data + (*seq & 1); 75 75 } 76 76 77 - int sched_clock_read_retry(unsigned int seq) 77 + notrace int sched_clock_read_retry(unsigned int seq) 78 78 { 79 79 return read_seqcount_latch_retry(&cd.seq, seq); 80 80 }
-5
kernel/time/timer.c
··· 732 732 debug_object_deactivate(timer, &timer_debug_descr); 733 733 } 734 734 735 - static inline void debug_timer_free(struct timer_list *timer) 736 - { 737 - debug_object_free(timer, &timer_debug_descr); 738 - } 739 - 740 735 static inline void debug_timer_assert_init(struct timer_list *timer) 741 736 { 742 737 debug_object_assert_init(timer, &timer_debug_descr);