Re: [PATCH v4 1/2] tracing: fgraph: allocate shadow stacks inline with GFP_NOWAIT

From
Vineet Gupta <hidden>
Date
2026-11-18 00:00:28
Also in
bpf, lkml, stable
Reply to
Steven Rostedt, 2026-11-17
On 11/17/26 3:56 PM, Steven Rostedt wrote:
On Wed, 21 Oct 2026 10:44:05 -0700
Vineet Gupta [off-list ref] wrote:
quoted
smp_store_release() is a drop-in replacement for the smp_wmb() and
plain store it replaces.
This should be added with that, but I can just add it as a separate patch.
Thx for that. Let me know if you need me to do anything.

-Vineet
quoted hunk ↗ jump to hunk
-- Steve
diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c
index bbf6e4e2da2d..d32160a6b835 100644
--- a/kernel/trace/fgraph.c
+++ b/kernel/trace/fgraph.c
@@ -568,7 +568,11 @@ ftrace_push_return_trace(unsigned long ret, unsigned long func,
  	if (unlikely(ftrace_graph_is_dead()))
  		return -EBUSY;
  
-	if (!current->ret_stack)
+	/*
+	 * We must make sure the ret_stack is tested before we read
+	 * anything else (See alloc_retstack_tasklist()).
+	 */
+	if (!smp_load_acquire(&current->ret_stack))
  		return -EBUSY;
  
  	BUILD_BUG_ON(SHADOW_STACK_SIZE % sizeof(long));
@@ -576,12 +580,6 @@ ftrace_push_return_trace(unsigned long ret, unsigned long func,
  	/* Set val to "reserved" with the delta to the new fgraph frame */
  	val = (FGRAPH_TYPE_RESERVED << FGRAPH_TYPE_SHIFT) | FGRAPH_FRAME_OFFSET;
  
-	/*
-	 * We must make sure the ret_stack is tested before we read
-	 * anything else.
-	 */
-	smp_rmb();
-
  	/*
  	 * Check if there's room on the shadow stack to fit a fraph frame
  	 * and a bitmap word.
  
Thread (16 messages) 16 messages, 6 authors, last reply 6h ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help