klp_enable_patch + klp_init_patch + if (patch->replace) klp_add_nops(patch); <<<< set all old patches to nop + __klp_enable_patch + klp_patch_object + klp_patch_func + ops = klp_find_ops(func->old_func); + if (ops) // add the new patch to the func_stack list list_add_rcu(&func->stack_node, &ops->func_stack); klp_ftrace_handler + func = list_first_or_null_rcu(&ops->func_stack, struct klp_func + if (func->nop) goto unlock; + ftrace_regs_set_instruction_pointer(fregs, (unsigned long)func->new_func); Before the new atomic replace patch is added to the func_stack list, the old patch is already set to nop. If klp_ftrace_handler() is triggered at this point, it will effectively do nothingâ??in other words, it will execute the original function. I might be wrong. -- Regards Yafang