Debian Codegraph @

tapset/linux/sysc_timerfd_gettime.stp

raw
1 # timerfd_gettime_____________________________________________
2 #
3 # SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct itimerspec __user *, otmr)
4 # COMPAT_SYSCALL_DEFINE2(timerfd_gettime, int, ufd,
5 # struct compat_itimerspec __user *, otmr)
6
7 @define _SYSCALL_TIMERFD_GETTIME_NAME
8 %(
9 name = "timerfd_gettime"
10 %)
11
12 @define _SYSCALL_TIMERFD_GETTIME_ARGSTR
13 %(
14 argstr = sprintf("%d, %p", fd, value_uaddr)
15 %)
16
17 @define _SYSCALL_TIMERFD_GETTIME_REGARGS
18 %(
19 fd = int_arg(1)
20 value_uaddr = pointer_arg(2)
21 %)
22
23 @define _SYSCALL_TIMERFD_GETTIME_REGARGS_STORE
24 %(
25 if (@probewrite(fd))
26 set_int_arg(1, fd)
27
28 if (@probewrite(value_uaddr))
29 set_pointer_arg(2, value_uaddr)
30 %)
31
32 probe syscall.timerfd_gettime = dw_syscall.timerfd_gettime !,
33 nd_syscall.timerfd_gettime ? {}
34 probe syscall.timerfd_gettime.return = dw_syscall.timerfd_gettime.return !,
35 nd_syscall.timerfd_gettime.return ? {}
36
37 # dw_timerfd_gettime _____________________________________________________
38
39 probe dw_syscall.timerfd_gettime = __syscall.timerfd_gettime ?,
40 kernel.function("compat_sys_timerfd_gettime").call ?
41 {
42 @_SYSCALL_TIMERFD_GETTIME_NAME
43 fd = __int32($ufd)
44 value_uaddr = @__pointer($otmr)
45 @_SYSCALL_TIMERFD_GETTIME_ARGSTR
46 }
47 probe __syscall.timerfd_gettime = kernel.function("sys_timerfd_gettime").call ?
48 {
49 @__syscall_gate_compat_simple
50 }
51 probe dw_syscall.timerfd_gettime.return = __syscall.timerfd_gettime.return ?,
52 kernel.function("compat_sys_timerfd_gettime").return ?
53 {
54 @_SYSCALL_TIMERFD_GETTIME_NAME
55 @SYSC_RETVALSTR($return)
56 }
57 probe __syscall.timerfd_gettime.return =
58 kernel.function("sys_timerfd_gettime").return ?
59 {
60 @__syscall_gate_compat_simple
61 }
62
63 # nd_timerfd_gettime _____________________________________________________
64
65 probe nd_syscall.timerfd_gettime = nd1_syscall.timerfd_gettime!, nd2_syscall.timerfd_gettime!, tp_syscall.timerfd_gettime
66 { }
67
68 probe nd1_syscall.timerfd_gettime = __nd1_syscall.timerfd_gettime ?,
69 kprobe.function("compat_sys_timerfd_gettime").call ?
70 {
71 @_SYSCALL_TIMERFD_GETTIME_NAME
72 asmlinkage()
73 @_SYSCALL_TIMERFD_GETTIME_REGARGS
74 @_SYSCALL_TIMERFD_GETTIME_ARGSTR
75 }
76 probe __nd1_syscall.timerfd_gettime =
77 kprobe.function("sys_timerfd_gettime").call ?
78 {
79 @__syscall_gate_compat_simple
80 }
81
82 /* kernel 4.17+ */
83 probe nd2_syscall.timerfd_gettime =
84 kprobe.function(@arch_syscall_prefix "sys_timerfd_gettime") ?,
85 kprobe.function(@arch_syscall_prefix "compat_sys_timerfd_gettime") ?
86 {
87 __set_syscall_pt_regs(pointer_arg(1))
88 @_SYSCALL_TIMERFD_GETTIME_NAME
89 @_SYSCALL_TIMERFD_GETTIME_REGARGS
90 @_SYSCALL_TIMERFD_GETTIME_ARGSTR
91 },
92 {
93 %( @_IS_SREG_KERNEL %? @_SYSCALL_TIMERFD_GETTIME_REGARGS_STORE %)
94 }
95
96 /* kernel 3.5+, but undesirable because it affects all syscalls */
97 probe tp_syscall.timerfd_gettime = kernel.trace("sys_enter")
98 {
99 __set_syscall_pt_regs($regs)
100 @__syscall_compat_gate(@const("__NR_timerfd_gettime"), @const("__NR_compat_timerfd_gettime"))
101 @_SYSCALL_TIMERFD_GETTIME_NAME
102 @_SYSCALL_TIMERFD_GETTIME_REGARGS
103 @_SYSCALL_TIMERFD_GETTIME_ARGSTR
104 },
105 {
106 %( @_IS_SREG_KERNEL %? @_SYSCALL_TIMERFD_GETTIME_REGARGS_STORE %)
107 }
108
109 probe nd_syscall.timerfd_gettime.return = nd1_syscall.timerfd_gettime.return!, nd2_syscall.timerfd_gettime.return!, tp_syscall.timerfd_gettime.return
110 { }
111
112 probe nd1_syscall.timerfd_gettime.return = __nd1_syscall.timerfd_gettime.return ?,
113 kprobe.function("compat_sys_timerfd_gettime").return ?
114 {
115 @_SYSCALL_TIMERFD_GETTIME_NAME
116 @SYSC_RETVALSTR(returnval())
117 }
118 probe __nd1_syscall.timerfd_gettime.return =
119 kprobe.function("sys_timerfd_gettime").return ?
120 {
121 @__syscall_gate_compat_simple
122 }
123
124 /* kernel 4.17+ */
125 probe nd2_syscall.timerfd_gettime.return =
126 kprobe.function(@arch_syscall_prefix "sys_timerfd_gettime").return ?,
127 kprobe.function(@arch_syscall_prefix "compat_sys_timerfd_gettime").return ?
128 {
129 @_SYSCALL_TIMERFD_GETTIME_NAME
130 @SYSC_RETVALSTR(returnval())
131 }
132
133 /* kernel 3.5+, but undesirable because it affects all syscalls */
134 probe tp_syscall.timerfd_gettime.return = kernel.trace("sys_exit")
135 {
136 __set_syscall_pt_regs($regs)
137 @__syscall_compat_gate(@const("__NR_timerfd_gettime"), @const("__NR_compat_timerfd_gettime"))
138 @_SYSCALL_TIMERFD_GETTIME_NAME
139 @SYSC_RETVALSTR($ret)
140 }