Skip to content

Commit

Permalink
inhibit some sections of code that breaks when rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
nickchen120235 committed Nov 22, 2022
1 parent 6626ce8 commit 7486076
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/syscall-ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ typedef struct ftrace_hook {
struct ftrace_ops ops; // ftrace structure
} ftrace_hook_t;

// clang-format off
#define PREPARE_HOOK(_nr, _hook, _orig) \
{ \
.nr = (_nr), .new = (_hook), .orig = (_orig) \
}

unsigned long **sys_call_table;
// clang-format on

/**
* For the sake of simplicity, only the kprobe method is included.
Expand Down Expand Up @@ -184,10 +186,12 @@ static asmlinkage long our_sys_openat(struct pt_regs *regs)
* Change regs->si to appropriate registers
* if you are trying on different architecture.
*/
// clang-format off
if (copy_from_user(kfilename, (char __user *)regs->si, MAX_FILENAME_SIZE) < 0) {
kfree(kfilename);
return original_call(regs);
}
// clang-format on

pr_info("[syscall-ftrace] File opened by UID %d: %s\n", uid, kfilename);
kfree(kfilename);
Expand Down

0 comments on commit 7486076

Please sign in to comment.