Debian Codegraph @

tapset/linux/sysc_io_cancel.stp

raw
1 # io_cancel __________________________________________________
2 # long sys_io_cancel(aio_context_t ctx_id,
3 # struct iocb __user *iocb,
4 # struct io_event __user *result)
5
6 @define _SYSCALL_IO_CANCEL_NAME
7 %(
8 name = "io_cancel"
9 %)
10
11 @define _SYSCALL_IO_CANCEL_ARGSTR
12 %(
13 argstr = sprintf("%u, %p, %p", ctx_id, iocb_uaddr, result_uaddr)
14 %)
15
16 @define _SYSCALL_IO_CANCEL_REGARGS
17 %(
18 ctx_id = ulong_arg(1)
19 iocb_uaddr = pointer_arg(2)
20 result_uaddr = pointer_arg(3)
21 %)
22
23 @define _SYSCALL_IO_CANCEL_REGARGS_STORE
24 %(
25 if (@probewrite(ctx_id))
26 set_ulong_arg(1, ctx_id)
27
28 if (@probewrite(iocb_uaddr))
29 set_pointer_arg(2, iocb_uaddr)
30
31 if (@probewrite(result_uaddr))
32 set_pointer_arg(3, result_uaddr)
33 %)
34
35 probe syscall.io_cancel = dw_syscall.io_cancel !, nd_syscall.io_cancel ? {}
36 probe syscall.io_cancel.return = dw_syscall.io_cancel.return !, nd_syscall.io_cancel.return ? {}
37
38 # dw_io_cancel __________________________________________________
39 # long sys_io_cancel(aio_context_t ctx_id,
40 # struct iocb __user *iocb,
41 # struct io_event __user *result)
42 probe dw_syscall.io_cancel = kernel.function("sys_io_cancel").call
43 {
44 @_SYSCALL_IO_CANCEL_NAME
45 ctx_id = @__compat_ulong($ctx_id)
46 iocb_uaddr = $iocb
47 result_uaddr = $result
48 @_SYSCALL_IO_CANCEL_ARGSTR
49 }
50 probe dw_syscall.io_cancel.return = kernel.function("sys_io_cancel").return
51 {
52 @_SYSCALL_IO_CANCEL_NAME
53 @SYSC_RETVALSTR($return)
54 }
55
56 # nd_io_cancel __________________________________________________
57 # long sys_io_cancel(aio_context_t ctx_id,
58 # struct iocb __user *iocb,
59 # struct io_event __user *result)
60 #
61 #
62 probe nd_syscall.io_cancel = nd1_syscall.io_cancel!, nd2_syscall.io_cancel!, tp_syscall.io_cancel
63 { }
64
65 probe nd1_syscall.io_cancel = kprobe.function("sys_io_cancel") ?
66 {
67 @_SYSCALL_IO_CANCEL_NAME
68 asmlinkage()
69 @_SYSCALL_IO_CANCEL_REGARGS
70 @_SYSCALL_IO_CANCEL_ARGSTR
71 }
72
73 /* kernel 4.17+ */
74 probe nd2_syscall.io_cancel = kprobe.function(@arch_syscall_prefix "sys_io_cancel")
75 {
76 __set_syscall_pt_regs(pointer_arg(1))
77 @_SYSCALL_IO_CANCEL_NAME
78 @_SYSCALL_IO_CANCEL_REGARGS
79 @_SYSCALL_IO_CANCEL_ARGSTR
80 },
81 {
82 %( @_IS_SREG_KERNEL %? @_SYSCALL_IO_CANCEL_REGARGS_STORE %)
83 }
84
85 /* kernel 3.5+, but undesirable because it affects all syscalls */
86 probe tp_syscall.io_cancel = kernel.trace("sys_enter")
87 {
88 __set_syscall_pt_regs($regs)
89 @__syscall_compat_gate(@const("__NR_io_cancel"), @const("__NR_compat_io_cancel"))
90 @_SYSCALL_IO_CANCEL_NAME
91 @_SYSCALL_IO_CANCEL_REGARGS
92 @_SYSCALL_IO_CANCEL_ARGSTR
93 },
94 {
95 %( @_IS_SREG_KERNEL %? @_SYSCALL_IO_CANCEL_REGARGS_STORE %)
96 }
97
98 probe nd_syscall.io_cancel.return = nd1_syscall.io_cancel.return!, nd2_syscall.io_cancel.return!, tp_syscall.io_cancel.return
99 { }
100
101 probe nd1_syscall.io_cancel.return = kprobe.function("sys_io_cancel").return ?
102 {
103 @_SYSCALL_IO_CANCEL_NAME
104 @SYSC_RETVALSTR(returnval())
105 }
106
107 /* kernel 4.17+ */
108 probe nd2_syscall.io_cancel.return = kprobe.function(@arch_syscall_prefix "sys_io_cancel").return
109 {
110 @_SYSCALL_IO_CANCEL_NAME
111 @SYSC_RETVALSTR(returnval())
112 }
113
114 /* kernel 3.5+, but undesirable because it affects all syscalls */
115 probe tp_syscall.io_cancel.return = kernel.trace("sys_exit")
116 {
117 __set_syscall_pt_regs($regs)
118 @__syscall_compat_gate(@const("__NR_io_cancel"), @const("__NR_compat_io_cancel"))
119 @_SYSCALL_IO_CANCEL_NAME
120 @SYSC_RETVALSTR($ret)
121 }