Skip to content

Commit 196717f

Browse files
committed
powerpc/ftrace: ensure ftrace record ops are always set for NOPs
JIRA: https://issues.redhat.com/browse/RHEL-113085 commit 5337609 Author: Joe Lawrence <joe.lawrence@redhat.com> Date: Fri Sep 12 10:27:38 2025 -0400 powerpc/ftrace: ensure ftrace record ops are always set for NOPs When an ftrace call site is converted to a NOP, its corresponding dyn_ftrace record should have its ftrace_ops pointer set to ftrace_nop_ops. Correct the powerpc implementation to ensure the ftrace_rec_set_nop_ops() helper is called on all successful NOP initialization paths. This ensures all ftrace records are consistent before being handled by the ftrace core. Fixes: eec3796 ("powerpc64/ftrace: Move ftrace sequence out of line") Suggested-by: Naveen N Rao <naveen@kernel.org> Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com> Acked-by: Naveen N Rao (AMD) <naveen@kernel.org> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/20250912142740.3581368-2-joe.lawrence@redhat.com Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
1 parent 3e7b609 commit 196717f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

arch/powerpc/kernel/trace/ftrace.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,10 @@ int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec)
490490
return ret;
491491

492492
/* Set up out-of-line stub */
493-
if (IS_ENABLED(CONFIG_PPC_FTRACE_OUT_OF_LINE))
494-
return ftrace_init_ool_stub(mod, rec);
493+
if (IS_ENABLED(CONFIG_PPC_FTRACE_OUT_OF_LINE)) {
494+
ret = ftrace_init_ool_stub(mod, rec);
495+
goto out;
496+
}
495497

496498
/* Nop-out the ftrace location */
497499
new = ppc_inst(PPC_RAW_NOP());
@@ -522,6 +524,10 @@ int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec)
522524
return -EINVAL;
523525
}
524526

527+
out:
528+
if (!ret)
529+
ret = ftrace_rec_set_nop_ops(rec);
530+
525531
return ret;
526532
}
527533

0 commit comments

Comments
 (0)