Patch "ring-buffer: Do not record in NMI if the arch does not support cmpxchg in NMI" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ring-buffer: Do not record in NMI if the arch does not support cmpxchg in NMI

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ring-buffer-do-not-record-in-nmi-if-the-arch-does-no.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 4c90bd3469bc3549cc5018f7102c95a720a6cad4
Author: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
Date:   Wed Dec 13 17:54:03 2023 -0500

    ring-buffer: Do not record in NMI if the arch does not support cmpxchg in NMI
    
    [ Upstream commit 712292308af2265cd9b126aedfa987f10f452a33 ]
    
    As the ring buffer recording requires cmpxchg() to work, if the
    architecture does not support cmpxchg in NMI, then do not do any recording
    within an NMI.
    
    Link: https://lore.kernel.org/linux-trace-kernel/20231213175403.6fc18540@xxxxxxxxxxxxxxxxxx
    
    Cc: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
    Cc: Mark Rutland <mark.rutland@xxxxxxx>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
    Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 901a140e30fa..f232cf56fa05 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -3649,6 +3649,12 @@ rb_reserve_next_event(struct trace_buffer *buffer,
 	int nr_loops = 0;
 	int add_ts_default;
 
+	/* ring buffer does cmpxchg, make sure it is safe in NMI context */
+	if (!IS_ENABLED(CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG) &&
+	    (unlikely(in_nmi()))) {
+		return NULL;
+	}
+
 	rb_start_commit(cpu_buffer);
 	/* The commit page can not change after this */
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux