Debian Codegraph @

tapset/linux/sysc_ioperm.stp

raw
1 # ioperm _____________________________________________________
2 # long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
3 #
4
5 @define _SYSCALL_IOPERM_NAME
6 %(
7 name = "ioperm"
8 %)
9
10 @define _SYSCALL_IOPERM_ARGSTR
11 %(
12 argstr = sprintf("%#x, %#x, %#x", from, num, turn_on)
13 %)
14
15 @define _SYSCALL_IOPERM_REGARGS
16 %(
17 from = ulong_arg(1)
18 num = ulong_arg(2)
19 turn_on = uint_arg(3)
20 %)
21
22 @define _SYSCALL_IOPERM_REGARGS_STORE
23 %(
24 if (@probewrite(from))
25 set_ulong_arg(1, from)
26
27 if (@probewrite(num))
28 set_ulong_arg(2, num)
29
30 if (@probewrite(turn_on))
31 set_uint_arg(3, turn_on)
32 %)
33
34 probe syscall.ioperm = dw_syscall.ioperm !, nd_syscall.ioperm ? {}
35 probe syscall.ioperm.return = dw_syscall.ioperm.return !, nd_syscall.ioperm.return ? {}
36
37 # dw_ioperm _____________________________________________________
38
39 probe dw_syscall.ioperm = kernel.function("sys_ioperm").call ?
40 {
41 @_SYSCALL_IOPERM_NAME
42 from = __ulong($from)
43 num = __ulong($num)
44 turn_on = __uint32($turn_on)
45 @_SYSCALL_IOPERM_ARGSTR
46 }
47 probe dw_syscall.ioperm.return = kernel.function("sys_ioperm").return ?
48 {
49 @_SYSCALL_IOPERM_NAME
50 @SYSC_RETVALSTR($return)
51 }
52
53 # nd_ioperm _____________________________________________________
54
55 probe nd_syscall.ioperm = nd1_syscall.ioperm!, nd2_syscall.ioperm!, tp_syscall.ioperm
56 { }
57
58 probe nd1_syscall.ioperm = kprobe.function("sys_ioperm") ?
59 {
60 @_SYSCALL_IOPERM_NAME
61 asmlinkage()
62 @_SYSCALL_IOPERM_REGARGS
63 @_SYSCALL_IOPERM_ARGSTR
64 }
65
66 /* kernel 4.17+ */
67 probe nd2_syscall.ioperm = kprobe.function(@arch_syscall_prefix "sys_ioperm") ?
68 {
69 __set_syscall_pt_regs(pointer_arg(1))
70 @_SYSCALL_IOPERM_NAME
71 @_SYSCALL_IOPERM_REGARGS
72 @_SYSCALL_IOPERM_ARGSTR
73 },
74 {
75 %( @_IS_SREG_KERNEL %? @_SYSCALL_IOPERM_REGARGS_STORE %)
76 }
77
78 /* kernel 3.5+, but undesirable because it affects all syscalls */
79 probe tp_syscall.ioperm = kernel.trace("sys_enter")
80 {
81 __set_syscall_pt_regs($regs)
82 @__syscall_compat_gate(@const("__NR_ioperm"), @const("__NR_compat_ioperm"))
83 @_SYSCALL_IOPERM_NAME
84 @_SYSCALL_IOPERM_REGARGS
85 @_SYSCALL_IOPERM_ARGSTR
86 },
87 {
88 %( @_IS_SREG_KERNEL %? @_SYSCALL_IOPERM_REGARGS_STORE %)
89 }
90
91 probe nd_syscall.ioperm.return = nd1_syscall.ioperm.return!, nd2_syscall.ioperm.return!, tp_syscall.ioperm.return
92 { }
93
94 probe nd1_syscall.ioperm.return = kprobe.function("sys_ioperm").return ?
95 {
96 @_SYSCALL_IOPERM_NAME
97 @SYSC_RETVALSTR(returnval())
98 }
99
100 /* kernel 4.17+ */
101 probe nd2_syscall.ioperm.return = kprobe.function(@arch_syscall_prefix "sys_ioperm").return ?
102 {
103 @_SYSCALL_IOPERM_NAME
104 @SYSC_RETVALSTR(returnval())
105 }
106
107 /* kernel 3.5+, but undesirable because it affects all syscalls */
108 probe tp_syscall.ioperm.return = kernel.trace("sys_exit")
109 {
110 __set_syscall_pt_regs($regs)
111 @__syscall_compat_gate(@const("__NR_ioperm"), @const("__NR_compat_ioperm"))
112 @_SYSCALL_IOPERM_NAME
113 @SYSC_RETVALSTR($ret)
114 }