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 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
|
# recvmmsg ___________________________________________________
#
# long sys_recvmmsg(int fd, struct mmsghdr __user *mmsg,
# unsigned int vlen, unsigned int flags,
# struct timespec __user *timeout)
#
@define _SYSCALL_RECVMMSG_NAME
%(
name = "recvmmsg"
%)
@define _SYSCALL_RECVMMSG_ARGSTR
%(
argstr = sprintf("%d, %p, %u, %s, %s", s, mmsg_uaddr, vlen, flags_str, timeout_str)
%)
@define _SYSCALL_RECVMMSG_REGARGS
%(
s = int_arg(1)
mmsg_uaddr = pointer_arg(2)
vlen = uint_arg(3)
flags = uint_arg(4)
flags_str = _msg_flags_str(flags)
timeout_uaddr = pointer_arg(5)
%)
probe syscall.recvmmsg = dw_syscall.recvmmsg !, nd_syscall.recvmmsg ? {}
probe syscall.recvmmsg.return = dw_syscall.recvmmsg.return !,
nd_syscall.recvmmsg.return ? {}
# dw_recvmmsg _____________________________________________________
probe dw_syscall.recvmmsg = kernel.function("sys_recvmmsg").call ?
{
@_SYSCALL_RECVMMSG_NAME
s = __int32($fd)
mmsg_uaddr = $mmsg
vlen = __uint32($vlen)
flags = __uint32($flags)
flags_str = _msg_flags_str(flags)
timeout_uaddr = $timeout
timeout_str = _struct_timespec_u(timeout_uaddr, 1)
@_SYSCALL_RECVMMSG_ARGSTR
}
probe dw_syscall.recvmmsg.return = kernel.function("sys_recvmmsg").return ?
{
@_SYSCALL_RECVMMSG_NAME
@SYSC_RETVALSTR($return)
}
# nd_recvmmsg _____________________________________________________
probe nd_syscall.recvmmsg = nd1_syscall.recvmmsg!, nd2_syscall.recvmmsg!, tp_syscall.recvmmsg
{ }
probe nd1_syscall.recvmmsg = kprobe.function("sys_recvmmsg").call ?
{
@_SYSCALL_RECVMMSG_NAME
asmlinkage()
@_SYSCALL_RECVMMSG_REGARGS
timeout_str = _struct_timespec_u(timeout_uaddr, 1)
@_SYSCALL_RECVMMSG_ARGSTR
}
/* kernel 4.17+ */
probe nd2_syscall.recvmmsg = kprobe.function(@arch_syscall_prefix "sys_recvmmsg").call ?
{
__set_syscall_pt_regs(pointer_arg(1))
@_SYSCALL_RECVMMSG_NAME
@_SYSCALL_RECVMMSG_REGARGS
timeout_str = _struct_timespec_u(timeout_uaddr, 1)
@_SYSCALL_RECVMMSG_ARGSTR
}
/* kernel 3.5+, but undesirable because it affects all syscalls */
probe tp_syscall.recvmmsg = kernel.trace("sys_enter")
{
__set_syscall_pt_regs($regs)
@__syscall_gate(@const("__NR_recvmmsg"))
@_SYSCALL_RECVMMSG_NAME
@_SYSCALL_RECVMMSG_REGARGS
timeout_str = _struct_timespec_u(timeout_uaddr, 1)
@_SYSCALL_RECVMMSG_ARGSTR
}
probe nd_syscall.recvmmsg.return = nd1_syscall.recvmmsg.return!, nd2_syscall.recvmmsg.return!, tp_syscall.recvmmsg.return
{ }
probe nd1_syscall.recvmmsg.return = kprobe.function("sys_recvmmsg").return ?
{
@_SYSCALL_RECVMMSG_NAME
@SYSC_RETVALSTR(returnval())
}
/* kernel 4.17+ */
probe nd2_syscall.recvmmsg.return = kprobe.function(@arch_syscall_prefix "sys_recvmmsg").return ?
{
@_SYSCALL_RECVMMSG_NAME
@SYSC_RETVALSTR(returnval())
}
/* kernel 3.5+, but undesirable because it affects all syscalls */
probe tp_syscall.recvmmsg.return = kernel.trace("sys_exit")
{
__set_syscall_pt_regs($regs)
@__syscall_gate(@const("__NR_recvmmsg"))
@_SYSCALL_RECVMMSG_NAME
@SYSC_RETVALSTR($ret)
}
# compat_recvmmsg ___________________________________________________
#
# long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
# unsigned vlen, unsigned int flags,
# struct compat_timespec __user *timeout)
#
probe syscall.compat_recvmmsg = dw_syscall.compat_recvmmsg !,
nd_syscall.compat_recvmmsg ? {}
probe syscall.compat_recvmmsg.return = dw_syscall.compat_recvmmsg.return !,
nd_syscall.compat_recvmmsg.return ? {}
# dw_compat_recvmmsg _____________________________________________________
probe dw_syscall.compat_recvmmsg = kernel.function("compat_sys_recvmmsg").call ?
{
@_SYSCALL_RECVMMSG_NAME
s = __int32($fd)
mmsg_uaddr = $mmsg
vlen = __uint32($vlen)
flags = __uint32($flags)
flags_str = _msg_flags_str(flags)
timeout_uaddr = $timeout
timeout_str = _struct_compat_timespec_u(timeout_uaddr, 1)
@_SYSCALL_RECVMMSG_ARGSTR
}
probe dw_syscall.compat_recvmmsg.return =
kernel.function("compat_sys_recvmmsg").return ?
{
@_SYSCALL_RECVMMSG_NAME
@SYSC_RETVALSTR($return)
}
# nd_compat_recvmmsg _____________________________________________________
probe nd_syscall.compat_recvmmsg = nd1_syscall.compat_recvmmsg!, nd2_syscall.compat_recvmmsg!, tp_syscall.compat_recvmmsg
{ }
probe nd1_syscall.compat_recvmmsg = kprobe.function("compat_sys_recvmmsg").call ?
{
@_SYSCALL_RECVMMSG_NAME
asmlinkage()
@_SYSCALL_RECVMMSG_REGARGS
timeout_str = _struct_compat_timespec_u(timeout_uaddr, 1)
@_SYSCALL_RECVMMSG_ARGSTR
}
/* kernel 4.17+ */
probe nd2_syscall.compat_recvmmsg = kprobe.function(@arch_syscall_prefix "compat_sys_recvmmsg").call ?
{
__set_syscall_pt_regs(pointer_arg(1))
@_SYSCALL_RECVMMSG_NAME
@_SYSCALL_RECVMMSG_REGARGS
timeout_str = _struct_compat_timespec_u(timeout_uaddr, 1)
@_SYSCALL_RECVMMSG_ARGSTR
}
/* kernel 3.5+, but undesirable because it affects all syscalls */
probe tp_syscall.compat_recvmmsg = kernel.trace("sys_enter")
{
__set_syscall_pt_regs($regs)
@__compat_syscall_gate(@const("__NR_compat_recvmmsg"))
@_SYSCALL_RECVMMSG_NAME
@_SYSCALL_RECVMMSG_REGARGS
timeout_str = _struct_compat_timespec_u(timeout_uaddr, 1)
@_SYSCALL_RECVMMSG_ARGSTR
}
probe nd_syscall.compat_recvmmsg.return = nd1_syscall.compat_recvmmsg.return!, nd2_syscall.compat_recvmmsg.return!, tp_syscall.compat_recvmmsg.return
{ }
probe nd1_syscall.compat_recvmmsg.return =
kprobe.function("compat_sys_recvmmsg").return ?
{
@_SYSCALL_RECVMMSG_NAME
@SYSC_RETVALSTR(returnval())
}
/* kernel 4.17+ */
probe nd2_syscall.compat_recvmmsg.return = kprobe.function(@arch_syscall_prefix "compat_sys_recvmmsg").return ?
{
@_SYSCALL_RECVMMSG_NAME
@SYSC_RETVALSTR(returnval())
}
/* kernel 3.5+, but undesirable because it affects all syscalls */
probe tp_syscall.compat_recvmmsg.return = kernel.trace("sys_exit")
{
__set_syscall_pt_regs($regs)
@__compat_syscall_gate(@const("__NR_compat_recvmmsg"))
@_SYSCALL_RECVMMSG_NAME
@SYSC_RETVALSTR($ret)
}
|