Skip to content

syscall hook demo  #87

@w296488320

Description

@w296488320

Can you provide an annotated, detailed syscall hook demo?
In syscall-hook.md is a blank file, and can I use hook_wrap3 to do hook syscall? The code is similar to that of the one as follows.

orig_readlinkat = (typeof(orig_readlinkat))kallsyms_lookup_name("sys_readlinkat");
    if (!orig_readlinkat) {
        pr_err("runtime_kpm: failed to get sys_readlinkat address\n");
        return;
    }
    hook_err_t err = hook_wrap3((void *)orig_readlinkat, 0, new_readlinkat, 0);
    if (err) {
        pr_err("runtime_kpm: hooking readlinkat error: %d\n", err);
        return;
    }
    pr_info("runtime_kpm: readlinkat syscall hooked successfully\n");

What I don't quite understand is some difference between fp _ hook _ syscalln and hook_wrap3, better if you could write the difference in the method header file or some more notes in the demo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions