Debian Codegraph @

tapset/linux/sysc_quotactl.stp

raw
1 # quotactl ___________________________________________________
2 #
3 # long sys_quotactl(unsigned int cmd,
4 # const char __user *special,
5 # qid_t id,
6 # void __user *addr)
7 # asmlinkage long sys32_quotactl(unsigned int cmd, const char __user *special,
8 # qid_t id, void __user *addr)
9 #
10
11 @define _SYSCALL_QUOTACTL_NAME
12 %(
13 name = "quotactl"
14 %)
15
16 @define _SYSCALL_QUOTACTL_REGARGS
17 %(
18 cmd = uint_arg(1)
19 cmd_str = _quotactl_cmd_str(cmd)
20 special = pointer_arg(2)
21 special_str = user_string_quoted(pointer_arg(2))
22 special_str_unquoted = user_string_nofault(pointer_arg(2))
23 id = int_arg(3)
24 addr_uaddr = pointer_arg(4)
25 %)
26
27 @define _SYSCALL_QUOTACTL_REGARGS_STORE
28 %(
29 if (@probewrite(cmd))
30 set_uint_arg(1, cmd)
31
32 if (@probewrite(special))
33 set_pointer_arg(2, special)
34
35 if (@probewrite(special_str_unquoted))
36 set_user_string_arg(pointer_arg(2), special_str_unquoted)
37
38 if (@probewrite(id))
39 set_int_arg(3, id)
40
41 if (@probewrite(addr_uaddr))
42 set_pointer_arg(4, addr_uaddr)
43 %)
44
45 probe syscall.quotactl = dw_syscall.quotactl !, nd_syscall.quotactl ? {}
46 probe syscall.quotactl.return = dw_syscall.quotactl.return !,
47 nd_syscall.quotactl.return ? {}
48
49 # dw_quotactl _____________________________________________________
50
51 probe dw_syscall.quotactl = __syscall.quotactl ?,
52 kernel.function("sys32_quotactl").call ?
53 {
54 @_SYSCALL_QUOTACTL_NAME
55 cmd = __uint32($cmd)
56 cmd_str = _quotactl_cmd_str(__uint32($cmd))
57 special = $special
58 special_str = user_string_quoted($special)
59 id = __int32($id)
60 addr_uaddr = $addr
61 @__quotactl_argstr(_quotactl_subcmd(cmd), cmd, special, id, addr_uaddr)
62 }
63 probe __syscall.quotactl = kernel.function("sys_quotactl").call ?
64 {
65 # sys32_quotactl() was introduced in 2.6.23.
66 %( arch != "powerpc" && arch != "s390" && kernel_v >= "2.6.23" %?
67 @__syscall_gate_compat_simple
68 %)
69 }
70 probe dw_syscall.quotactl.return = __syscall.quotactl.return ?,
71 kernel.function("sys32_quotactl").return ?
72 {
73 @_SYSCALL_QUOTACTL_NAME
74 @SYSC_RETVALSTR($return)
75 }
76 probe __syscall.quotactl.return = kernel.function("sys_quotactl").return ?
77 {
78 %( arch != "powerpc" && arch != "s390" && kernel_v >= "2.6.23" %?
79 @__syscall_gate_compat_simple
80 %)
81 }
82
83 # nd_quotactl _____________________________________________________
84
85 probe nd_syscall.quotactl = nd1_syscall.quotactl!, nd2_syscall.quotactl!, tp_syscall.quotactl
86 { }
87
88 probe nd1_syscall.quotactl = __nd1_syscall.quotactl ?,
89 kprobe.function("sys32_quotactl") ?
90 {
91 @_SYSCALL_QUOTACTL_NAME
92 asmlinkage()
93 @_SYSCALL_QUOTACTL_REGARGS
94 @__quotactl_argstr(_quotactl_subcmd(cmd), cmd, special, id, addr_uaddr)
95 }
96 probe __nd1_syscall.quotactl = kprobe.function("sys_quotactl") ?
97 {
98 # sys32_quotactl() was introduced in 2.6.23.
99 %( arch != "powerpc" && arch != "s390" && kernel_v >= "2.6.23" %?
100 @__syscall_gate_compat_simple
101 %)
102 }
103
104 /* kernel 4.17+ */
105 probe nd2_syscall.quotactl = kprobe.function(@arch_syscall_prefix "sys_quotactl") ?,
106 kprobe.function(@arch_syscall_prefix "compat_sys_quotactl32") ?
107 {
108 __set_syscall_pt_regs(pointer_arg(1))
109 @_SYSCALL_QUOTACTL_NAME
110 @_SYSCALL_QUOTACTL_REGARGS
111 @__quotactl_argstr(_quotactl_subcmd(cmd), cmd, special, id, addr_uaddr)
112 },
113 {
114 %( @_IS_SREG_KERNEL %? @_SYSCALL_QUOTACTL_REGARGS_STORE %)
115 }
116
117 /* kernel 3.5+, but undesirable because it affects all syscalls */
118 probe tp_syscall.quotactl = kernel.trace("sys_enter")
119 {
120 __set_syscall_pt_regs($regs)
121 @__syscall_compat_gate(@const("__NR_quotactl"), @const("__NR_compat_quotactl"))
122 @_SYSCALL_QUOTACTL_NAME
123 @_SYSCALL_QUOTACTL_REGARGS
124 @__quotactl_argstr(_quotactl_subcmd(cmd), cmd, special, id, addr_uaddr)
125 },
126 {
127 %( @_IS_SREG_KERNEL %? @_SYSCALL_QUOTACTL_REGARGS_STORE %)
128 }
129
130 probe nd_syscall.quotactl.return = nd1_syscall.quotactl.return!, nd2_syscall.quotactl.return!, tp_syscall.quotactl.return
131 { }
132
133 probe nd1_syscall.quotactl.return = __nd1_syscall.quotactl.return ?,
134 kprobe.function("sys32_quotactl").return ?
135 {
136 @_SYSCALL_QUOTACTL_NAME
137 @SYSC_RETVALSTR(returnval())
138 }
139 probe __nd1_syscall.quotactl.return = kprobe.function("sys_quotactl").return ?
140 {
141 %( arch != "powerpc" && arch != "s390" && kernel_v >= "2.6.23" %?
142 @__syscall_gate_compat_simple
143 %)
144 }
145
146 /* kernel 4.17+ */
147 probe nd2_syscall.quotactl.return = kprobe.function(@arch_syscall_prefix "sys_quotactl").return ?,
148 kprobe.function(@arch_syscall_prefix "compat_sys_quotactl32").return ?
149 {
150 @_SYSCALL_QUOTACTL_NAME
151 @SYSC_RETVALSTR(returnval())
152 }
153
154 /* kernel 3.5+, but undesirable because it affects all syscalls */
155 probe tp_syscall.quotactl.return = kernel.trace("sys_exit")
156 {
157 __set_syscall_pt_regs($regs)
158 @__syscall_compat_gate(@const("__NR_quotactl"), @const("__NR_compat_quotactl"))
159 @_SYSCALL_QUOTACTL_NAME
160 @SYSC_RETVALSTR($ret)
161 }