1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
# fchdir _____________________________________________________
# long sys_fchdir(unsigned int fd)
@define _SYSCALL_FCHDIR_NAME
%(
name = "fchdir"
%)
@define _SYSCALL_FCHDIR_ARGSTR
%(
argstr = sprint(fd)
%)
@define _SYSCALL_FCHDIR_REGARGS
%(
fd = int_arg(1)
%)
probe syscall.fchdir = dw_syscall.fchdir !, nd_syscall.fchdir ? {}
probe syscall.fchdir.return = dw_syscall.fchdir.return !, nd_syscall.fchdir.return ? {}
# dw_fchdir _____________________________________________________
probe dw_syscall.fchdir = kernel.function("sys_fchdir").call
{
@_SYSCALL_FCHDIR_NAME
fd = __int32($fd)
@_SYSCALL_FCHDIR_ARGSTR
}
probe dw_syscall.fchdir.return = kernel.function("sys_fchdir").return
{
@_SYSCALL_FCHDIR_NAME
@SYSC_RETVALSTR($return)
}
# nd_fchdir _____________________________________________________
probe nd_syscall.fchdir = nd1_syscall.fchdir!, nd2_syscall.fchdir!, tp_syscall.fchdir
{ }
probe nd1_syscall.fchdir = kprobe.function("sys_fchdir") ?
{
@_SYSCALL_FCHDIR_NAME
asmlinkage()
@_SYSCALL_FCHDIR_REGARGS
@_SYSCALL_FCHDIR_ARGSTR
}
/* kernel 4.17+ */
probe nd2_syscall.fchdir = kprobe.function(@arch_syscall_prefix "sys_fchdir")
{
__set_syscall_pt_regs(pointer_arg(1))
@_SYSCALL_FCHDIR_NAME
@_SYSCALL_FCHDIR_REGARGS
@_SYSCALL_FCHDIR_ARGSTR
}
/* kernel 3.5+, but undesirable because it affects all syscalls */
probe tp_syscall.fchdir = kernel.trace("sys_enter")
{
__set_syscall_pt_regs($regs)
@__syscall_compat_gate(@const("__NR_fchdir"), @const("__NR_compat_fchdir"))
@_SYSCALL_FCHDIR_NAME
@_SYSCALL_FCHDIR_REGARGS
@_SYSCALL_FCHDIR_ARGSTR
}
probe nd_syscall.fchdir.return = nd1_syscall.fchdir.return!, nd2_syscall.fchdir.return!, tp_syscall.fchdir.return
{ }
probe nd1_syscall.fchdir.return = kprobe.function("sys_fchdir").return ?
{
@_SYSCALL_FCHDIR_NAME
@SYSC_RETVALSTR(returnval())
}
/* kernel 4.17+ */
probe nd2_syscall.fchdir.return = kprobe.function(@arch_syscall_prefix "sys_fchdir").return
{
@_SYSCALL_FCHDIR_NAME
@SYSC_RETVALSTR(returnval())
}
/* kernel 3.5+, but undesirable because it affects all syscalls */
probe tp_syscall.fchdir.return = kernel.trace("sys_exit")
{
__set_syscall_pt_regs($regs)
@__syscall_compat_gate(@const("__NR_fchdir"), @const("__NR_compat_fchdir"))
@_SYSCALL_FCHDIR_NAME
@SYSC_RETVALSTR($ret)
}
|