Debian Codegraph @

tapset/linux/sysc_mbind.stp

raw
1 # mbind ______________________________________________________
2 # long sys_mbind(unsigned long start,
3 # unsigned long len,
4 # unsigned long mode,
5 # unsigned long __user *nmask,
6 # unsigned long maxnode,
7 # unsigned flags)
8 #
9 # long compat_sys_mbind(compat_ulong_t start,
10 # compat_ulong_t len,
11 # compat_ulong_t mode,
12 # compat_ulong_t __user *nmask,
13 # compat_ulong_t maxnode,
14 # compat_ulong_t flags)
15 #
16
17 @define _SYSCALL_MBIND_NAME
18 %(
19 name = "mbind"
20 %)
21
22 @define _SYSCALL_MBIND_ARGSTR
23 %(
24 argstr = sprintf("%p, %u, %s, %p, %u, %s", start, len,
25 mode_str, nmask_uaddr, maxnode, flags_str)
26 %)
27
28 @define _SYSCALL_MBIND_REGARGS
29 %(
30 start = pointer_arg(1)
31 len = ulong_arg(2)
32 mode = int_arg(3)
33 mode_str = _mempolicy_mode_str(mode)
34 nmask_uaddr = pointer_arg(4)
35 maxnode = ulong_arg(5)
36 flags = uint_arg(6)
37 flags_str = _mempolicy_flags_str(flags)
38 %)
39
40 @define _SYSCALL_MBIND_REGARGS_STORE
41 %(
42 if (@probewrite(start))
43 set_pointer_arg(1, start)
44
45 if (@probewrite(len))
46 set_ulong_arg(2, len)
47
48 if (@probewrite(mode))
49 set_int_arg(3, mode)
50
51 if (@probewrite(nmask_uaddr))
52 set_pointer_arg(4, nmask_uaddr)
53
54 if (@probewrite(maxnode))
55 set_ulong_arg(5, maxnode)
56
57 if (@probewrite(flags))
58 set_uint_arg(6, flags)
59 %)
60
61 probe syscall.mbind = dw_syscall.mbind !, nd_syscall.mbind ? {}
62 probe syscall.mbind.return = dw_syscall.mbind.return !, nd_syscall.mbind.return ? {}
63
64 # dw_mbind _____________________________________________________
65
66 probe dw_syscall.mbind = __syscall.mbind ?,
67 kernel.function("compat_sys_mbind").call ?
68 {
69 @_SYSCALL_MBIND_NAME
70 start = $start
71 mode = __int32($mode)
72 mode_str = _mempolicy_mode_str(mode)
73 nmask_uaddr = $nmask
74 flags = __uint32($flags)
75 flags_str = _mempolicy_flags_str(flags)
76 len = @__compat_ulong($len)
77 maxnode = @__compat_ulong($maxnode)
78 @_SYSCALL_MBIND_ARGSTR
79 }
80 probe __syscall.mbind = kernel.function("sys_mbind").call
81 {
82 %( arch == "powerpc" %?
83 @__syscall_gate_compat_simple
84 %)
85 }
86 probe dw_syscall.mbind.return = __syscall.mbind.return ?,
87 kernel.function("compat_sys_mbind").return ?
88 {
89 @_SYSCALL_MBIND_NAME
90 @SYSC_RETVALSTR($return)
91 }
92 probe __syscall.mbind.return = kernel.function("sys_mbind").return
93 {
94 %( arch == "powerpc" %?
95 @__syscall_gate_compat_simple
96 %)
97 }
98
99 # nd_mbind _____________________________________________________
100
101 probe nd_syscall.mbind = nd1_syscall.mbind!, nd2_syscall.mbind!, tp_syscall.mbind
102 { }
103
104 probe nd1_syscall.mbind = __nd1_syscall.mbind ?,
105 kprobe.function("compat_sys_mbind") ?
106 {
107 @_SYSCALL_MBIND_NAME
108 asmlinkage()
109 @_SYSCALL_MBIND_REGARGS
110 @_SYSCALL_MBIND_ARGSTR
111 }
112 probe __nd1_syscall.mbind = kprobe.function("sys_mbind")
113 {
114 %( arch == "powerpc" %?
115 @__syscall_gate_compat_simple
116 %)
117 }
118
119 /* kernel 4.17+ */
120 probe nd2_syscall.mbind = kprobe.function(@arch_syscall_prefix "sys_mbind") ?
121 {
122 __set_syscall_pt_regs(pointer_arg(1))
123 @_SYSCALL_MBIND_NAME
124 @_SYSCALL_MBIND_REGARGS
125 @_SYSCALL_MBIND_ARGSTR
126 },
127 {
128 %( @_IS_SREG_KERNEL %? @_SYSCALL_MBIND_REGARGS_STORE %)
129 }
130
131 /* kernel 3.5+, but undesirable because it affects all syscalls */
132 probe tp_syscall.mbind = kernel.trace("sys_enter")
133 {
134 __set_syscall_pt_regs($regs)
135 @__syscall_compat_gate(@const("__NR_mbind"), @const("__NR_compat_mbind"))
136 @_SYSCALL_MBIND_NAME
137 @_SYSCALL_MBIND_REGARGS
138 @_SYSCALL_MBIND_ARGSTR
139 },
140 {
141 %( @_IS_SREG_KERNEL %? @_SYSCALL_MBIND_REGARGS_STORE %)
142 }
143
144 probe nd_syscall.mbind.return = nd1_syscall.mbind.return!, nd2_syscall.mbind.return!, tp_syscall.mbind.return
145 { }
146
147 probe nd1_syscall.mbind.return = __nd1_syscall.mbind.return ?,
148 kprobe.function("compat_sys_mbind").return ?
149 {
150 @_SYSCALL_MBIND_NAME
151 @SYSC_RETVALSTR(returnval())
152 }
153 probe __nd1_syscall.mbind.return = kprobe.function("sys_mbind").return
154 {
155 %( arch == "powerpc" %?
156 @__syscall_gate_compat_simple
157 %)
158 }
159
160 /* kernel 4.17+ */
161 probe nd2_syscall.mbind.return = kprobe.function(@arch_syscall_prefix "sys_mbind").return ?
162 {
163 @_SYSCALL_MBIND_NAME
164 @SYSC_RETVALSTR(returnval())
165 }
166
167 /* kernel 3.5+, but undesirable because it affects all syscalls */
168 probe tp_syscall.mbind.return = kernel.trace("sys_exit")
169 {
170 __set_syscall_pt_regs($regs)
171 @__syscall_compat_gate(@const("__NR_mbind"), @const("__NR_compat_mbind"))
172 @_SYSCALL_MBIND_NAME
173 @SYSC_RETVALSTR($ret)
174 }