Skip to content

Commit a0d8dbb

Browse files
ftrace: Add cond_resched() to ftrace_graph_set_hash()
JIRA: https://issues.redhat.com/browse/RHEL-115358 CVE: CVE-2025-37940 Conflicts: Context change from missing commit 8b0cb3a ("ftrace: Use guard to take ftrace_lock in ftrace_graph_set_hash()") commit 42ea22e Author: zhoumin <teczm@foxmail.com> Date: Tue Apr 1 01:00:34 2025 +0800 ftrace: Add cond_resched() to ftrace_graph_set_hash() When the kernel contains a large number of functions that can be traced, the loop in ftrace_graph_set_hash() may take a lot of time to execute. This may trigger the softlockup watchdog. Add cond_resched() within the loop to allow the kernel to remain responsive even when processing a large number of functions. This matches the cond_resched() that is used in other locations of the code that iterates over all functions that can be traced. Cc: stable@vger.kernel.org Fixes: b9b0c83 ("ftrace: Convert graph filter to use hash tables") Link: https://lore.kernel.org/tencent_3E06CE338692017B5809534B9C5C03DA7705@qq.com Signed-off-by: zhoumin <teczm@foxmail.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
1 parent f93c95e commit a0d8dbb

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

kernel/trace/ftrace.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6848,6 +6848,7 @@ ftrace_graph_set_hash(struct ftrace_hash *hash, char *buffer)
68486848
}
68496849
}
68506850
}
6851+
cond_resched();
68516852
} while_for_each_ftrace_rec();
68526853
out:
68536854
mutex_unlock(&ftrace_lock);

0 commit comments

Comments
 (0)