| 1 |
# tee _____________________________________________________ |
| 2 |
# |
| 3 |
# long sys_tee(int fdin, int fdout, size_t len, unsigned int flags) |
| 4 |
# |
| 5 |
|
| 6 |
@define _SYSCALL_TEE_NAME |
| 7 |
%( |
| 8 |
name = "tee" |
| 9 |
%) |
| 10 |
|
| 11 |
@define _SYSCALL_TEE_ARGSTR |
| 12 |
%( |
| 13 |
argstr = sprintf("%d, %d, %u, 0x%x", fdin, fdout, len, flags) |
| 14 |
%) |
| 15 |
|
| 16 |
@define _SYSCALL_TEE_REGARGS |
| 17 |
%( |
| 18 |
fdin = int_arg(1) |
| 19 |
fdout = int_arg(2) |
| 20 |
len = ulong_arg(3) |
| 21 |
flags = uint_arg(4) |
| 22 |
%) |
| 23 |
|
| 24 |
@define _SYSCALL_TEE_REGARGS_STORE |
| 25 |
%( |
| 26 |
if (@probewrite(fdin)) |
| 27 |
set_int_arg(1, fdin) |
| 28 |
|
| 29 |
if (@probewrite(fdout)) |
| 30 |
set_int_arg(2, fdout) |
| 31 |
|
| 32 |
if (@probewrite(len)) |
| 33 |
set_ulong_arg(3, len) |
| 34 |
|
| 35 |
if (@probewrite(flags)) |
| 36 |
set_uint_arg(4, flags) |
| 37 |
%) |
| 38 |
|
| 39 |
probe syscall.tee = dw_syscall.tee !, nd_syscall.tee ? {} |
| 40 |
probe syscall.tee.return = dw_syscall.tee.return !, nd_syscall.tee.return ? {} |
| 41 |
|
| 42 |
# dw_tee _____________________________________________________ |
| 43 |
|
| 44 |
probe dw_syscall.tee = kernel.function("sys_tee").call ? |
| 45 |
{ |
| 46 |
@_SYSCALL_TEE_NAME |
| 47 |
fdin = __int32($fdin) |
| 48 |
fdout = __int32($fdout) |
| 49 |
len = @__compat_ulong($len) |
| 50 |
flags = __uint32($flags) |
| 51 |
@_SYSCALL_TEE_ARGSTR |
| 52 |
} |
| 53 |
probe dw_syscall.tee.return = kernel.function("sys_tee").return ? |
| 54 |
{ |
| 55 |
@_SYSCALL_TEE_NAME |
| 56 |
@SYSC_RETVALSTR($return) |
| 57 |
} |
| 58 |
|
| 59 |
# nd_tee _____________________________________________________ |
| 60 |
|
| 61 |
probe nd_syscall.tee = nd1_syscall.tee!, nd2_syscall.tee!, tp_syscall.tee |
| 62 |
{ } |
| 63 |
|
| 64 |
probe nd1_syscall.tee = kprobe.function("sys_tee") ? |
| 65 |
{ |
| 66 |
@_SYSCALL_TEE_NAME |
| 67 |
asmlinkage() |
| 68 |
@_SYSCALL_TEE_REGARGS |
| 69 |
@_SYSCALL_TEE_ARGSTR |
| 70 |
} |
| 71 |
|
| 72 |
/* kernel 4.17+ */ |
| 73 |
probe nd2_syscall.tee = kprobe.function(@arch_syscall_prefix "sys_tee") ? |
| 74 |
{ |
| 75 |
__set_syscall_pt_regs(pointer_arg(1)) |
| 76 |
@_SYSCALL_TEE_NAME |
| 77 |
@_SYSCALL_TEE_REGARGS |
| 78 |
@_SYSCALL_TEE_ARGSTR |
| 79 |
}, |
| 80 |
{ |
| 81 |
%( @_IS_SREG_KERNEL %? @_SYSCALL_TEE_REGARGS_STORE %) |
| 82 |
} |
| 83 |
|
| 84 |
/* kernel 3.5+, but undesirable because it affects all syscalls */ |
| 85 |
probe tp_syscall.tee = kernel.trace("sys_enter") |
| 86 |
{ |
| 87 |
__set_syscall_pt_regs($regs) |
| 88 |
@__syscall_compat_gate(@const("__NR_tee"), @const("__NR_compat_tee")) |
| 89 |
@_SYSCALL_TEE_NAME |
| 90 |
@_SYSCALL_TEE_REGARGS |
| 91 |
@_SYSCALL_TEE_ARGSTR |
| 92 |
}, |
| 93 |
{ |
| 94 |
%( @_IS_SREG_KERNEL %? @_SYSCALL_TEE_REGARGS_STORE %) |
| 95 |
} |
| 96 |
|
| 97 |
probe nd_syscall.tee.return = nd1_syscall.tee.return!, nd2_syscall.tee.return!, tp_syscall.tee.return |
| 98 |
{ } |
| 99 |
|
| 100 |
probe nd1_syscall.tee.return = kprobe.function("sys_tee").return ? |
| 101 |
{ |
| 102 |
@_SYSCALL_TEE_NAME |
| 103 |
@SYSC_RETVALSTR(returnval()) |
| 104 |
} |
| 105 |
|
| 106 |
/* kernel 4.17+ */ |
| 107 |
probe nd2_syscall.tee.return = kprobe.function(@arch_syscall_prefix "sys_tee").return ? |
| 108 |
{ |
| 109 |
@_SYSCALL_TEE_NAME |
| 110 |
@SYSC_RETVALSTR(returnval()) |
| 111 |
} |
| 112 |
|
| 113 |
/* kernel 3.5+, but undesirable because it affects all syscalls */ |
| 114 |
probe tp_syscall.tee.return = kernel.trace("sys_exit") |
| 115 |
{ |
| 116 |
__set_syscall_pt_regs($regs) |
| 117 |
@__syscall_compat_gate(@const("__NR_tee"), @const("__NR_compat_tee")) |
| 118 |
@_SYSCALL_TEE_NAME |
| 119 |
@SYSC_RETVALSTR($ret) |
| 120 |
} |