Debian Codegraph @

tapset/linux/sysc_ssetmask.stp

raw
1 # ssetmask ___________________________________________________
2 #
3 # long sys_ssetmask(int newmask)
4 #
5
6 @define _SYSCALL_SSETMASK_NAME
7 %(
8 name = "ssetmask"
9 %)
10
11 @define _SYSCALL_SSETMASK_ARGSTR
12 %(
13 argstr = _stp_sigmask_str(newmask)
14 %)
15
16 @define _SYSCALL_SSETMASK_REGARGS
17 %(
18 newmask = int_arg(1)
19 newmask_str = _stp_sigmask_str(newmask)
20 %)
21
22 @define _SYSCALL_SSETMASK_REGARGS_STORE
23 %(
24 if (@probewrite(newmask))
25 set_int_arg(1, newmask)
26 %)
27
28 probe syscall.ssetmask = dw_syscall.ssetmask !, nd_syscall.ssetmask ? {}
29 probe syscall.ssetmask.return = dw_syscall.ssetmask.return !,
30 nd_syscall.ssetmask.return ? {}
31
32 # dw_ssetmask _____________________________________________________
33
34 probe dw_syscall.ssetmask = kernel.function("sys_ssetmask").call ?
35 {
36 @_SYSCALL_SSETMASK_NAME
37 newmask = __int32($newmask)
38 newmask_str = _stp_sigmask_str(__int32($newmask))
39 @_SYSCALL_SSETMASK_ARGSTR
40 }
41 probe dw_syscall.ssetmask.return = kernel.function("sys_ssetmask").return ?
42 {
43 @_SYSCALL_SSETMASK_NAME
44 @SYSC_RETVALSTR($return)
45 }
46
47 # nd_ssetmask _____________________________________________________
48
49 probe nd_syscall.ssetmask = nd1_syscall.ssetmask!, nd2_syscall.ssetmask!, tp_syscall.ssetmask
50 { }
51
52 probe nd1_syscall.ssetmask = kprobe.function("sys_ssetmask") ?
53 {
54 @_SYSCALL_SSETMASK_NAME
55 asmlinkage()
56 @_SYSCALL_SSETMASK_REGARGS
57 @_SYSCALL_SSETMASK_ARGSTR
58 }
59
60 /* kernel 4.17+ */
61 probe nd2_syscall.ssetmask = kprobe.function(@arch_syscall_prefix "sys_ssetmask") ?
62 {
63 __set_syscall_pt_regs(pointer_arg(1))
64 @_SYSCALL_SSETMASK_NAME
65 @_SYSCALL_SSETMASK_REGARGS
66 @_SYSCALL_SSETMASK_ARGSTR
67 },
68 {
69 %( @_IS_SREG_KERNEL %? @_SYSCALL_SSETMASK_REGARGS_STORE %)
70 }
71
72 /* kernel 3.5+, but undesirable because it affects all syscalls */
73 probe tp_syscall.ssetmask = kernel.trace("sys_enter")
74 {
75 __set_syscall_pt_regs($regs)
76 @__syscall_compat_gate(@const("__NR_ssetmask"), @const("__NR_compat_ssetmask"))
77 @_SYSCALL_SSETMASK_NAME
78 @_SYSCALL_SSETMASK_REGARGS
79 @_SYSCALL_SSETMASK_ARGSTR
80 },
81 {
82 %( @_IS_SREG_KERNEL %? @_SYSCALL_SSETMASK_REGARGS_STORE %)
83 }
84
85 probe nd_syscall.ssetmask.return = nd1_syscall.ssetmask.return!, nd2_syscall.ssetmask.return!, tp_syscall.ssetmask.return
86 { }
87
88 probe nd1_syscall.ssetmask.return = kprobe.function("sys_ssetmask").return ?
89 {
90 @_SYSCALL_SSETMASK_NAME
91 @SYSC_RETVALSTR(returnval())
92 }
93
94 /* kernel 4.17+ */
95 probe nd2_syscall.ssetmask.return = kprobe.function(@arch_syscall_prefix "sys_ssetmask").return ?
96 {
97 @_SYSCALL_SSETMASK_NAME
98 @SYSC_RETVALSTR(returnval())
99 }
100
101 /* kernel 3.5+, but undesirable because it affects all syscalls */
102 probe tp_syscall.ssetmask.return = kernel.trace("sys_exit")
103 {
104 __set_syscall_pt_regs($regs)
105 @__syscall_compat_gate(@const("__NR_ssetmask"), @const("__NR_compat_ssetmask"))
106 @_SYSCALL_SSETMASK_NAME
107 @SYSC_RETVALSTR($ret)
108 }