Patch "fgraph: Allocate ret_stack_list with proper size" has been added to the 6.11-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

    fgraph: Allocate ret_stack_list with proper size

to the 6.11-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:
     fgraph-allocate-ret_stack_list-with-proper-size.patch
and it can be found in the queue-6.11 subdirectory.

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



commit 16e9fc4fe3e673aaf95a9d0fb5832c0306c4a4dc
Author: Steven Rostedt <rostedt@xxxxxxxxxxx>
Date:   Fri Oct 18 21:52:12 2024 -0400

    fgraph: Allocate ret_stack_list with proper size
    
    [ Upstream commit fae4078c289a2f24229c0de652249948b1cd6bdb ]
    
    The ret_stack_list is an array of ret_stack shadow stacks for the function
    graph usage. When the first function graph is enabled, all tasks in the
    system get a shadow stack. The ret_stack_list is a 32 element array of
    pointers to these shadow stacks. It allocates the shadow stack in batches
    (32 stacks at a time), assigns them to running tasks, and continues until
    all tasks are covered.
    
    When the function graph shadow stack changed from an array of
    ftrace_ret_stack structures to an array of longs, the allocation of
    ret_stack_list went from allocating an array of 32 elements to just a
    block defined by SHADOW_STACK_SIZE. Luckily, that's defined as PAGE_SIZE
    and is much more than enough to hold 32 pointers. But it is way overkill
    for the amount needed to allocate.
    
    Change the allocation of ret_stack_list back to a kcalloc() of
    FTRACE_RETSTACK_ALLOC_SIZE pointers.
    
    Cc: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
    Cc: Mark Rutland <mark.rutland@xxxxxxx>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/20241018215212.23f13f40@rorschach
    Fixes: 42675b723b484 ("function_graph: Convert ret_stack to a series of longs")
    Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c
index 43f4e3f57438b..41e7a15dcb50c 100644
--- a/kernel/trace/fgraph.c
+++ b/kernel/trace/fgraph.c
@@ -1162,7 +1162,8 @@ static int start_graph_tracing(void)
 	unsigned long **ret_stack_list;
 	int ret;
 
-	ret_stack_list = kmalloc(SHADOW_STACK_SIZE, GFP_KERNEL);
+	ret_stack_list = kcalloc(FTRACE_RETSTACK_ALLOC_SIZE,
+				 sizeof(*ret_stack_list), GFP_KERNEL);
 
 	if (!ret_stack_list)
 		return -ENOMEM;




[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