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
|
# readahead __________________________________________________
#
# asmlinkage ssize_t
# sys_readahead(int fd,
# loff_t offset,
# size_t count)
#
@define _SYSCALL_READAHEAD_NAME
%(
name = "readahead"
%)
@define _SYSCALL_READAHEAD_ARGSTR
%(
argstr = sprintf("%d, %d, %u", fd, offset, count)
%)
@define _SYSCALL_READAHEAD_REGARGS_STORE
%(
if (@probewrite(fd))
set_int_arg(1, fd)
%( CONFIG_64BIT == "y" %?
if (@probewrite(offset))
set_longlong_arg(2, offset)
if (@probewrite(count))
set_ulong_arg(3, count)
%:
if (@probewrite(offset))
set_longlong_arg(2, offset)
if (@probewrite(count))
set_ulong_arg(4, count)
%)
%)
probe syscall.readahead = dw_syscall.readahead !, nd_syscall.readahead ? {}
probe syscall.readahead.return = dw_syscall.readahead.return !,
nd_syscall.readahead.return ? {}
# dw_readahead _____________________________________________________
probe dw_syscall.readahead = kernel.function("sys_readahead").call
{
@__syscall_gate_compat_simple
@_SYSCALL_READAHEAD_NAME
fd = __int32($fd)
offset = $offset
%( CONFIG_64BIT == "y" %?
count = $count
%:
count = __uint32($count)
%)
@_SYSCALL_READAHEAD_ARGSTR
}
probe dw_syscall.readahead.return = kernel.function("sys_readahead").return
{
@__syscall_gate_compat_simple
@_SYSCALL_READAHEAD_NAME
@SYSC_RETVALSTR($return)
}
# nd_readahead _____________________________________________________
probe nd_syscall.readahead = nd1_syscall.readahead!, nd2_syscall.readahead!, tp_syscall.readahead
{ }
probe nd1_syscall.readahead = kprobe.function("sys_readahead") ?
{
@__syscall_gate_compat_simple
@_SYSCALL_READAHEAD_NAME
asmlinkage()
fd = int_arg(1)
%( CONFIG_64BIT == "y" %?
offset = longlong_arg(2)
count = ulong_arg(3)
%:
%( arch == "arm" %?
# arm has some odd rules regarding long long arguments.
offset = longlong_arg(3)
count = ulong_arg(5)
%:
# On a 32-bit kernel, 'long long' arguments take the space of
# 2 arguments, so we have to adjust the following argument
# numbers.
offset = longlong_arg(2)
count = ulong_arg(4)
%)
%)
@_SYSCALL_READAHEAD_ARGSTR
}
/* kernel 4.17+ */
probe nd2_syscall.readahead = kprobe.function(@arch_syscall_prefix "sys_readahead") ?
{
__set_syscall_pt_regs(pointer_arg(1))
@_SYSCALL_READAHEAD_NAME
fd = int_arg(1)
offset = longlong_arg(2)
count = ulong_arg(3)
@_SYSCALL_READAHEAD_ARGSTR
},
{
%( @_IS_SREG_KERNEL %? @_SYSCALL_READAHEAD_REGARGS_STORE %)
}
/* kernel 3.5+, but undesirable because it affects all syscalls */
probe tp_syscall.readahead = kernel.trace("sys_enter")
{
__set_syscall_pt_regs($regs)
@__syscall_gate(@const("__NR_readahead"))
@_SYSCALL_READAHEAD_NAME
fd = int_arg(1)
offset = longlong_arg(2)
count = ulong_arg(3)
@_SYSCALL_READAHEAD_ARGSTR
},
{
%( @_IS_SREG_KERNEL %? @_SYSCALL_READAHEAD_REGARGS_STORE %)
}
probe nd_syscall.readahead.return = nd1_syscall.readahead.return!, nd2_syscall.readahead.return!, tp_syscall.readahead.return
{ }
probe nd1_syscall.readahead.return = kprobe.function("sys_readahead").return ?
{
@__syscall_gate_compat_simple
@_SYSCALL_READAHEAD_NAME
@SYSC_RETVALSTR(returnval())
}
/* kernel 4.17+ */
probe nd2_syscall.readahead.return = kprobe.function(@arch_syscall_prefix "sys_readahead").return ?
{
@_SYSCALL_READAHEAD_NAME
@SYSC_RETVALSTR(returnval())
}
/* kernel 3.5+, but undesirable because it affects all syscalls */
probe tp_syscall.readahead.return = kernel.trace("sys_exit")
{
__set_syscall_pt_regs($regs)
@__syscall_gate(@const("__NR_readahead"))
@_SYSCALL_READAHEAD_NAME
@SYSC_RETVALSTR($ret)
}
|