linux_kernel_hacking
linux_kernel_hacking copied to clipboard
code fix in ftrace_helper.h
in later versions, this section of code that in ftrace_helper.h won't compile `static void notrace fh_ftrace_thunk(unsigned long ip, unsigned long parent_ip, struct ftrace_ops *ops, struct pt_regs *regs) { struct ftrace_hook *hook = container_of(ops, struct ftrace_hook, ops);
#if USE_FENTRY_OFFSET regs->ip = (unsigned long) hook->function; #else if(!within_module(parent_ip, THIS_MODULE)) regs->ip = (unsigned long) hook->function; #endif }`
her is the fix
`static void notrace fh_ftrace_thunk(unsigned long ip, unsigned long parent_ip, struct ftrace_ops *ops, struct ftrace_regs *fregs) { struct pt_regs *regs = ftrace_get_regs(fregs); struct ftrace_hook *hook = container_of(ops, struct ftrace_hook, ops);
#if USE_FENTRY_OFFSET regs->ip = (unsigned long)hook->function; #else if (!within_module(parent_ip, THIS_MODULE)) regs->ip = (unsigned long)hook->function; #endif`