Debian Codegraph @

tapset/linux/x86_64/sysc_iopl.stp

raw
1 # iopl _______________________________________________________
2 # long sys_iopl(unsigned int level, struct pt_regs *regs);
3 # NOTE. This function is only in i386 and x86_64 and its args vary
4 # between those two archs.
5 #
6
7 @define _SYSCALL_IOPL_NAME
8 %(
9 name = "iopl"
10 %)
11
12 @define _SYSCALL_IOPL_ARGSTR
13 %(
14 argstr = sprint(level)
15 %)
16
17 @define _SYSCALL_IOPL_REGARGS
18 %(
19 level = uint_arg(1)
20 %)
21
22 @define _SYSCALL_IOPL_REGARGS_STORE
23 %(
24 if (@probewrite(level))
25 set_uint_arg(1, level)
26 %)
27
28 probe syscall.iopl = dw_syscall.iopl !, nd_syscall.iopl {}
29 probe syscall.iopl.return = dw_syscall.iopl.return !, nd_syscall.iopl.return {}
30
31 # dw_iopl _____________________________________________________
32
33 probe dw_syscall.iopl = kernel.function("sys_iopl")
34 {
35 @_SYSCALL_IOPL_NAME
36 level = __uint32(@choose_defined($level, $new_iopl))
37 @_SYSCALL_IOPL_ARGSTR
38 }
39 probe dw_syscall.iopl.return = kernel.function("sys_iopl").return
40 {
41 @_SYSCALL_IOPL_NAME
42 @SYSC_RETVALSTR($return)
43 }
44
45 # nd_iopl _____________________________________________________
46
47 probe nd_syscall.iopl = nd1_syscall.iopl!, nd2_syscall.iopl!, tp_syscall.iopl
48 { }
49
50 probe nd1_syscall.iopl = kprobe.function("sys_iopl")
51 {
52 @_SYSCALL_IOPL_NAME
53 asmlinkage()
54 @_SYSCALL_IOPL_REGARGS
55 @_SYSCALL_IOPL_ARGSTR
56 }
57
58 /* kernel 4.17+ */
59 probe nd2_syscall.iopl = kprobe.function(@arch_syscall_prefix "sys_iopl") ?
60 {
61 __set_syscall_pt_regs(pointer_arg(1))
62 @_SYSCALL_IOPL_NAME
63 @_SYSCALL_IOPL_REGARGS
64 @_SYSCALL_IOPL_ARGSTR
65 },
66 {
67 %( @_IS_SREG_KERNEL %? @_SYSCALL_IOPL_REGARGS_STORE %)
68 }
69
70 /* kernel 3.5+, but undesirable because it affects all syscalls */
71 probe tp_syscall.iopl = kernel.trace("sys_enter")
72 {
73 __set_syscall_pt_regs($regs)
74 @__syscall_compat_gate(@const("__NR_iopl"), @const("__NR_ia32_iopl"))
75 @_SYSCALL_IOPL_NAME
76 @_SYSCALL_IOPL_REGARGS
77 @_SYSCALL_IOPL_ARGSTR
78 },
79 {
80 %( @_IS_SREG_KERNEL %? @_SYSCALL_IOPL_REGARGS_STORE %)
81 }
82
83 probe nd_syscall.iopl.return = nd1_syscall.iopl.return!, nd2_syscall.iopl.return!, tp_syscall.iopl.return
84 { }
85
86 probe nd1_syscall.iopl.return = kprobe.function("sys_iopl").return
87 {
88 @_SYSCALL_IOPL_NAME
89 @SYSC_RETVALSTR(returnval())
90 }
91
92 /* kernel 4.17+ */
93 probe nd2_syscall.iopl.return = kprobe.function(@arch_syscall_prefix "sys_iopl").return ?
94 {
95 @_SYSCALL_IOPL_NAME
96 @SYSC_RETVALSTR(returnval())
97 }
98
99 /* kernel 3.5+, but undesirable because it affects all syscalls */
100 probe tp_syscall.iopl.return = kernel.trace("sys_exit")
101 {
102 __set_syscall_pt_regs($regs)
103 @__syscall_compat_gate(@const("__NR_iopl"), @const("__NR_ia32_iopl"))
104 @_SYSCALL_IOPL_NAME
105 @SYSC_RETVALSTR($ret)
106 }