History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Two entries being added at the same time to the IFLA policy table, whilst parallel bug fixes to decnet routing dst handling overlapping with the dst gc removal in net-next.

David S. Miller committed 9 years ago

Commit 3d091982 parents 52f80dc 48b6bbe213 files · +2109 −1711Browse files

Showing the changes to kernel (8 of 213 files). Show all

Unified · Split

8 files
  1. kernel/irq/manage.c +3 −1
  2. kernel/livepatch/patch.c +6 −2
  3. kernel/livepatch/transition.c +31 −5
  4. kernel/sched/core.c +1 −1
  5. kernel/sched/fair.c +1 −1
  6. kernel/time/alarmtimer.c +11 −3
  7. kernel/time/tick-broadcast.c +3 −1
  8. kernel/time/tick-internal.h +0 −2
kernel/irq/manage.c+3−1
@@ -1312,8 +1312,10 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new) · 1311 unmodified lines
13121312 ret = __irq_set_trigger(desc,
13131313 new->flags & IRQF_TRIGGER_MASK);
13141314
1315− if (ret)
1315+ if (ret) {
1316+ irq_release_resources(desc);
13161317 goto out_mask;
1318+ }
13171319 }
13181320
13191321 desc->istate &= ~(IRQS_AUTODETECT | IRQS_SPURIOUS_DISABLED | \
kernel/livepatch/patch.c+6−2
@@ -59,7 +59,11 @@ static void notrace klp_ftrace_handler(unsigned long ip, · 58 unmodified lines
5959
6060 ops = container_of(fops, struct klp_ops, fops);
6161
62− rcu_read_lock();
62+ /*
63+ * A variant of synchronize_sched() is used to allow patching functions
64+ * where RCU is not watching, see klp_synchronize_transition().
65+ */
66+ preempt_disable_notrace();
6367
6468 func = list_first_or_null_rcu(&ops->func_stack, struct klp_func,
6569 stack_node);
@@ -115,7 +119,7 @@ static void notrace klp_ftrace_handler(unsigned long ip, · 49 unmodified lines
115119
116120 klp_arch_set_pc(regs, (unsigned long)func->new_func);
117121 unlock:
118− rcu_read_unlock();
122+ preempt_enable_notrace();
119123 }
120124
121125 /*
kernel/livepatch/transition.c+31−5
@@ -48,6 +48,28 @@ static void klp_transition_work_fn(struct work_struct *work) · 47 unmodified lines
4848 }
4949 static DECLARE_DELAYED_WORK(klp_transition_work, klp_transition_work_fn);
5050
51+/*
52+ * This function is just a stub to implement a hard force
53+ * of synchronize_sched(). This requires synchronizing
54+ * tasks even in userspace and idle.
55+ */
56+static void klp_sync(struct work_struct *work)
57+{
58+}
59+
60+/*
61+ * We allow to patch also functions where RCU is not watching,
62+ * e.g. before user_exit(). We can not rely on the RCU infrastructure
63+ * to do the synchronization. Instead hard force the sched synchronization.
64+ *
65+ * This approach allows to use RCU functions for manipulating func_stack
66+ * safely.
67+ */
68+static void klp_synchronize_transition(void)
69+{
70+ schedule_on_each_cpu(klp_sync);
71+}
72+
5173 /*
5274 * The transition to the target patch state is complete. Clean up the data
5375 * structures.
@@ -73,7 +95,7 @@ static void klp_complete_transition(void) · 19 unmodified lines
7395 * func->transition gets cleared, the handler may choose a
7496 * removed function.
7597 */
76− synchronize_rcu();
98+ klp_synchronize_transition();
7799 }
78100
79101 if (klp_transition_patch->immediate)
@@ -92,7 +114,7 @@ static void klp_complete_transition(void) · 12 unmodified lines
92114
93115 /* Prevent klp_ftrace_handler() from seeing KLP_UNDEFINED state */
94116 if (klp_target_state == KLP_PATCHED)
95− synchronize_rcu();
117+ klp_synchronize_transition();
96118
97119 read_lock(&tasklist_lock);
98120 for_each_process_thread(g, task) {
@@ -136,7 +158,11 @@ void klp_cancel_transition(void) · 37 unmodified lines
136158 */
137159 void klp_update_patch_state(struct task_struct *task)
138160 {
139− rcu_read_lock();
161+ /*
162+ * A variant of synchronize_sched() is used to allow patching functions
163+ * where RCU is not watching, see klp_synchronize_transition().
164+ */
165+ preempt_disable_notrace();
140166
141167 /*
142168 * This test_and_clear_tsk_thread_flag() call also serves as a read
@@ -153,7 +179,7 @@ void klp_update_patch_state(struct task_struct *task) · 10 unmodified lines
153179 if (test_and_clear_tsk_thread_flag(task, TIF_PATCH_PENDING))
154180 task->patch_state = READ_ONCE(klp_target_state);
155181
156− rcu_read_unlock();
182+ preempt_enable_notrace();
157183 }
158184
159185 /*
@@ -539,7 +565,7 @@ void klp_reverse_transition(void) · 379 unmodified lines
539565 clear_tsk_thread_flag(idle_task(cpu), TIF_PATCH_PENDING);
540566
541567 /* Let any remaining calls to klp_update_patch_state() complete */
542− synchronize_rcu();
568+ klp_synchronize_transition();
543569
544570 klp_start_transition();
545571 }
kernel/sched/core.c+1−1
@@ -5605,7 +5605,7 @@ void idle_task_exit(void) · 5604 unmodified lines
56055605 BUG_ON(cpu_online(smp_processor_id()));
56065606
56075607 if (mm != &init_mm) {
5608− switch_mm_irqs_off(mm, &init_mm, current);
5608+ switch_mm(mm, &init_mm, current);
56095609 finish_arch_post_lock_switch();
56105610 }
56115611 mmdrop(mm);
kernel/sched/fair.c+1−1
@@ -3563,7 +3563,7 @@ static inline void check_schedstat_required(void) · 3562 unmodified lines
35633563 trace_sched_stat_runtime_enabled()) {
35643564 printk_deferred_once("Scheduler tracepoints stat_sleep, stat_iowait, "
35653565 "stat_blocked and stat_runtime require the "
3566− "kernel parameter schedstats=enabled or "
3566+ "kernel parameter schedstats=enable or "
35673567 "kernel.sched_schedstats=1\n");
35683568 }
35693569 #endif
kernel/time/alarmtimer.c+11−3
@@ -387,7 +387,7 @@ void alarm_start_relative(struct alarm *alarm, ktime_t start) · 386 unmodified lines
387387 {
388388 struct alarm_base *base = &alarm_bases[alarm->type];
389389
390− start = ktime_add(start, base->gettime());
390+ start = ktime_add_safe(start, base->gettime());
391391 alarm_start(alarm, start);
392392 }
393393 EXPORT_SYMBOL_GPL(alarm_start_relative);
@@ -475,7 +475,7 @@ u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval) · 81 unmodified lines
475475 overrun++;
476476 }
477477
478− alarm->node.expires = ktime_add(alarm->node.expires, interval);
478+ alarm->node.expires = ktime_add_safe(alarm->node.expires, interval);
479479 return overrun;
480480 }
481481 EXPORT_SYMBOL_GPL(alarm_forward);
@@ -660,13 +660,21 @@ static int alarm_timer_set(struct k_itimer *timr, int flags, · 178 unmodified lines
660660
661661 /* start the timer */
662662 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+
663671 exp = timespec64_to_ktime(new_setting->it_value);
664672 /* Convert (if necessary) to absolute time */
665673 if (flags != TIMER_ABSTIME) {
666674 ktime_t now;
667675
668676 now = alarm_bases[timr->it.alarm.alarmtimer.type].gettime();
669− exp = ktime_add(now, exp);
677+ exp = ktime_add_safe(now, exp);
670678 }
671679
672680 alarm_start(&timr->it.alarm.alarmtimer, exp);
kernel/time/tick-broadcast.c+3−1
@@ -37,9 +37,11 @@ static int tick_broadcast_forced; · 36 unmodified lines
3737 static __cacheline_aligned_in_smp DEFINE_RAW_SPINLOCK(tick_broadcast_lock);
3838
3939 #ifdef CONFIG_TICK_ONESHOT
40+static void tick_broadcast_setup_oneshot(struct clock_event_device *bc);
4041 static void tick_broadcast_clear_oneshot(int cpu);
4142 static void tick_resume_broadcast_oneshot(struct clock_event_device *bc);
4243 #else
44+static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) { BUG(); }
4345 static inline void tick_broadcast_clear_oneshot(int cpu) { }
4446 static inline void tick_resume_broadcast_oneshot(struct clock_event_device *bc) { }
4547 #endif
@@ -867,7 +869,7 @@ static void tick_broadcast_init_next_event(struct cpumask *mask, · 821 unmodified lines
867869 /**
868870 * tick_broadcast_setup_oneshot - setup the broadcast device
869871 */
870−void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
872+static void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
871873 {
872874 int cpu = smp_processor_id();
873875
kernel/time/tick-internal.h+0−2
@@ -126,7 +126,6 @@ static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } · 125 unmodified lines
126126
127127 /* Functions related to oneshot broadcasting */
128128 #if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT)
129−extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc);
130129 extern void tick_broadcast_switch_to_oneshot(void);
131130 extern void tick_shutdown_broadcast_oneshot(unsigned int cpu);
132131 extern int tick_broadcast_oneshot_active(void);
@@ -134,7 +133,6 @@ extern void tick_check_oneshot_broadcast_this_cpu(void); · 1 unmodified line
134133 bool tick_broadcast_oneshot_available(void);
135134 extern struct cpumask *tick_get_broadcast_oneshot_mask(void);
136135 #else /* !(BROADCAST && ONESHOT): */
137−static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) { BUG(); }
138136 static inline void tick_broadcast_switch_to_oneshot(void) { }
139137 static inline void tick_shutdown_broadcast_oneshot(unsigned int cpu) { }
140138 static inline int tick_broadcast_oneshot_active(void) { return 0; }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t