| 1 |
# fallocate __________________________________________________ |
| 2 |
# |
| 3 |
# asmlinkage long compat_sys_fallocate(int fd, int mode, u32 offhi, u32 offlo, |
| 4 |
# u32 lenhi, u32 lenlo) |
| 5 |
|
| 6 |
@define _SYSCALL_COMPAT_FALLOCATE_NAME |
| 7 |
%( |
| 8 |
name = "fallocate" |
| 9 |
%) |
| 10 |
|
| 11 |
@define _SYSCALL_COMPAT_FALLOCATE_ARGSTR |
| 12 |
%( |
| 13 |
argstr = sprintf("%d, %s, %#x, %u", fd, mode_str, offset, len) |
| 14 |
%) |
| 15 |
|
| 16 |
@define _SYSCALL_COMPAT_FALLOCATE_REGARGS |
| 17 |
%( |
| 18 |
fd = int_arg(1) |
| 19 |
mode = int_arg(2) |
| 20 |
mode_str = _stp_fallocate_mode_str(mode) |
| 21 |
offset = ((uint_arg(3) << 32) | uint_arg(4)) |
| 22 |
len = ((uint_arg(5) << 32) | uint_arg(6)) |
| 23 |
%) |
| 24 |
|
| 25 |
probe syscall.compat_fallocate = dw_syscall.compat_fallocate !, |
| 26 |
nd_syscall.compat_fallocate ? {} |
| 27 |
probe syscall.compat_fallocate.return = dw_syscall.compat_fallocate.return !, |
| 28 |
nd_syscall.compat_fallocate.return ? {} |
| 29 |
|
| 30 |
# dw_compat_fallocate _____________________________________________________ |
| 31 |
|
| 32 |
probe dw_syscall.compat_fallocate = kernel.function("compat_sys_fallocate") ? |
| 33 |
{ |
| 34 |
@_SYSCALL_COMPAT_FALLOCATE_NAME |
| 35 |
fd = __int32($fd) |
| 36 |
mode = __int32($mode) |
| 37 |
mode_str = _stp_fallocate_mode_str(mode) |
| 38 |
offset = (($offhi << 32) | $offlo) |
| 39 |
len = (($lenhi << 32) | $lenlo) |
| 40 |
@_SYSCALL_COMPAT_FALLOCATE_ARGSTR |
| 41 |
} |
| 42 |
probe dw_syscall.compat_fallocate.return = |
| 43 |
kernel.function("compat_sys_fallocate").return ? |
| 44 |
{ |
| 45 |
@_SYSCALL_COMPAT_FALLOCATE_NAME |
| 46 |
@SYSC_RETVALSTR($return) |
| 47 |
} |
| 48 |
|
| 49 |
# nd_compat_fallocate _____________________________________________________ |
| 50 |
|
| 51 |
probe nd_syscall.compat_fallocate = nd1_syscall.compat_fallocate!, tp_syscall.compat_fallocate |
| 52 |
{ } |
| 53 |
|
| 54 |
probe nd1_syscall.compat_fallocate = kprobe.function("compat_sys_fallocate") ? |
| 55 |
{ |
| 56 |
asmlinkage() |
| 57 |
@_SYSCALL_COMPAT_FALLOCATE_NAME |
| 58 |
@_SYSCALL_COMPAT_FALLOCATE_REGARGS |
| 59 |
@_SYSCALL_COMPAT_FALLOCATE_ARGSTR |
| 60 |
} |
| 61 |
|
| 62 |
/* kernel 3.5+, but undesirable because it affects all syscalls */ |
| 63 |
probe tp_syscall.compat_fallocate = kernel.trace("sys_enter") |
| 64 |
{ |
| 65 |
__set_syscall_pt_regs($regs) |
| 66 |
@__compat_syscall_gate(@const("__NR_fallocate")) |
| 67 |
@_SYSCALL_COMPAT_FALLOCATE_NAME |
| 68 |
@_SYSCALL_COMPAT_FALLOCATE_REGARGS |
| 69 |
@_SYSCALL_COMPAT_FALLOCATE_ARGSTR |
| 70 |
} |
| 71 |
|
| 72 |
probe nd_syscall.compat_fallocate.return = nd1_syscall.compat_fallocate.return!, tp_syscall.compat_fallocate.return |
| 73 |
{ } |
| 74 |
|
| 75 |
probe nd1_syscall.compat_fallocate.return = |
| 76 |
kprobe.function("compat_sys_fallocate").return ? |
| 77 |
{ |
| 78 |
@_SYSCALL_COMPAT_FALLOCATE_NAME |
| 79 |
@SYSC_RETVALSTR(returnval()) |
| 80 |
} |
| 81 |
|
| 82 |
/* kernel 3.5+, but undesirable because it affects all syscalls */ |
| 83 |
probe tp_syscall.compat_fallocate.return = kernel.trace("sys_exit") |
| 84 |
{ |
| 85 |
__set_syscall_pt_regs($regs) |
| 86 |
@__compat_syscall_gate(@const("__NR_fallocate")) |
| 87 |
@_SYSCALL_COMPAT_FALLOCATE_NAME |
| 88 |
@SYSC_RETVALSTR($ret) |
| 89 |
} |