Re: [mainline]Kernel crash while running ftrace selftest

From: Venkat Rao Bagalkote
Date: Wed Apr 16 2025 - 13:06:30 EST



On 16/04/25 8:32 pm, Steven Rostedt wrote:
On Wed, 16 Apr 2025 12:37:15 +0530
Venkat Rao Bagalkote <venkat88@xxxxxxxxxxxxx> wrote:


Thanks for the bug report!

[15137.589546] NIP [c0000000003e4738] ops_equal+0x8/0x170
[15137.589553] LR [c0000000003ec708] ftrace_update_ops+0x78/0xe0
Hmm, I'm guessing that you hit a path where the filter_hash or
notrace_hash never was initialized.

[15137.589561] Call Trace:
[15137.589564] [c00000001473f9c0] [c0000000003ec6ec]
ftrace_update_ops+0x5c/0xe0 (unreliable)
[15137.589575] [c00000001473fa00] [c0000000003f31b4]
ftrace_startup_subops+0x124/0x5c0
[15137.589583] [c00000001473faa0] [c
Can you see if this fixes the issue for you?

Thanks!

-- Steve

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index a8a02868b435..777574fa3095 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -3625,8 +3625,8 @@ static int rebuild_hashes(struct ftrace_hash **filter_hash, struct ftrace_hash *
*/
int ftrace_shutdown_subops(struct ftrace_ops *ops, struct ftrace_ops *subops, int command)
{
- struct ftrace_hash *filter_hash;
- struct ftrace_hash *notrace_hash;
+ struct ftrace_hash *filter_hash = EMPTY_HASH;
+ struct ftrace_hash *notrace_hash = EMPTY_HASH;
int ret;
if (unlikely(ftrace_disabled))


Hello Steve,

Issue still persists with the above patch.


Regards,

Venkat.