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
|
# pwritev ___________________________________________________
#
# sys_pwritev(unsigned long fd, const struct iovec __user * vec,
# unsigned long vlen, unsigned long pos_l, unsigned long pos_h)
# compat_sys_pwritev(unsigned long fd, const struct compat_iovec __user *vec,
# unsigned long vlen, u32 pos_low, u32 pos_high)
#
@define _SYSCALL_PWRITEV_NAME
%(
name = "pwritev"
%)
@define _SYSCALL_PWRITEV_ARGSTR
%(
argstr = sprintf("%d, %p, %d, 0x%x", fd, vector_uaddr, count, offset)
%)
@define _SYSCALL_PWRITEV_REGARGS
%(
fd = int_arg(1)
vector_uaddr = pointer_arg(2)
count = int_arg(3)
offset = @__pos_from_hilo(ulong_arg(5), ulong_arg(4))
%)
@define _SYSCALL_COMPAT_PWRITEV_REGARGS
%(
fd = int_arg(1)
vector_uaddr = pointer_arg(2)
count = int_arg(3)
offset = (u32_arg(5) << 32) + u32_arg(4)
%)
probe syscall.pwritev = dw_syscall.pwritev !, nd_syscall.pwritev ? {}
probe syscall.pwritev.return = dw_syscall.pwritev.return !,
nd_syscall.pwritev.return ? {}
# dw_pwritev _____________________________________________________
probe dw_syscall.pwritev = __syscall.pwritev ?, __syscall.compat_pwritev ?
{
@_SYSCALL_PWRITEV_NAME
}
probe __syscall.pwritev = kernel.function("sys_pwritev").call
{
fd = __int32($fd)
vector_uaddr = $vec
count = __int32($vlen)
offset = @__pos_from_hilo($pos_h, $pos_l)
@_SYSCALL_PWRITEV_ARGSTR
}
probe __syscall.compat_pwritev = kernel.function("compat_sys_pwritev").call
{
fd = __int32($fd)
vector_uaddr = $vec
count = __int32($vlen)
offset = ($pos_high << 32) + __uint32($pos_low)
@_SYSCALL_PWRITEV_ARGSTR
}
probe dw_syscall.pwritev.return = kernel.function("sys_pwritev").return ?,
kernel.function("compat_sys_pwritev").return ?
{
@_SYSCALL_PWRITEV_NAME
@SYSC_RETVALSTR($return)
}
# nd_pwritev _____________________________________________________
probe nd_syscall.pwritev = nd1_syscall.pwritev!, nd2_syscall.pwritev!, tp_syscall.pwritev
{ }
probe nd1_syscall.pwritev = __nd1_syscall.pwritev ?,
__nd1_syscall.compat_pwritev ?
{
@_SYSCALL_PWRITEV_NAME
}
probe __nd1_syscall.pwritev = kprobe.function("sys_pwritev").call
{
asmlinkage()
@_SYSCALL_PWRITEV_REGARGS
@_SYSCALL_PWRITEV_ARGSTR
}
probe __nd1_syscall.compat_pwritev = kprobe.function("compat_sys_pwritev").call
{
asmlinkage()
@_SYSCALL_COMPAT_PWRITEV_REGARGS
@_SYSCALL_PWRITEV_ARGSTR
}
/* kernel 4.17+ */
probe nd2_syscall.pwritev = __nd2_syscall.pwritev ?,
__nd2_syscall.compat_pwritev ?
{
@_SYSCALL_PWRITEV_NAME
}
probe __nd2_syscall.pwritev = kprobe.function(@arch_syscall_prefix "sys_pwritev").call
{
__set_syscall_pt_regs(pointer_arg(1))
@_SYSCALL_PWRITEV_REGARGS
@_SYSCALL_PWRITEV_ARGSTR
}
probe __nd2_syscall.compat_pwritev = kprobe.function(@arch_syscall_prefix "compat_sys_pwritev").call
{
__set_syscall_pt_regs(pointer_arg(1))
@_SYSCALL_COMPAT_PWRITEV_REGARGS
@_SYSCALL_PWRITEV_ARGSTR
}
/* kernel 3.5+, but undesirable because it affects all syscalls */
probe tp_syscall.pwritev = __tp_syscall.pwritev ?,
__tp_syscall.compat_pwritev ?
{
@_SYSCALL_PWRITEV_NAME
}
probe __tp_syscall.pwritev = kernel.trace("sys_enter")
{
__set_syscall_pt_regs($regs)
@__syscall_gate(@const("__NR_pwritev"))
@_SYSCALL_PWRITEV_REGARGS
@_SYSCALL_PWRITEV_ARGSTR
}
probe __tp_syscall.compat_pwritev = kernel.trace("sys_enter")
{
__set_syscall_pt_regs($regs)
@__compat_syscall_gate(@const("__NR_compat_pwritev"))
@_SYSCALL_COMPAT_PWRITEV_REGARGS
@_SYSCALL_PWRITEV_ARGSTR
}
probe nd_syscall.pwritev.return = nd1_syscall.pwritev.return!, nd2_syscall.pwritev.return!, tp_syscall.pwritev.return
{ }
probe nd1_syscall.pwritev.return =
kprobe.function("sys_pwritev").return ?,
kprobe.function("compat_sys_pwritev").return ?
{
@_SYSCALL_PWRITEV_NAME
@SYSC_RETVALSTR(returnval())
}
/* kernel 4.17+ */
probe nd2_syscall.pwritev.return =
kprobe.function(@arch_syscall_prefix "sys_pwritev").return ?,
kprobe.function(@arch_syscall_prefix "compat_sys_pwritev").return ?
{
@_SYSCALL_PWRITEV_NAME
@SYSC_RETVALSTR(returnval())
}
/* kernel 3.5+, but undesirable because it affects all syscalls */
probe tp_syscall.pwritev.return = kernel.trace("sys_exit")
{
__set_syscall_pt_regs($regs)
@__syscall_compat_gate(@const("__NR_pwritev"), @const("__NR_compat_pwritev"))
@_SYSCALL_PWRITEV_NAME
@SYSC_RETVALSTR($ret)
}
|