Debian Codegraph @

tapset/linux/sysc_mq_notify.stp

raw
1 # mq_notify __________________________________________________
2 # long sys_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification)
3 # long compat_sys_mq_notify(mqd_t mqdes, const struct compat_sigevent __user *u_notification)
4 #
5
6 @define _SYSCALL_MQ_NOTIFY_NAME
7 %(
8 name = "mq_notify"
9 %)
10
11 @define _SYSCALL_MQ_NOTIFY_ARGSTR
12 %(
13 argstr = sprintf("%d, %p", mqdes, notification_uaddr)
14 %)
15
16 @define _SYSCALL_MQ_NOTIFY_REGARGS
17 %(
18 mqdes = int_arg(1)
19 notification_uaddr = pointer_arg(2)
20 %)
21
22 @define _SYSCALL_MQ_NOTIFY_REGARGS_STORE
23 %(
24 if (@probewrite(mqdes))
25 set_int_arg(1, mqdes)
26
27 if (@probewrite(notification_uaddr))
28 set_pointer_arg(2, notification_uaddr)
29 %)
30
31 probe syscall.mq_notify = dw_syscall.mq_notify !, nd_syscall.mq_notify ? {}
32 probe syscall.mq_notify.return = dw_syscall.mq_notify.return !,
33 nd_syscall.mq_notify.return ? {}
34
35 # dw_mq_notify _____________________________________________________
36
37 probe dw_syscall.mq_notify =
38 __syscall.mq_notify,
39 kernel.function("compat_sys_mq_notify").call ?
40 {
41 @_SYSCALL_MQ_NOTIFY_NAME
42 mqdes = __int32($mqdes)
43 notification_uaddr = @__pointer($u_notification)
44 @_SYSCALL_MQ_NOTIFY_ARGSTR
45 }
46 probe __syscall.mq_notify = kernel.function("sys_mq_notify").call
47 {
48 @__syscall_gate(@const("__NR_mq_notify"))
49 }
50 probe dw_syscall.mq_notify.return =
51 __syscall.mq_notify.return,
52 kernel.function("compat_sys_mq_notify").return ?
53 {
54 @_SYSCALL_MQ_NOTIFY_NAME
55 @SYSC_RETVALSTR($return)
56 }
57 probe __syscall.mq_notify.return = kernel.function("sys_mq_notify").return
58 {
59 @__syscall_gate(@const("__NR_mq_notify"))
60 }
61
62 # nd_mq_notify _____________________________________________________
63
64 probe nd_syscall.mq_notify = nd1_syscall.mq_notify!, nd2_syscall.mq_notify!, tp_syscall.mq_notify
65 { }
66
67 probe nd1_syscall.mq_notify =
68 __nd1_syscall.mq_notify ?,
69 kprobe.function("compat_sys_mq_notify") ?
70 {
71 @_SYSCALL_MQ_NOTIFY_NAME
72 asmlinkage()
73 @_SYSCALL_MQ_NOTIFY_REGARGS
74 @_SYSCALL_MQ_NOTIFY_ARGSTR
75 }
76 probe __nd1_syscall.mq_notify = kprobe.function("sys_mq_notify")
77 {
78 @__syscall_gate(@const("__NR_mq_notify"))
79 }
80
81 /* kernel 4.17+ */
82 probe nd2_syscall.mq_notify =
83 kprobe.function(@arch_syscall_prefix "sys_mq_notify") ?,
84 kprobe.function(@arch_syscall_prefix "compat_sys_mq_notify") ?
85 {
86 __set_syscall_pt_regs(pointer_arg(1))
87 @_SYSCALL_MQ_NOTIFY_NAME
88 @_SYSCALL_MQ_NOTIFY_REGARGS
89 @_SYSCALL_MQ_NOTIFY_ARGSTR
90 },
91 {
92 %( @_IS_SREG_KERNEL %? @_SYSCALL_MQ_NOTIFY_REGARGS_STORE %)
93 }
94
95 /* kernel 3.5+, but undesirable because it affects all syscalls */
96 probe tp_syscall.mq_notify = kernel.trace("sys_enter")
97 {
98 __set_syscall_pt_regs($regs)
99 @__syscall_compat_gate(@const("__NR_mq_notify"), @const("__NR_compat_mq_notify"))
100 @_SYSCALL_MQ_NOTIFY_NAME
101 @_SYSCALL_MQ_NOTIFY_REGARGS
102 @_SYSCALL_MQ_NOTIFY_ARGSTR
103 },
104 {
105 %( @_IS_SREG_KERNEL %? @_SYSCALL_MQ_NOTIFY_REGARGS_STORE %)
106 }
107
108 probe nd_syscall.mq_notify.return = nd1_syscall.mq_notify.return!, nd2_syscall.mq_notify.return!, tp_syscall.mq_notify.return
109 { }
110
111 probe nd1_syscall.mq_notify.return =
112 __nd1_syscall.mq_notify.return ?,
113 kprobe.function("compat_sys_mq_notify").return ?
114 {
115 @_SYSCALL_MQ_NOTIFY_NAME
116 @SYSC_RETVALSTR(returnval())
117 }
118 probe __nd1_syscall.mq_notify.return = kprobe.function("sys_mq_notify").return
119 {
120 @__syscall_gate(@const("__NR_mq_notify"))
121 }
122
123 /* kernel 4.17+ */
124 probe nd2_syscall.mq_notify.return =
125 kprobe.function(@arch_syscall_prefix "sys_mq_notify").return ?,
126 kprobe.function(@arch_syscall_prefix "compat_sys_mq_notify").return ?
127 {
128 @_SYSCALL_MQ_NOTIFY_NAME
129 @SYSC_RETVALSTR(returnval())
130 }
131
132 /* kernel 3.5+, but undesirable because it affects all syscalls */
133 probe tp_syscall.mq_notify.return = kernel.trace("sys_exit")
134 {
135 __set_syscall_pt_regs($regs)
136 @__syscall_compat_gate(@const("__NR_mq_notify"), @const("__NR_compat_mq_notify"))
137 @_SYSCALL_MQ_NOTIFY_NAME
138 @SYSC_RETVALSTR($ret)
139 }