linux_kernel_hacking icon indicating copy to clipboard operation
linux_kernel_hacking copied to clipboard

code fix in ftrace_helper.h

Open ido-shmuel opened this issue 1 year ago • 0 comments

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`

ido-shmuel avatar Apr 10 '23 11:04 ido-shmuel