Debian Codegraph @

tapset/linux/sysc_statx.stp

raw
1 # statx _______________________________________________________
2 # Syscall introduced in kernel commit a528d35e8bfcc521d7cb70aaf03e1bd296c8493f
3 # Author: David Howells <[email protected]>
4 # Date: Tue Jan 31 16:46:22 2017 +0000
5 # SYSCALL_DEFINE5(statx,
6 # int, dfd, const char __user *, filename, unsigned, flags,
7 # unsigned int, mask,
8 # struct statx __user *, buffer)
9 #
10 # asmlinkage long sys_statx(int dfd, const char __user *path, unsigned flags,
11 # unsigned mask, struct statx __user *buffer);
12
13 @define _SYSCALL_STATX_NAME
14 %(
15 name = "statx"
16 %)
17
18 @define _SYSCALL_STATX_ARGSTR
19 %(
20 argstr = sprintf("%s, %s, %s, %s, %p", dfd_str, filename, flags_str,
21 mask_str, buf_uaddr)
22 %)
23
24 @define _SYSCALL_STATX_REGARGS
25 %(
26 dfd = int_arg(1)
27 dfd_str = _dfd_str(dfd)
28 filename_uaddr = pointer_arg(2)
29 filename = user_string_quoted(filename_uaddr)
30 filename_unquoted = user_string_nofault(pointer_arg(2))
31 flags = uint_arg(3)
32 flags_str = _at_flag_str(flags)
33 mask = uint_arg(4)
34 mask_str = _statx_mask_str(mask)
35 buf_uaddr = pointer_arg(5)
36 %)
37
38 @define _SYSCALL_STATX_REGARGS_STORE
39 %(
40 if (@probewrite(dfd))
41 set_int_arg(1, dfd)
42
43 if (@probewrite(filename_uaddr))
44 set_pointer_arg(2, filename_uaddr)
45
46 if (@probewrite(filename_unquoted))
47 set_user_string_arg(pointer_arg(2), filename_unquoted)
48
49 if (@probewrite(flags))
50 set_uint_arg(3, flags)
51
52 if (@probewrite(mask))
53 set_uint_arg(4, mask)
54
55 if (@probewrite(buf_uaddr))
56 set_pointer_arg(5, buf_uaddr)
57 %)
58
59 probe syscall.statx = dw_syscall.statx !, nd_syscall.statx ? {}
60 probe syscall.statx.return = dw_syscall.statx.return !, nd_syscall.statx.return ? {}
61
62 # dw_statx _____________________________________________________
63
64 probe dw_syscall.statx = kernel.function("sys_statx").call ?
65 {
66 @_SYSCALL_STATX_NAME
67 dfd = __int32($dfd)
68 dfd_str = _dfd_str(dfd)
69 filename_uaddr = $filename
70 filename = user_string_quoted($filename)
71 flags = __uint32($flags)
72 flags_str = _at_flag_str(flags)
73 mask = __uint32($mask)
74 mask_str = _statx_mask_str(mask)
75 buf_uaddr = $buffer
76 # Not pretty-printing struct statx, since it is just
77 # (maybe somehow initialized) *destination* buffer.
78 @_SYSCALL_STATX_ARGSTR
79 }
80 probe dw_syscall.statx.return = kernel.function("sys_statx").return ?
81 {
82 @_SYSCALL_STATX_NAME
83 @SYSC_RETVALSTR($return)
84 }
85
86 # nd_statx _____________________________________________________
87
88 probe nd_syscall.statx = nd1_syscall.statx!, nd2_syscall.statx!, tp_syscall.statx
89 { }
90
91 probe nd1_syscall.statx = kprobe.function("sys_statx") ?
92 {
93 @_SYSCALL_STATX_NAME
94 asmlinkage()
95 @_SYSCALL_STATX_REGARGS
96 # Not pretty-printing struct statx, since it is just
97 # (maybe somehow initialized) *destination* buffer.
98 @_SYSCALL_STATX_ARGSTR
99 }
100
101 /* kernel 4.17+ */
102 probe nd2_syscall.statx = kprobe.function(@arch_syscall_prefix "sys_statx") ?
103 {
104 __set_syscall_pt_regs(pointer_arg(1))
105 @_SYSCALL_STATX_NAME
106 @_SYSCALL_STATX_REGARGS
107 @_SYSCALL_STATX_ARGSTR
108 },
109 {
110 %( @_IS_SREG_KERNEL %? @_SYSCALL_STATX_REGARGS_STORE %)
111 }
112
113 /* kernel 3.5+, but undesirable because it affects all syscalls */
114 probe tp_syscall.statx = kernel.trace("sys_enter")
115 {
116 __set_syscall_pt_regs($regs)
117 @__syscall_compat_gate(@const("__NR_statx"), @const("__NR_compat_statx"))
118 @_SYSCALL_STATX_NAME
119 @_SYSCALL_STATX_REGARGS
120 @_SYSCALL_STATX_ARGSTR
121 },
122 {
123 %( @_IS_SREG_KERNEL %? @_SYSCALL_STATX_REGARGS_STORE %)
124 }
125
126 probe nd_syscall.statx.return = nd1_syscall.statx.return!, nd2_syscall.statx.return!, tp_syscall.statx.return
127 { }
128
129 probe nd1_syscall.statx.return = kprobe.function("sys_statx").return ?
130 {
131 @_SYSCALL_STATX_NAME
132 @SYSC_RETVALSTR(returnval())
133 }
134
135 /* kernel 4.17+ */
136 probe nd2_syscall.statx.return = kprobe.function(@arch_syscall_prefix "sys_statx").return ?
137 {
138 @_SYSCALL_STATX_NAME
139 @SYSC_RETVALSTR(returnval())
140 }
141
142 /* kernel 3.5+, but undesirable because it affects all syscalls */
143 probe tp_syscall.statx.return = kernel.trace("sys_exit")
144 {
145 __set_syscall_pt_regs($regs)
146 @__syscall_compat_gate(@const("__NR_statx"), @const("__NR_compat_statx"))
147 @_SYSCALL_STATX_NAME
148 @SYSC_RETVALSTR($ret)
149 }