Debian Codegraph @

tapset/linux/i386/sysc_iopl.stp

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