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
|
# fanotify_mark ______________________________________________
# fanotify_mark() was enabled in kernel version 2.6.37.
#
# SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags,
# __u64, mask, int, dfd,
# const char __user *, pathname)
# COMPAT_SYSCALL_DEFINE6(fanotify_mark,
# int, fanotify_fd, unsigned int, flags,
# __u32, mask0, __u32, mask1, int, dfd,
# const char __user *, pathname)
@define _SYSCALL_FANOTIFY_MARK_NAME
%(
name = "fanotify_mark"
%)
@define _SYSCALL_FANOTIFY_MARK_ARGSTR
%(
argstr = sprintf("%d, %s, %s, %s, %s", fanotify_fd, flags_str, mask_str,
dirfd_str, pathname)
%)
@define _SYSCALL_FANOTIFY_MARK_REGARGS
%(
fanotify_fd = int_arg(1)
flags = uint_arg(2)
%( CONFIG_64BIT == "y" %?
mask = ulonglong_arg(3)
dirfd = int_arg(4)
pathname = user_string_quoted(pointer_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.
mask = ulonglong_arg(3)
dirfd = int_arg(5)
pathname = user_string_quoted(pointer_arg(6))
%)
%)
@define _SYSCALL_COMPAT_FANOTIFY_MARK_REGARGS
%(
fanotify_fd = int_arg(1)
flags = uint_arg(2)
if (@__BIG_ENDIAN)
mask = ((uint_arg(3) << 32) | uint_arg(4))
else
mask = ((uint_arg(4) << 32) | uint_arg(3))
dirfd = int_arg(5)
pathname = user_string_quoted(pointer_arg(6))
%)
probe syscall.fanotify_mark = dw_syscall.fanotify_mark !, nd_syscall.fanotify_mark ? {}
probe syscall.fanotify_mark.return = dw_syscall.fanotify_mark.return !, nd_syscall.fanotify_mark.return ? {}
# dw_fanotify_mark _____________________________________________________
probe dw_syscall.fanotify_mark = __syscall.fanotify_mark ?,
__syscall.compat_fanotify_mark ?
{
@_SYSCALL_FANOTIFY_MARK_NAME
flags_str = _fanotify_mark_flags_str(flags)
mask_str = _fanotify_mark_mask_str(mask)
dirfd_str = _dfd_str(dirfd)
@_SYSCALL_FANOTIFY_MARK_ARGSTR
}
probe __syscall.fanotify_mark = kernel.function("sys_fanotify_mark").call ?
{
@__syscall_gate_compat_simple
fanotify_fd = __int32($fanotify_fd)
flags = __uint32($flags)
mask = $mask
dirfd = __int32($dfd)
pathname = user_string_quoted(@__pointer($pathname))
}
probe __syscall.compat_fanotify_mark =
kernel.function("compat_sys_fanotify_mark").call ?
{
fanotify_fd = __int32($fanotify_fd)
flags = __uint32($flags)
if (@__BIG_ENDIAN)
mask = ((__uint32($mask0) << 32) | __uint32($mask1))
else
mask = ((__uint32($mask1) << 32) | __uint32($mask0))
dirfd = __int32($dfd)
pathname = user_string_quoted(@__pointer($pathname))
}
probe dw_syscall.fanotify_mark.return =
kernel.function("sys_fanotify_mark").return ?,
kernel.function("compat_sys_fanotify_mark").return ?
{
@_SYSCALL_FANOTIFY_MARK_NAME
@SYSC_RETVALSTR($return)
}
# nd_fanotify_mark _____________________________________________________
probe nd_syscall.fanotify_mark = nd1_syscall.fanotify_mark!, nd2_syscall.fanotify_mark!, tp_syscall.fanotify_mark
{ }
probe nd1_syscall.fanotify_mark = __nd1_syscall.fanotify_mark ?,
__nd1_syscall.compat_fanotify_mark ?
{
@_SYSCALL_FANOTIFY_MARK_NAME
flags_str = _fanotify_mark_flags_str(flags)
mask_str = _fanotify_mark_mask_str(mask)
dirfd_str = _dfd_str(dirfd)
@_SYSCALL_FANOTIFY_MARK_ARGSTR
}
probe __nd1_syscall.fanotify_mark = kprobe.function("sys_fanotify_mark") ?
{
@__syscall_gate_compat_simple
asmlinkage()
@_SYSCALL_FANOTIFY_MARK_REGARGS
}
probe __nd1_syscall.compat_fanotify_mark =
kprobe.function("compat_sys_fanotify_mark") ?
{
asmlinkage()
@_SYSCALL_COMPAT_FANOTIFY_MARK_REGARGS
}
/* kernel 4.17+ */
probe nd2_syscall.fanotify_mark = __nd2_syscall.fanotify_mark ?,
__nd2_syscall.compat_fanotify_mark ?
{
@_SYSCALL_FANOTIFY_MARK_NAME
flags_str = _fanotify_mark_flags_str(flags)
mask_str = _fanotify_mark_mask_str(mask)
dirfd_str = _dfd_str(dirfd)
@_SYSCALL_FANOTIFY_MARK_ARGSTR
}
probe __nd2_syscall.fanotify_mark = kprobe.function(@arch_syscall_prefix "sys_fanotify_mark") ?
{
__set_syscall_pt_regs(pointer_arg(1))
@_SYSCALL_FANOTIFY_MARK_REGARGS
}
probe __nd2_syscall.compat_fanotify_mark =
kprobe.function(@arch_syscall_prefix "compat_sys_fanotify_mark") ?
{
__set_syscall_pt_regs(pointer_arg(1))
@_SYSCALL_COMPAT_FANOTIFY_MARK_REGARGS
}
/* kernel 3.5+, but undesirable because it affects all syscalls */
probe tp_syscall.fanotify_mark = __tp_syscall.fanotify_mark ?,
__tp_syscall.compat_fanotify_mark ?
{
@_SYSCALL_FANOTIFY_MARK_NAME
flags_str = _fanotify_mark_flags_str(flags)
mask_str = _fanotify_mark_mask_str(mask)
dirfd_str = _dfd_str(dirfd)
@_SYSCALL_FANOTIFY_MARK_ARGSTR
}
probe __tp_syscall.fanotify_mark = kernel.trace("sys_enter")
{
__set_syscall_pt_regs($regs)
@__syscall_gate(@const("__NR_fanotify_mark"))
@_SYSCALL_FANOTIFY_MARK_REGARGS
}
probe __tp_syscall.compat_fanotify_mark = kernel.trace("sys_enter")
{
__set_syscall_pt_regs($regs)
@__compat_syscall_gate(@const("__NR_compat_fanotify_mark"))
@_SYSCALL_COMPAT_FANOTIFY_MARK_REGARGS
}
probe nd_syscall.fanotify_mark.return = nd1_syscall.fanotify_mark.return!, nd2_syscall.fanotify_mark.return!, tp_syscall.fanotify_mark.return
{ }
probe nd1_syscall.fanotify_mark.return =
kprobe.function("sys_fanotify_mark").return ?,
kprobe.function("compat_sys_fanotify_mark").return ?
{
@_SYSCALL_FANOTIFY_MARK_NAME
@SYSC_RETVALSTR(returnval())
}
/* kernel 4.17+ */
probe nd2_syscall.fanotify_mark.return =
kprobe.function(@arch_syscall_prefix "sys_fanotify_mark").return ?,
kprobe.function(@arch_syscall_prefix "compat_sys_fanotify_mark").return ?
{
@_SYSCALL_FANOTIFY_MARK_NAME
@SYSC_RETVALSTR(returnval())
}
/* kernel 3.5+, but undesirable because it affects all syscalls */
probe tp_syscall.fanotify_mark.return = kernel.trace("sys_exit")
{
__set_syscall_pt_regs($regs)
@__syscall_compat_gate(@const("__NR_fanotify_mark"), @const("__NR_compat_fanotify_mark"))
@_SYSCALL_FANOTIFY_MARK_NAME
@SYSC_RETVALSTR($ret)
}
|