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 branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer fixes from Thomas Gleixner:
"Three fixlets for timers:

- Two hot-fixes for the alarmtimer based posix timers, which prevent
a nasty DOS by self rescheduling timers. The proper cleanup of that
mess is queued for 4.13

- Make a function static"

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
tick/broadcast: Make tick_broadcast_setup_oneshot() static
alarmtimer: Rate limit periodic intervals
alarmtimer: Prevent overflow of relative timers

+14 -6
+11 -3
kernel/time/alarmtimer.c
··· 387 387 { 388 388 struct alarm_base *base = &alarm_bases[alarm->type]; 389 389 390 - start = ktime_add(start, base->gettime()); 390 + start = ktime_add_safe(start, base->gettime()); 391 391 alarm_start(alarm, start); 392 392 } 393 393 EXPORT_SYMBOL_GPL(alarm_start_relative); ··· 475 475 overrun++; 476 476 } 477 477 478 - alarm->node.expires = ktime_add(alarm->node.expires, interval); 478 + alarm->node.expires = ktime_add_safe(alarm->node.expires, interval); 479 479 return overrun; 480 480 } 481 481 EXPORT_SYMBOL_GPL(alarm_forward); ··· 660 660 661 661 /* start the timer */ 662 662 timr->it.alarm.interval = timespec64_to_ktime(new_setting->it_interval); 663 + 664 + /* 665 + * Rate limit to the tick as a hot fix to prevent DOS. Will be 666 + * mopped up later. 667 + */ 668 + if (timr->it.alarm.interval < TICK_NSEC) 669 + timr->it.alarm.interval = TICK_NSEC; 670 + 663 671 exp = timespec64_to_ktime(new_setting->it_value); 664 672 /* Convert (if necessary) to absolute time */ 665 673 if (flags != TIMER_ABSTIME) { 666 674 ktime_t now; 667 675 668 676 now = alarm_bases[timr->it.alarm.alarmtimer.type].gettime(); 669 - exp = ktime_add(now, exp); 677 + exp = ktime_add_safe(now, exp); 670 678 } 671 679 672 680 alarm_start(&timr->it.alarm.alarmtimer, exp);
+3 -1
kernel/time/tick-broadcast.c
··· 37 37 static __cacheline_aligned_in_smp DEFINE_RAW_SPINLOCK(tick_broadcast_lock); 38 38 39 39 #ifdef CONFIG_TICK_ONESHOT 40 + static void tick_broadcast_setup_oneshot(struct clock_event_device *bc); 40 41 static void tick_broadcast_clear_oneshot(int cpu); 41 42 static void tick_resume_broadcast_oneshot(struct clock_event_device *bc); 42 43 #else 44 + static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) { BUG(); } 43 45 static inline void tick_broadcast_clear_oneshot(int cpu) { } 44 46 static inline void tick_resume_broadcast_oneshot(struct clock_event_device *bc) { } 45 47 #endif ··· 869 867 /** 870 868 * tick_broadcast_setup_oneshot - setup the broadcast device 871 869 */ 872 - void tick_broadcast_setup_oneshot(struct clock_event_device *bc) 870 + static void tick_broadcast_setup_oneshot(struct clock_event_device *bc) 873 871 { 874 872 int cpu = smp_processor_id(); 875 873
-2
kernel/time/tick-internal.h
··· 126 126 127 127 /* Functions related to oneshot broadcasting */ 128 128 #if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT) 129 - extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc); 130 129 extern void tick_broadcast_switch_to_oneshot(void); 131 130 extern void tick_shutdown_broadcast_oneshot(unsigned int cpu); 132 131 extern int tick_broadcast_oneshot_active(void); ··· 133 134 bool tick_broadcast_oneshot_available(void); 134 135 extern struct cpumask *tick_get_broadcast_oneshot_mask(void); 135 136 #else /* !(BROADCAST && ONESHOT): */ 136 - static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) { BUG(); } 137 137 static inline void tick_broadcast_switch_to_oneshot(void) { } 138 138 static inline void tick_shutdown_broadcast_oneshot(unsigned int cpu) { } 139 139 static inline int tick_broadcast_oneshot_active(void) { return 0; }