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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
# epoll_pwait _________________________________________________
#
# long sys_epoll_pwait(int epfd, struct epoll_event __user *events,
# int maxevents, int timeout, const sigset_t __user *sigmask,
# size_t sigsetsize)
# long compat_sys_epoll_pwait(int epfd,
# struct compat_epoll_event __user *events,
# int maxevents, int timeout,
# const compat_sigset_t __user *sigmask,
# compat_size_t sigsetsize)
#
@define _SYSCALL_EPOLL_PWAIT_NAME
%(
name = "epoll_pwait"
%)
@define _SYSCALL_EPOLL_PWAIT_ARGSTR
%(
argstr = sprintf("%d, %p, %d, %d, %p, %d", epfd, events_uaddr, maxevents,
timeout, sigmask_uaddr, sigsetsize)
%)
@define _SYSCALL_EPOLL_PWAIT_REGARGS
%(
epfd = int_arg(1)
events_uaddr = pointer_arg(2)
maxevents = int_arg(3)
timeout = int_arg(4)
sigmask_uaddr = pointer_arg(5)
sigsetsize = ulong_arg(6)
%)
@define _SYSCALL_EPOLL_PWAIT_REGARGS_STORE
%(
if (@probewrite(epfd))
set_int_arg(1, epfd)
if (@probewrite(events_uaddr))
set_pointer_arg(2, events_uaddr)
if (@probewrite(maxevents))
set_int_arg(3, maxevents)
if (@probewrite(timeout))
set_int_arg(4, timeout)
if (@probewrite(sigmask_uaddr))
set_pointer_arg(5, sigmask_uaddr)
if (@probewrite(sigsetsize))
set_ulong_arg(6, sigsetsize)
%)
probe syscall.epoll_pwait = dw_syscall.epoll_pwait !, nd_syscall.epoll_pwait ? {}
probe syscall.epoll_pwait.return = dw_syscall.epoll_pwait.return !, nd_syscall.epoll_pwait.return ? {}
# dw_epoll_pwait _____________________________________________________
probe dw_syscall.epoll_pwait = kernel.function("compat_sys_epoll_pwait").call ?,
kernel.function("sys_epoll_pwait").call ?
{
@_SYSCALL_EPOLL_PWAIT_NAME
epfd = __int32($epfd)
events_uaddr = @__pointer($events)
maxevents = __int32($maxevents)
timeout = __int32($timeout)
sigmask_uaddr = @__pointer($sigmask)
sigsetsize = $sigsetsize
@_SYSCALL_EPOLL_PWAIT_ARGSTR
}
probe dw_syscall.epoll_pwait.return = kernel.function("compat_sys_epoll_pwait").return ?,
kernel.function("sys_epoll_pwait").return ?
{
@_SYSCALL_EPOLL_PWAIT_NAME
@SYSC_RETVALSTR($return)
}
# nd_epoll_pwait _____________________________________________________
probe nd_syscall.epoll_pwait = nd1_syscall.epoll_pwait!, nd2_syscall.epoll_pwait!, tp_syscall.epoll_pwait
{ }
probe nd1_syscall.epoll_pwait = kprobe.function("compat_sys_epoll_pwait") ?,
kprobe.function("sys_epoll_pwait") ?
{
@_SYSCALL_EPOLL_PWAIT_NAME
asmlinkage()
@_SYSCALL_EPOLL_PWAIT_REGARGS
@_SYSCALL_EPOLL_PWAIT_ARGSTR
}
/* kernel 4.17+ */
probe nd2_syscall.epoll_pwait = kprobe.function(@arch_syscall_prefix "sys_epoll_pwait") ?
{
__set_syscall_pt_regs(pointer_arg(1))
@_SYSCALL_EPOLL_PWAIT_NAME
@_SYSCALL_EPOLL_PWAIT_REGARGS
@_SYSCALL_EPOLL_PWAIT_ARGSTR
},
{
%( @_IS_SREG_KERNEL %? @_SYSCALL_EPOLL_PWAIT_REGARGS_STORE %)
}
/* kernel 3.5+, but undesirable because it affects all syscalls */
probe tp_syscall.epoll_pwait = kernel.trace("sys_enter")
{
__set_syscall_pt_regs($regs)
@__syscall_compat_gate(@const("__NR_epoll_pwait"), @const("__NR_compat_epoll_pwait"))
@_SYSCALL_EPOLL_PWAIT_NAME
@_SYSCALL_EPOLL_PWAIT_REGARGS
@_SYSCALL_EPOLL_PWAIT_ARGSTR
},
{
%( @_IS_SREG_KERNEL %? @_SYSCALL_EPOLL_PWAIT_REGARGS_STORE %)
}
probe nd_syscall.epoll_pwait.return = nd1_syscall.epoll_pwait.return!, nd2_syscall.epoll_pwait.return!, tp_syscall.epoll_pwait.return
{ }
probe nd1_syscall.epoll_pwait.return =
kprobe.function("compat_sys_epoll_pwait").return ?,
kprobe.function("sys_epoll_pwait").return ?
{
@_SYSCALL_EPOLL_PWAIT_NAME
@SYSC_RETVALSTR(returnval())
}
/* kernel 4.17+ */
probe nd2_syscall.epoll_pwait.return = kprobe.function(@arch_syscall_prefix "sys_epoll_pwait").return ?
{
@_SYSCALL_EPOLL_PWAIT_NAME
@SYSC_RETVALSTR(returnval())
}
/* kernel 3.5+, but undesirable because it affects all syscalls */
probe tp_syscall.epoll_pwait.return = kernel.trace("sys_exit")
{
__set_syscall_pt_regs($regs)
@__syscall_compat_gate(@const("__NR_epoll_pwait"), @const("__NR_compat_epoll_pwait"))
@_SYSCALL_EPOLL_PWAIT_NAME
@SYSC_RETVALSTR($ret)
}
|