Debian Codegraph @

tapset/linux/sysc_stime.stp

raw
1 # stime ______________________________________________________
2 #
3 # long sys_stime(time_t __user *tptr)
4 # long compat_sys_stime(compat_time_t __user *tptr)
5 #
6
7 @define _SYSCALL_STIME_NAME
8 %(
9 name = "stime"
10 %)
11
12 @define _SYSCALL_STIME_ARGSTR
13 %(
14 argstr = sprintf("%p", t_uaddr)
15 %)
16
17 @define _SYSCALL_STIME_REGARGS
18 %(
19 t_uaddr = pointer_arg(1)
20 %)
21
22 @define _SYSCALL_STIME_REGARGS_STORE
23 %(
24 if (@probewrite(t_uaddr))
25 set_pointer_arg(1, t_uaddr)
26 %)
27
28 probe syscall.stime = dw_syscall.stime !, nd_syscall.stime ? {}
29 probe syscall.stime.return = dw_syscall.stime.return !,
30 nd_syscall.stime.return ? {}
31
32 # dw_stime _____________________________________________________
33
34 probe dw_syscall.stime = kernel.function("compat_sys_stime").call ?,
35 kernel.function("sys_stime").call ?
36 {
37 @_SYSCALL_STIME_NAME
38 t_uaddr = $tptr
39 /* FIXME. Decode time */
40 @_SYSCALL_STIME_ARGSTR
41 }
42 probe dw_syscall.stime.return = kernel.function("compat_sys_stime").return ?,
43 kernel.function("sys_stime").return ?
44 {
45 @_SYSCALL_STIME_NAME
46 @SYSC_RETVALSTR($return)
47 }
48
49 # nd_stime _____________________________________________________
50
51 probe nd_syscall.stime = nd1_syscall.stime!, nd2_syscall.stime!, tp_syscall.stime
52 { }
53
54 probe nd1_syscall.stime = kprobe.function("compat_sys_stime") ?,
55 kprobe.function("sys_stime") ?
56 {
57 @_SYSCALL_STIME_NAME
58 asmlinkage()
59 @_SYSCALL_STIME_REGARGS
60 /* FIXME. Decode time */
61 @_SYSCALL_STIME_ARGSTR
62 }
63
64 /* kernel 4.17+ */
65 probe nd2_syscall.stime = kprobe.function(@arch_syscall_prefix "compat_sys_stime") ?,
66 kprobe.function(@arch_syscall_prefix "sys_stime") ?
67 {
68 __set_syscall_pt_regs(pointer_arg(1))
69 @_SYSCALL_STIME_NAME
70 @_SYSCALL_STIME_REGARGS
71 /* FIXME. Decode time */
72 @_SYSCALL_STIME_ARGSTR
73 },
74 {
75 %( @_IS_SREG_KERNEL %? @_SYSCALL_STIME_REGARGS_STORE %)
76 }
77
78 /* kernel 3.5+, but undesirable because it affects all syscalls */
79 probe tp_syscall.stime = kernel.trace("sys_enter")
80 {
81 __set_syscall_pt_regs($regs)
82 @__syscall_compat_gate(@const("__NR_stime"), @const("__NR_compat_stime"))
83 @_SYSCALL_STIME_NAME
84 @_SYSCALL_STIME_REGARGS
85 @_SYSCALL_STIME_ARGSTR
86 },
87 {
88 %( @_IS_SREG_KERNEL %? @_SYSCALL_STIME_REGARGS_STORE %)
89 }
90
91 probe nd_syscall.stime.return = nd1_syscall.stime.return!, nd2_syscall.stime.return!, tp_syscall.stime.return
92 { }
93
94 probe nd1_syscall.stime.return = kprobe.function("compat_sys_stime").return ?,
95 kprobe.function("sys_stime").return ?
96 {
97 @_SYSCALL_STIME_NAME
98 @SYSC_RETVALSTR(returnval())
99 }
100
101 /* kernel 4.17+ */
102 probe nd2_syscall.stime.return = kprobe.function(@arch_syscall_prefix "compat_sys_stime") ?,
103 kprobe.function(@arch_syscall_prefix "sys_stime").return ?
104 {
105 @_SYSCALL_STIME_NAME
106 @SYSC_RETVALSTR(returnval())
107 }
108
109 /* kernel 3.5+, but undesirable because it affects all syscalls */
110 probe tp_syscall.stime.return = kernel.trace("sys_exit")
111 {
112 __set_syscall_pt_regs($regs)
113 @__syscall_compat_gate(@const("__NR_stime"), @const("__NR_compat_stime"))
114 @_SYSCALL_STIME_NAME
115 @SYSC_RETVALSTR($ret)
116 }