ftrace: ipipe: Fix hardening of trace_recursive_lock
Subsystems (2)
PATCH 1/1 ftrace: ipipe: Fix hardening of trace_recursive_lock
From: Jan Kiszka <[email protected]>
cpu_buffer->current_context is supposed to be protected by irq disabling, just like in dovetail.
Signed-off-by Jan Kiszka <[email protected]>
---
No-arch branches updated with this already.
kernel/trace/ring_buffer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/trace/ring_buffer.c +3 -1
@@ -2726,9 +2726,9 @@ rb_wakeups(struct ring_buffer *buffer, struct ring_buffer_per_cpu *cpu_buffer) static __always_inline inttrace_recursive_lock (struct ring_buffer_per_cpu *cpu_buffer) { -unsigned int val = cpu_buffer->current_context;unsigned long pc =preempt_count ();unsigned long flags; +unsigned int val;int bit;if (!(pc & (NMI_MASK |HARDIRQ_MASK |SOFTIRQ_OFFSET )))
@@ -2739,6 +2739,8 @@ trace_recursive_lock(struct ring_buffer_per_cpu *cpu_buffer) flags =hard_local_irq_save (); + val = cpu_buffer->current_context; +if (unlikely (val & (1 << (bit + cpu_buffer->nest)))) {/* * It is possible that this was called by transitioning
Signature · 1 line
2.26.2