Skip to contentSkip to conversation

fix preempt count underflow in user_trace_stop

PATCH In review Michal Schmidt 2 participants 2 messages Mar 12, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix preempt count underflow in user_trace_stop

When playing with trace_user_trigger_irq in order to trace IRQ->userspace latencies, I encountered a bug in the latency tracer. If I have wakeup_timing enabled and attempt to stop the trace in my userspace program, the system crashes. This is caused by an unbalanced preempt_enable() which underflows the preempt count.

kernel/latency_trace.c +0 -1
index e07bb95..29dfb79 100644
@@ -2396,7 +2396,6 @@ long user_trace_stop(void)
 		if (current != sch.task) {
 			__raw_spin_unlock(&sch.trace_lock);
 			local_irq_restore(flags);
-			preempt_enable();
 			return -EINVAL;
 		}
 		sch.task = NULL;
#1 lore raw
Quoted 5 lines · Michal Schmidt

When playing with trace_user_trigger_irq in order to trace IRQ->userspace latencies, I encountered a bug in the latency tracer. If I have wakeup_timing enabled and attempt to stop the trace in my userspace program, the system crashes. This is caused by an unbalanced preempt_enable() which underflows the preempt count.

good catch! I've applied it,

Ingo