Debian Codegraph @

tapset/linux/sysc_shmdt.stp

raw
1 # shmdt ______________________________________________________
2 #
3 # long sys_shmdt(char __user *shmaddr)
4 #
5
6 @define _SYSCALL_SHMDT_NAME
7 %(
8 name = "shmdt"
9 %)
10
11 @define _SYSCALL_SHMDT_ARGSTR
12 %(
13 argstr = sprintf("%p", shmaddr_uaddr)
14 %)
15
16 @define _SYSCALL_SHMDT_REGARGS
17 %(
18 shmaddr_uaddr = pointer_arg(1)
19 %)
20
21 @define _SYSCALL_SHMDT_REGARGS_STORE
22 %(
23 if (@probewrite(shmaddr_uaddr))
24 set_pointer_arg(1, shmaddr_uaddr)
25 %)
26
27 @define _SYSCALL_IPC_SHMDT_REGARGS
28 %(
29 shmaddr_uaddr = pointer_arg(5)
30 %)
31
32 @define _SYSCALL_IPC_SHMDT_REGARGS_STORE
33 %(
34 if (@probewrite(shmaddr_uaddr))
35 set_pointer_arg(5, shmaddr_uaddr)
36 %)
37
38 probe syscall.shmdt = dw_syscall.shmdt !, nd_syscall.shmdt ? {}
39 probe syscall.shmdt.return = dw_syscall.shmdt.return !,
40 nd_syscall.shmdt.return ? {}
41
42 # dw_shmdt _____________________________________________________
43
44 probe dw_syscall.shmdt = kernel.function("sys_shmdt").call ?
45 {
46 @_SYSCALL_SHMDT_NAME
47 shmaddr_uaddr = $shmaddr
48 @_SYSCALL_SHMDT_ARGSTR
49 }
50 probe dw_syscall.shmdt.return = kernel.function("sys_shmdt").return ?
51 {
52 @_SYSCALL_SHMDT_NAME
53 @SYSC_RETVALSTR($return)
54 }
55
56 # nd_shmdt _____________________________________________________
57
58 probe nd_syscall.shmdt = nd1_syscall.shmdt!, nd2_syscall.shmdt!, tp_syscall.shmdt
59 { }
60
61 probe nd1_syscall.shmdt = kprobe.function("sys_shmdt") ?
62 {
63 @_SYSCALL_SHMDT_NAME
64 asmlinkage()
65 @_SYSCALL_SHMDT_REGARGS
66 @_SYSCALL_SHMDT_ARGSTR
67 }
68
69 /* kernel 4.17+ */
70 probe nd2_syscall.shmdt = __nd2_syscall.shmdt ?, __nd2_syscall.compat_ipc.shmdt ?
71 {
72 @_SYSCALL_SHMDT_NAME
73 @_SYSCALL_SHMDT_ARGSTR
74 }
75 probe __nd2_syscall.shmdt =
76 kprobe.function(@arch_syscall_prefix "sys_shmdt") ?
77 {
78 __set_syscall_pt_regs(pointer_arg(1))
79 @_SYSCALL_SHMDT_REGARGS
80 },
81 {
82 %( @_IS_SREG_KERNEL %? @_SYSCALL_SHMDT_REGARGS_STORE %)
83 }
84 probe __nd2_syscall.compat_ipc.shmdt =
85 kprobe.function(@arch_syscall_prefix "compat_sys_ipc") ?
86 {
87 __set_syscall_pt_regs(pointer_arg(1))
88 if (int_arg(1) != @const("SHMDT")) next;
89 @_SYSCALL_IPC_SHMDT_REGARGS
90 },
91 {
92 %( @_IS_SREG_KERNEL %? @_SYSCALL_IPC_SHMDT_REGARGS_STORE %)
93 }
94
95 /* kernel 3.5+, but undesirable because it affects all syscalls */
96 probe tp_syscall.shmdt = __tp_syscall.shmdt, __tp_syscall.compat_ipc.shmdt
97 {
98 @_SYSCALL_SHMDT_NAME
99 @_SYSCALL_SHMDT_ARGSTR
100 }
101 probe __tp_syscall.shmdt = kernel.trace("sys_enter")
102 {
103 __set_syscall_pt_regs($regs)
104 @__syscall_gate(@const("__NR_shmdt"))
105 @_SYSCALL_SHMDT_REGARGS
106 },
107 {
108 %( @_IS_SREG_KERNEL %? @_SYSCALL_SHMDT_REGARGS_STORE %)
109 }
110 probe __tp_syscall.compat_ipc.shmdt = kernel.trace("sys_enter")
111 {
112 __set_syscall_pt_regs($regs)
113 @__compat_syscall_gate(@const("__NR_compat_ipc"))
114 if (int_arg(1) != @const("SHMDT")) next;
115 @_SYSCALL_IPC_SHMDT_REGARGS
116 },
117 {
118 %( @_IS_SREG_KERNEL %? @_SYSCALL_IPC_SHMDT_REGARGS_STORE %)
119 }
120
121 probe nd_syscall.shmdt.return = nd1_syscall.shmdt.return!, nd2_syscall.shmdt.return!, tp_syscall.shmdt.return
122 { }
123
124 probe nd1_syscall.shmdt.return = kprobe.function("sys_shmdt").return ?
125 {
126 @_SYSCALL_SHMDT_NAME
127 @SYSC_RETVALSTR(returnval())
128 }
129
130 /* kernel 4.17+ */
131 probe nd2_syscall.shmdt.return =
132 kprobe.function(@arch_syscall_prefix "sys_shmdt").return ?,
133 __nd2_syscall.compat_ipc.shmdt.return ?
134 {
135 @_SYSCALL_SHMDT_NAME
136 @SYSC_RETVALSTR(returnval())
137 }
138 probe __nd2_syscall.compat_ipc.shmdt.return =
139 kprobe.function(@arch_syscall_prefix "compat_sys_ipc").return ?
140 {
141 __set_syscall_pt_regs(@entry(pointer_arg(1)))
142 if (int_arg(1) != @const("SHMDT")) next;
143 }
144
145 /* kernel 3.5+, but undesirable because it affects all syscalls */
146 probe tp_syscall.shmdt.return = __tp_syscall.shmdt.return,
147 __tp_syscall.compat_ipc.shmdt.return
148 {
149 @_SYSCALL_SHMDT_NAME
150 @SYSC_RETVALSTR($ret)
151 }
152 probe __tp_syscall.shmdt.return = kernel.trace("sys_exit")
153 {
154 @__syscall_gate(@const("__NR_shmdt"))
155 }
156 probe __tp_syscall.compat_ipc.shmdt.return = kernel.trace("sys_exit")
157 {
158 __set_syscall_pt_regs($regs)
159 @__compat_syscall_gate(@const("__NR_compat_ipc"))
160 if (int_arg(1) != @const("SHMDT")) next;
161 }